The below vector is used to loop over 3 columns that I want to cross tabulate against sexual identity:
```{r}
l=c("nationality", "sex_at_birth", "education")
for (i in l){
mytables<-table(HIV_coded$sexual_identity, HIV_coded[,i])
print(mytables)
}
```
The below loop is used to calculate the summary statistics for a series of variables:
```
l=c("age", "age_1")
for (i in l) {
mymeans<-summary(HIV_coded[,i])
print(mymeans)
}
```
Introduction to the Analysis of Survival Data in the Presence of Competing Risks
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4741409/
-
In the below example i show how to assign a label (in this case Casenr) to each data point on my scatter plot. ``` plot(BMI~Age, data=pr...
-
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...
-
Sometimes when you are running a regression model with variables that have different lengths, r will prompt with the following error message...