Here there is a simple solution for the problem. This command:
script.dir <- dirname(sys.frame(1)$ofile)
returns the path of the current script file. It works after the script was saved.
More Related Contents:
- Automatically Delete Files/Folders
- How to make a great R reproducible example
- Split comma-separated strings in a column into separate rows
- Transpose / reshape dataframe without “timevar” from long to wide format
- How should I deal with “package ‘xxx’ is not available (for R version x.y.z)” warning?
- Add legend to ggplot2 line plot
- How to find the statistical mode?
- Split data.frame based on levels of a factor into new data.frames
- Combine a list of data frames into one data frame by row
- How to write trycatch in R
- Unique combination of all elements from two (or more) vectors
- How to read data when some numbers contain commas as thousand separator?
- How to split a data frame?
- Test if a vector contains a given element
- Counting the number of elements with the values of x in a vector
- How to call an object with the character variable of the same name
- Only read selected columns
- ggplot’s qplot does not execute on sourcing
- ggplot2 line chart gives “geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?”
- How to name variables on the fly?
- Cleaning up factor levels (collapsing multiple levels/labels)
- Plot multiple columns on the same graph in R [duplicate]
- Concatenate a vector of strings/character
- Convert UNIX epoch to Date object
- Use variable names in functions of dplyr
- Access variable value where the name of variable is stored in a string
- Remove groups with less than three unique observations
- List distinct values in a vector in R
- Dollar sign before a variable
- Folder management with r : Check existence of directory and create it if it doesn’t exist