Created
September 8, 2020 23:29
-
-
Save davan690/a30fb970b5dd866297e228e0926edcee to your computer and use it in GitHub Desktop.
Understanding files paths in Rstudio and R 4.0.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure you have the project running through RStudio with a "project" file within the root directory. | |
#libraries | |
library(here) | |
library(tidyverse) | |
# 1. Place R scripts in folder within the root directory (project file location) | |
# 2. Source file from this location in RMD file | |
source("./R/Rscriptv1.R") | |
# Note that this wil not work if the location of "./R/Rscriptv1.R" has been changed since first importing data etc | |
# TO fix this with the same core R directory use the here function like so: | |
source(here::here("./R/Rscriptv1.R")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment