Page 1 of 1

sending simulated data to the spreadsheet

Posted: Thu Oct 12, 2023 5:19 pm
by rjwatt42
Hello

I am working on a module that will create simulated data and then send that to the spreadsheet. It's mainly working, but one feature is escaping me. When I check the Output option, the new variables overwrite whatever has been produced so far. What I am hoping for is to have the new data appended as new variables in addition to any produced already.

In case it helps, here is the code I currently have (which may itself not be right):

Code: Select all

                   self$results$sendValues$set(keys=1:3,titles=c(IV$name,IV2$name,DV$name),
                                               descriptions=c("IV","IV2","DV"),measureTypes=c(m1,m2,m3)
                   )
                   # m1, m2, m3 are either "nominal" or "continuous"
                   self$results$sendValues$setValues(index=1,iv)
                   self$results$sendValues$setValues(index=2,iv2)
                   self$results$sendValues$setValues(index=3,dv)
                   # iv,iv2,dv are vectors of either numerical values or character strings
and in .a.yaml

Code: Select all

    - name: sendValues
      title: send to Jamovi
      type: Output
and in .r.yaml

Code: Select all

    - name: sendValues
      type: Output
      measureType: nominal
      varTitle: Braw

Re: sending simulated data to the spreadsheet

Posted: Fri Oct 13, 2023 12:47 am
by jonathon
hi,

hmm, that's not an easy one ... its not really a use-case we considered.

so one way that *could* work for you (big emphasis on *could*) would be to store the random seeds which generates each column. then rather than appending the new data, you'd recreate the initial data using the random seed, and then add the new data onto that.

in effect, you'd be creating the whole data each time, but you'd create the illusion of retaining existing data, and then adding to it.

not an amazing solution i'm afraid.

jonathon

Re: sending simulated data to the spreadsheet

Posted: Fri Oct 13, 2023 9:13 am
by rjwatt42
Thank you again for such a quick response. That's good to know - so I can stop trying things.
Although what you suggest sounds a bit precarious, I could save the simulated data rather than the seed.

Also I already have the code to copy the simulated data to the clipboard, from which it can be pasted into the spreadsheet easily enough.

Roger
ps - in case you are interested: my dept switched from SPSS to Jamovi for teaching 3 years ago. A big improvement. What I have found is that students like the facility to (i) generate data (ii) see the correct analysis for that data reported automatically and then (iii) go off and get the same numbers by doing the analysis themselves. That step of knowing what the right answers should be is really good for building confidence.

Re: sending simulated data to the spreadsheet

Posted: Sat Oct 14, 2023 12:43 am
by jonathon
> Also I already have the code to copy the simulated data to the clipboard, from which it can be pasted into the spreadsheet easily enough.

ok ... not sure about your implementation, but give some thought as to whether it will work in the cloud version. over the next 10 years, i expect a larger and larger proportion of users needing to use the cloud.

> What I have found is that students like the facility to (i) generate data

yes! i'll be keen to see your module! i really love the idea of starting with the "generating model", and going full circle with it. i think it helps student's appreciate the assumptions, etc. of statistical tests.

jonathon

Re: sending simulated data to the spreadsheet

Posted: Wed Oct 18, 2023 9:19 am
by rjwatt42
Yes - accessing the clipboard does sound like it will be more problematical as browsers evolve.
I may already be at that point - the university I work for is increasingly unwilling to allow installations of software.

I'll send you an email with a link to the GitHub once I'm a bit more confident that it all works.

I should also say, if I didn't already, that doing this for Jamovi has been rather a delight. The concept began with Matlab, 10 years ago, evolved to R+Shiny about 4 years ago. I was really impressed at how easy it was to lift the R/Shiny code into Jamovi.