R: What are the best functions to deal with concatenating and averaging values in a data.frame?

前端 未结 3 803
时光取名叫无心
时光取名叫无心 2021-01-06 19:59

I have a data.frame from this code:

   my_df = data.frame(\"read_time\" = c(\"2010-02-15\", \"2010-02-15\", 
                                      \"2010-02-         


        
3条回答
  •  长情又很酷
    2021-01-06 20:34

    You can try the package data.table. If you know MySQL it should be very easy for you to get all the functions, otherwise the basics are good enough too ;-)

    my_dfdt<-data.table(my_df)
    mean<-my_dfdt[,mean(OD), by="read_time"]
    sd<-  ..  
    

    you can also join both in one line or to cbind at the end, your call of style

    Another advantage: it is extremely fast, if you have large samples. Very fast...see documentation why.

提交回复
热议问题