[R] Split

Miloš Žarković m||o@@z@rkov|c @end|ng |rom gm@||@com
Mon Dec 23 20:18:08 CET 2019


If I understand correctly you need summary by group. I would suggest
arsenal package and tableby

tab1 <- tableby(group ~ anova(var, "meansd", digits=1) +  #mean and sd +
round to 1 digit + anova
                  kwt(var, "medianq1q3", digits=1) , #median q1 and q3 +
round to 1 digit + Kruskal-Wallis
                 data=sn.l.v2.t0)
summary(tab1,text=TRUE) #output as txt to console
write2word(tab1,"tab1.docx", pfootnote=TRUE) #save as formatted word table

or even simpler using Rcmdr - Statistics - Numerical summaries and tha
choose summarize by groups

Milos

On Mon, 23 Dec 2019 at 15:57, Medic <mailiPadpost using gmail.com> wrote:

> I have
> mydata$var
>
> and I have
> mydata$group #two group
>
> I would like to split
> mydata$var
> by
> mydata$group #to get var1 and var2
>
> And then get
> summary (var1, var2)  #this is my finite aim
>
> How to encode it all?
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list