[R] Coding help for data frame.

Anaanthan Pillai @n@@nth@np|||@| @end|ng |rom gm@||@com
Thu Mar 21 13:01:27 CET 2019


Good day,

#I’ve created hypothetical data for drug X and drug Y whereby both drug have the ability to have HbA1c reduction.

set.seed(10)
drugx= rnorm(50, mean = 0.1, sd=0.02)

set.seed(11)
drugy= rnorm(50, mean=0.15, sd=0.03)

#And created a data frame, compare drugs (comdrug) of 50 patients for each drug.

comdrug= data.frame("ID"=c(1:50), "DrugX"=drugx, "DrugY"=drugy)

# whereby the data would look like this

head(comdrug)

> head(comdrug)
  ID      DrugX     DrugY
1  1 0.10037492 0.1322691
2  2 0.09631495 0.1507978
3  3 0.07257339 0.1045034
4  4 0.08801665 0.1091204
5  5 0.10589090 0.1853547
6  6 0.10779589 0.1219755

Is there anyway of coding if I could arrange like this?





More information about the R-help mailing list