Page 1 of 1

Saving text (string) data to the spreadsheet

Posted: Sun Oct 08, 2023 1:16 pm
by rjwatt42
Hello

Is it possible to save text as string values to the spreadsheet. I have a variable that is Categorical, with levels "C1", "C2" etc. If I use setValues, it is saved as numerical. Here is a simple version of what I am doing:

private = list(
.run = function() {

n<-42
IV<-rnorm(n)
IV2<-as.factor(paste0("C",ceiling(runif(n)*3)))
DV<-rnorm(n)

dataOut<-data.frame(IV=IV,IV2=IV2,DV=DV)
if (self$options$IVvalues) {
self$results$IVvalues$setValues(dataOut)

self$results$textOutput$setContent("Done!")
}
})

Many thanks,
Roger Watt

Re: Saving text (string) data to the spreadsheet

Posted: Sun Oct 08, 2023 9:29 pm
by jonathon
hi roger,

it infers the type to put into the spreadsheet, from the type in R. so if you convert dataOut to a character vector, you should get a column of type text.

cheers