Exporting tables to xls or ppt

Hurrrray :clap:
I get it now.
I simply need to save a table I need as ned data frame and export it.
I did that:

ddply(NL.Current.data, .(year,hy), summarize,  A2TB=mean(A2TB), B1=mean(B1), C1=mean(C1), D1=mean(D1,na.rm=TRUE), E1=mean(E1), F1=mean(F1), G1=mean(G1))

having this in my console:

  year hy     A2TB       B1       C1       D1       E1       F1       G1
1 2017  2 80.02937 91.64464 92.86344 84.05172 92.29075 93.95742 58.46549
2 2018  1 79.39543 91.75817 92.38125 85.85480 91.81370 93.25725 56.78593
3 2018  2 78.93082 91.24738 92.45283 86.92946 91.56184 92.98742 56.06918

then I saved that as df.stats dataframe:

df.stats <- ddply(NL.Current.data, .(year,hy), summarize,  A2TB=mean(A2TB), B1=mean(B1), C1=mean(C1), D1=mean(D1,na.rm=TRUE), E1=mean(E1), F1=mean(F1), G1=mean(G1))

and used Adam83's code:

df.stats 
      write.xlsx(df.stats, "writeStats.xlsx", colNames = TRUE, rowNames=TRUE)

and I've got my Excel table!

Well done and thank you very much!!!

The only issue I have now is exporting CrossTables (generated in my reprex using gmodels library) as a different solution is required I suppose...

2 Likes

Since it seems that your original question has been answered, would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.