Working with R and RStudio.

R is a programming language for statistical computing and RStudio an IDE. If you want to use it, install R first, and than the IDE (linked on IDE Website).

I use it for a project at university and want to sum up some important information for my mind and the other people struggling with it and searching for help at the Neuland.

Or maybe…

I’ll go back to work and write this article later. Tomorrow. Or the day after tomorrow. Or the year after. Hmmm…

Some commands

General

print(„Hello world“)

# Yeah, this is a comment!

print(result) # Print Var/Obj/whatever (?), but also execute, see notice.

plot(x,y) # Build a graph in the plot window. It’s like at school with x and y values.

Libraries

You need libraries for doing cool stuff and even some basic stuff. Just install them via the package manager (or console install) and embed them in your document. Her are my libraries at this point of time. See also: support.rstudio.com/ Quick list of useful R packages

Important: I don’t know why, but cbind and some other commands only worked for me after executing them with print or other related commands. I hope i’ll understand why later. If something is broken without a reason try print.

I’ll use now some German words in the examples, don’t be confused. E.g. „ergebnis“ means „result“.