Date and Time variables

convert text into date: > newvariable<-as.Date("2015-01-28", "%Y-%m-%d") > newvariable [1] "2015-01-28" convert text into date/time: > newvariable<-strptime("2015-01-28 17:45:23", "%Y-%m-%d %H:%M:%S")...

Working with text variables

search for some text (case sensitive): grep(“text I am looking for”, textvariable) search for some text (case INsensitive): grep(“text I am looking for”, textvariable, ignore.case=T)

Casts

R language is very intelligent regarding data types. But sometimes it can be confused – see my test set 1, column “dollar”. Because it hase character “$” at the beginning, column is understud as string. But casts are in R very simple and...

Workspace

setwd – set workspace directory getwd – get working directory dir – list of files in current (without parameter) or specified directory list.files(dir) – same as dir with parameter objects, ls – objects in current directory (based on...

Loops

repeat ….. while (condition) ….. for (variable in list) ….. for (variable in seq() ) …… other loops can be found in library “iterators” – nextElem, foreach,

Packages and Libraries

show default Packages: > getOption("defaultPackages") [1] "datasets" "utils" "grDevices" "graphics" "stats" [6] "methods" currently loaded packages: > (.packages()) [1] "stats"...