One R Tip a Day (@rlangtip) 's Twitter Profile
One R Tip a Day

@rlangtip

One tip per day M-F on the R programming language #rstats. Brought to you by the R community team at Microsoft.

ID: 295344317

calendar_today08-05-2011 20:51:40

2,2K Tweet

69,69K Followers

10 Following

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

rle(x) ("run-length encoding") computes the lengths of runs of equal values in a vector rdocumentation.org/packages/base/… #rstats

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

Data Carpentry for Biologists: a self-guided 15-week course with videos and exercises in R datacarpentry.org/semester-biolo… #rstats

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

format(x, scientific=TRUE) prints numeric data in exponential format, so 0.0001 prints as 1e-04 rdocumentation.org/packages/base/… #rstats

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

Use colSums to quickly calculate totals from the columns of a large matrix or table: rdocumentation.org/packages/base/… #rstats

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

Use TRUE and FALSE to represent the boolean values. These are reserved words, unlike T and F which can be overwritten as variables.

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

Use R to add text, tables and charts to a Word or Powerpoint template with the officer package #rstats davidgohel.github.io/officer/

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

Look here rdocumentation.org/packages/base/… for documentation on mathematical functions like beta(a,b) or gamma(x) #rstats

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

The "round" function uses the "round-to-even" rule. round(3.5) and round(4.5) are both 4 rdocumentation.org/packages/base/… #rstats

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

Use the Matrix package for efficient linear algebra with sparse, symmetric, positive semidefinite and general matrices jimskinner.github.io/post/elegant-l… #rstats

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

If two packages define functions with the same name, use :: to call the one you want: stackoverflow.com/q/39137110/154… #rstats

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

Strip non-ASCII characters from a string with iconv(rich.text, to="ASCII", sub="") #rstats rdocumentation.org/packages/base/…

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

Use saveRDS(obj,"myfile") and readRDS(obj,"myfile") to save / read an R object to / from a file rdocumentation.org/packages/base/… #rstats

One R Tip a Day (@rlangtip) 's Twitter Profile Photo

boot(data,statistic,R) in the {boot} package will generate R bootstrap replicates of a statistic cran.r-project.org/package=boot #rstats