05:00
2024-04-01
We all have free access to OneDrive to store files
Let’s login into our online accounts
You can also download OneDrive for your desktop
Allows you to access the OneDrive from your computer’s interface instead of the browser
Creates a link between your computer and the cloud!
Let me show you mine
Let’s take a couple minutes to log into OneDrive
05:00
Make these folders in your computer
For a project, I usually have the following folders
For our class, I suggest making one folder for the course with the following folders in it:
05:00
Go into the Student files folder
Download the dataset in Sample_folder, under Data
Create your own Sample_folder under Notes
Alternatively, you can download all of Sample_folder and then put that under Notes
Way to designate a working directory: basically your home base when working in R
We have to tell R exactly where we are in our folders and where to find other things
A project makes it easier to tell R where we are
Basic steps to create a project
Go into RStudio
Create new project for this class (under File
or top right corner)
Once we have projects, we can open one are R will automatically know that its location is the start of our working directory
Let me show you my process
I will create one in my Sample_folder
I will show you how I switch between classes
05:00
qmd
fileBasic steps
Create new .qmd
(under File
or top left corner)
Decide on document types/options
Let me show you my process
Create a .qmd
in your Sample_folder under any folder (maybe Notes is good)
05:00
Source
vs. Visual
Just substitute .Rmd
with .qmd
Basically, a .qmd
file and .R
file work differently
.R
filesFor .qmd
files, the automatic directory is the folder it is in
here
can help with that
here
packagehere
package: you can do this in your console (not inside .qmd
file)Within your console, type here()
and enter
getwd()
as wellhere()
to load dataThere here()
function will start at the working directory (where your .Rproj
file is) and let you write out a file path for anything
To load the dataset in our .qmd
file, we will use:
Watch out when using lubridate package simultaneously
Use here::here()
if you have lubridate
loaded within same .qmd
. This will tell R to use the function here()
within the here
package instead of lubridate
’s here()
function. To call lubridate’s function, we’d use lubridate::here()
05:00
Lesson 1: File Organization within R