atorus-research / pharmartf Goto Github PK
View Code? Open in Web Editor NEWEnhanced RTF wrapper written in R for use with existing R tables packages such as huxtable or GT
Home Page: https://atorus-research.github.io/pharmaRTF/
License: Other
Enhanced RTF wrapper written in R for use with existing R tables packages such as huxtable or GT
Home Page: https://atorus-research.github.io/pharmaRTF/
License: Other
Hello,
Thank you for the great package. I have been using it to generate my RTF documents. In the reference manual, it says the future plans include colors. Do you have a timeline for that? I would like to put in a request for text color. Thank you!
Copying issue text from here
@NNaikp could you share your output on timestamp and R language setting? Thanks!
Github doesn't support .rtf so I have attached the file here (tlf-primary.docx) as .docx. Here is also a screenshot from the .rtf file:
My default language in Word is UK english.
When I did the review I set Sys.setenv(LANG = "en")
as it was showing me error messages in danish. But after some googling I can see that the locale is still Danish, also if I set the language to English:
> Sys.setenv(LANG = "en")
> Sys.getlocale()
[1] "LC_COLLATE=Danish_Denmark.1252;LC_CTYPE=Danish_Denmark.1252;LC_MONETARY=Danish_Denmark.1252;LC_NUMERIC=C;LC_TIME=Danish_Denmark.1252"
After running Sys.setlocale(locale = "English")
I see
> Sys.setlocale(locale = "English")
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"
Which yields:
Maybe pharmaRTF::write_rtf
needs to check the locale before sinking the file? I can see from the documentation of Sys.setlocale()
that it is OS dependent. The one above is Windows (my local). This one is from a linux server:
> Sys.getlocale()
[1] "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C"
Hi guys,
I've been running reverse dependency checks on huxtable dependencies. pharmaRTF currently gets a couple of errors in running examples:
* checking examples ... ERROR
> library(huxtable)
...
> ht <- huxtable(
+ column1 = 1:5,
+ column2 = letters[1:5]
+ )
> rtf <- rtf_doc(ht, list(hf_line("aTitle")))
>
> header_rows(rtf)
Error in UseMethod("header_rows") :
no applicable method for 'header_rows' applied to an object of class "rtf_doc"
Calls: header_rows
Execution halted
I guess header_rows
is a pharmaRTF method that is now getting interfered with by the new huxtable generic and function, of the same name.
I also get some testing failures:
[ OK: 212 | SKIPPED: 0 | WARNINGS: 1 | FAILED: 5 ]
1. Error: insert_buffer adds a blank column correctly (@test_helpers.r#37)
2. Failure: hf_string orderes lines properly (@test_rtf-code-generators.r#24)
3. Failure: header_string lines populates correctly (@test_rtf-code-generators.r#123)
4. Failure: header_string lines populates correctly (@test_rtf-code-generators.r#124)
5. Failure: rtf_doc returns a list with a table, title, and footnotes (@test_rtf_doc.r#14)
You can test the latest version of huxtable with
remotes::install_github("hughjonesd/huxtable")
The master branch is now in bugfix-only mode.
Hi Eli,
This is a really great package!
However, my company standards dictate that
outputs must not include any text in the header or footer, as they are reserved for regulatory publishing.
Is is possible to do this with pharmaRTF now? Or could it be sometime in the future?
Thanks!
Hi,
The pharmaRTF package is so good to creat RTF file, but I have a query that what's the reason put the column names in header. According to RTF in clinical trials, we usually put the whole table including column names in the RTF body part, certainly I'm not familiar with RTF.
I'm looking for some solutions to creat RTF instead of SAS in R
Thanks!
Is it possible to use this package to generate a word report which has proper table formatting as shown in this package but also with proper table numbering and referencing?
@millera minor fix to improve riskmetric score:
Add to DESCRIPTION file URL: https://atorus-research.github.io/pharmaRTF/, https://github.com/atorus-research/pharmaRTF
Thanks to @DawnYe for this report in atorus-research/CDISC_pilot_replication#7.
With tibble 3.1.0 even my_tibble[FALSE, "notAColumn"] <- 1
will result in a new column being created. This is intended behavior for tibble now. This breaks fill_missing_data()
which is an unexported function in read_hf.R. This is the offending line:
.data[is.na(.data[var]), var] <- correct_defaults(var)
correct_defaults
returns NULL when var is 'type'. This would never happen in an actual hf_file but even if it returns null, tibble is trying to add a new column and failing because its not a vector, a bare list, a data frame or a matrix.
Thankfully this is an easy fix. Either add type as a option in the correct_defaults
as a blank matrix, or add an if statement like the following:
if(any(is.na(.data[[var]]))
.data[is.na(.data[[var]]), var] <- correct_defaults(var)
Hi,
Thanks for creating this. One thing that I have noticed is that the generated RTF files look different in LibreOffice Writer compared to how they look in Microsoft Word. In LibreOffice, there is an extra gap between the column heading and the table body that is not present in Word. While it looks as if things are being rendered differently, it this something that can be addressed?
Many thanks,
John
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.