Wednesday, April 3, 2013

An Annotated R History Log

As part of my learning of the R statistical programming language I am reviewing the contents of my history() log at the end of each days session. Here is a dump of that with an explanation of what I was trying to do:


help(solve) - get help on the solve function. Something to do with solving systems of equations. Not what I was looking for.

help() - help on 'help'. Not that useful.

help.start() - starts the help server and shows you the home page. Has some handy reference links, but just using Google whenever I get stuck seems to be doing the trick.

help(mean) - what is a mean.

example(mean) - this is handy. Gives you just the example section of the help. Without starting the http help server which can be a bit annoying.

 x <- c(0:10, 50) - create a vector containing the numbers 0 to 10 and 50. c stands for combine.

x - this just prints the values of x. You can use print(x), but I am not sure why you would.

mean(x) <- calc the mean of a vector x.

help(sink) - this function sends r data to a destination. A file for example.

ls()  - show all the objects in the current session.

rm(x) - remove a named object from the current session.

history() - show this history file. Be careful to use this version: history(max.show=Inf) if you want to see more than 25 lines.


This is all a bit basic at the moment, but hopefully with time it will get a lot more useful to people who want to try to learn R too.

No comments:

Post a Comment