rcall icon indicating copy to clipboard operation
rcall copied to clipboard

check matrix carefully before returning it back to Stata

Open haghish opened this issue 7 months ago • 2 comments

There seem to be a sloppy practice when returning matrices into R. R must ensure that matrices are numeric and do not break the process of matrix generation in Stata. Here is a code that generates an error, when rcall tries to return the object "output"

sysuse auto, clear // here's our dataset
rcall vanilla:                        ///
library("tableone") ;         ///
data<- st.data() ;             ///
rows <- c("price", "mpg", "rep78", "headroom", "trunk", "weight", "length") ; ///
columns <-c("foreign") ;     ///
categorical <- c("rep78") ;     ///
medianiqr <- c("weight") ;    ///
table1 <-CreateTableOne(data=data, vars=rows, strata=columns, factorVars=categorical, addOverall = TRUE) ; ///
output<-print(table1, nonnormal = medianiqr, missing=TRUE, quote=FALSE, noSpaces=TRUE, formatOptions = list(scientific = FALSE)) ;

Solution

most probably the error is a sloppy practice in stata.output.r file, which should be revised.

haghish avatar Nov 13 '23 07:11 haghish