Saving text (string) data to the spreadsheet

Everything related to the development of modules in jamovi
Post Reply
rjwatt42
Posts: 10
Joined: Sun Oct 08, 2023 10:22 am

Saving text (string) data to the spreadsheet

Post 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
User avatar
jonathon
Posts: 2627
Joined: Fri Jan 27, 2017 10:04 am

Re: Saving text (string) data to the spreadsheet

Post 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
Post Reply