A couple of notes before I start:
The last tutorial was an introduction. This one and everyone from now on will try and follow one simple structure. There will be a goal on what we learn at the end of it. Every subsequent chapter will probably build on what we’ve learned before.
Please type and not just read these. Even if seems like you can understand it – which it mostly will. Refrain from the temptation to just read. Just start typing these commands into your screen. You will go much beyond beyond these tutorials if you teach yourself by typing and becoming familiar with the syntax. Can’t stress enough on this.
Goal of this chapter:
Create a simple data set of multiples of 3 starting from 30 – 120. Explore some basic statistical properties mean, variance, standard deviation and variance of this data set. You will be exploring basic properties a lot if you’re working with data. Useful to know.
Type the following commands:
#Start typing. Do not read!Including these comments.
#This is a way to comment out code
print(“Why am I typing this?”)
print(“Probbly to learn something”)
print(“Let’s try printing two sentences now.”);print(“Here you go.”)
cat(“This is a way of joining stuff”,”here you go”)
cat(“Use it with variables as well”;c)
# Now to create small data sets
#Stop here. Notice how different it is from traditional matrix multiplication.
#Stop here.Look up correlation if you do not know it.
#Now we’re getting closer to the goal
seq(from=1, to=15, by=3)
#Stop here. You should be able to solve the goal.
Take the above code – copy paste it into an editor and write a comment before the start of each line explaining what it does. Use help() if required.
Additional fun -
We introduced an important concept of correlation. Watch this video from the Khan Academy just to never confuse it causation.
Feedback? Send it romymisra [at] gmail.com or in the comments.