Open up this .Rmd file in RStudio.
In the code chunk below type getwd() and run it.
“wd” means “working directory”, or where R will currently save files if you tell it to save anything.
# Get the current working directory
getwd()
## [1] "/Users/sudeeepy/Downloads"
Copy and paste the current wd in the code chunk below behind a comment so it won’t run as code.
# put your current wd here with a "#" in front of it
#"/Users/sudeeepy/Downloads"
Now we will change the working directory.
A line of code beginning with setwd() will automatically appear in the console.
Copy and paste the current wd in the code chunk below behind a comment so it won’t run as code.
Copy and paste this line of code into the code chunk below with a comment character in front of it.
# put your current wd here
#"/Users/sudeeepy/University of Pittsburgh/University of Pittsburgh/compbio2021 - suy19"
Mine is: “/Users/nlb24/University of Pittsburgh/compbio2021 - General/student_folders”
Click on the downward facing triangle next to the “Knit” icon with the ball of yarn.
Select “Knit to Word”.
Locate your working directory and confirm that a word file was create. Searching for “working_directory_test.docx” may bring it up for you (especially on a Mac)
We want to get this onto RPubs.
FIRST, however, I think we ALWAYS need to knit the file to HTML.
So, first, Click on the downward facing triangle next to the “Knit” icon with the ball of yarn.
Select “Knit to HTML”
Then we can publish it to RPubs by clicking the blue publish icon with the dot in the middle.
Any time you change the document it needs to be knit again to HTML before you can update RPubs.