kaizadp / TES_3Soils_2021

1 stars 1 forks source link

dcast summary table #9

Closed kaizadp closed 5 years ago

kaizadp commented 5 years ago

https://github.com/kaizadp/tes_3soils_2019/blob/0c9d1c4d44710c6c2dc7409d8bfedec2372c4300/2-wsoc.R#L225

@bpbond dcast is currently my go-to for creating summary tables with multiple factors. But I have to format the final table in Word. Better way to do so?

bpbond commented 5 years ago

I'd change this to an RMarkdown document, and create a nicely-formatted table there ready for direct copying into Word (or you can create a Word doc directly from R). Would an example be useful?

kaizadp commented 5 years ago

Yes, please. I have used knitr::kable("tablename") to bring my dcast table into Markdown, but I haven't figured out the formatting. Like changing the column names, merging cells, etc. Or is that something you do manually later?

kaizadp commented 5 years ago

I like that, thanks.

And here, I am trying to make a summary of soil characterization parameters. https://github.com/kaizadp/tes_3soils_2019/blob/13a06ed82d5e125c71e6b534a9dc6c1d7941ab06/1-characterization.R#L28

Very roundabout way, because they were different parameters. I did this a while ago. Now I'm thinking maybe gather all the parameters into a single column and then dcast. Unless you have a cleaner suggestion.

bpbond commented 5 years ago

In general that all-variables-in-a-column long form is the easiest way to compute, I think. 👍

kaizadp commented 5 years ago

sounds good, thanks