IDEMSInternational / R-Instat

A statistics software package powered by R
http://r-instat.org/
GNU General Public License v3.0
38 stars 103 forks source link

Preparing a Word report using data from an R-Instat data frame #9124

Open rdstern opened 1 month ago

rdstern commented 1 month ago

This is a task I had recently, from our Zambia work.

One small table was here:

image

This gives the missing months in each station.

For this report I was unable to copy and paste easily directly into Word. So I always went via Excel. Then from Excel to Word. a) I used Copy/Paste. This meant I did not get the column names. One participant suggested Saving into Excel, because that gives the names. Good idea! b) I failed to copy nicely directly into Word. I think that this is now easier than I made it, because I forgot the option in Word to Insert Table > Copy from Text. c) For the table above I needed to go via Excel, to format the dates as shown. (Note that format is still not ideal, as I would prefer just March 2024. I don't need the day numbers!

I then realised my strategy is wrong anyway - or will be once @Patowhiz gt tables stuff is merged!

Now this is important for my general strategy for R (and R-Instat) users. This strategy is to remain happy with Excel, but sometimes you need more. Then you add R (and/or R-Instat). But you shouldn't then need to return to Excel at the end of the work.

Many people seem to do this! Even MICS survey and the PICSA surveys. We now argue that for presentation we can do brilliantly with ggplot2 for graphs and gt for tables.

I note the above options partly for @rachelkg, because this is a common task and so we should discuss the options in the Help and documentation. I hope we will soon have our improved way, but with our principle of Options by context, some users will still want the Excel route, because that's what they are used to.

@Patowhiz has just finished the first stage of gt for tables. This is where the data come directly from a data frame - and that is just my task now. I think gt also has an option to prepare the table for Word? Is that correct and is it implemented yet @Patowhiz ? I think (for clarity we tentatively included that feature in the use table dialog?

Nice!

Patowhiz commented 1 month ago

@rdstern saving to word of gt objects is not yet implemented. Yes, it can be included in the use table dialog. Note it will just save it to an external file that is not yet displayable in R-Instat (the output viewer can't display word yet).

rdstern commented 1 month ago

@Patowhiz if it can't (yet) do Word, then can we do copy and paste from the gt output table, into a Word table. Otherwise what do you propose?,

Patowhiz commented 1 month ago

I think the save to word would be easier to accomplish. That can be done in the use table. Or we can add an option to the dialogs that I implemented but that dialog may change it's use depending on what you suggest.

rachelkg commented 1 month ago

@Patowhiz and @rdstern If we do "I think the save to word would be easier to accomplish. " then will it be possible to save different items to the same word document or will each one open a new word document? I assume people will often want to export multiple items to the same document.