R codes and Programming
Practical way to label factors
```
library(memisc)
labels(anemia$anem)<-c("not anemic"=0, "anemic"=1) #library memisc
```
Newer Post
Older Post
Home
Introduction to the Analysis of Survival Data in the Presence of Competing Risks
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4741409/
About subsetting data in R
Unlike Stata and other statistical package, running a cross tabulation on a subset of data in R is not a very straight forward thing. Let ...
different usages of tapply
using tapply to run a command, in this case calculating the variance of the variable met within each of the categories of the variable coffe...
running a command on a subset of data (similar to if condition in stata)
``` hist(coffee.exercise$met[coffee.exercise$coffee.consumption=="A"]) hist(coffee.exercise$met[coffee.exercise$coffee.consumpt...