Elance Exams Answers PDF file

-- PDF FILE --
Download PDF file of elance Zoho Creator Exam Answers

Which is the fastest way to calculate groupwise means of a variable "x" for each level of a factor called "factor", given you have installed base R, data.table, and plyr?

df[ ,mean(x), by = factor ]
for( f in levels( df$factor ) ) print( mean( subset( df, factor == f )$x ) )
sapply( levels( df$factor ), function( f ) mean( subset( df, factor == f )$x ) )
ddply( df, .(factor), summarize, mean(x) )
  • Follows us our servcies
  • Facebook icon
  • Linkedin icon
  • twitter icon
  • rss icon
  • social icon