The first half of this class will be dedicated to getting familiar with R.
R language for working with data. RStudio is an environment for working with that language.
By the time we’re done, you should be comfortable manipulating and examining data.
This is going to accomplish a few things for us.
#Generate 500 heads and tails data <- sample(c("Heads","Tails"),500,replace=TRUE) #Calculate the proportion of heads mean(data=="Heads") #This line should give an error - it didn't work! data <- sample(c("Heads","Tails"),500,replace=BLUE) #This line should give a warning #It did SOMETHING but maybe not what you want mean(data) #This line won't give an error or a warning #But it's not what we want! mean(data=="heads")
dataobject, so we can see that in Environment
data(LifeCycleSavings) plot(density(LifeCycleSavings$pop75),main='Percent of Population over 75')
help()in the console
#lets you write a comment.
data(mtcars) mean(mtcars$mpg) mean(mtcars$wt) 372+565 log(exp(1)) 2^9 (1+1)^9
help(mean), for example, will show you:
See you next time!