~10 Minutes
Scripts are text files of code.
Projects are folder structures. An R project:
Let's make a new project!
File -> New Project
Select "New Directory".
We won't cover Version Control today.
Create an Empty Project
I promise, you don't want to do either of the others.
Directory Name: foo
~
is your home directory
Don't start a repository.
RStudio creates a git repo at the project root.
Spacer
Spacer
"Open in new session" opens a new window.
R version 3.3.3 (2017-03-06) -- "Another Canoe"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> getwd()
[1] "/home/abby/foo"
Locate your new folder.
foo.Rproj
is an RStudio file.
## Load some data:
data(cars)
## Look at it:
str(cars)
head(cars)
?cars
## Play with it:
colMeans(cars)
plot(cars$speed, cars$dist)
Save the file as my_cars.R
. What happens?
What does this code return? Does it make sense?
getwd()
Close RStudio and restart it.
Open your project.
Create your own structure.
Today's example is modeled on R packages.
Goals:
Root Project Folder (foo):
Start your R journey with documentation!
README.md
is a naming convention.We will cover Markdown language in a future workshop.
For now, use plain text.
Next up: Packages