difficulty with Rj Editor (+) ... goal is to export .omv file

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)
Post Reply
jenny7c
Posts: 2
Joined: Thu May 04, 2023 12:10 am

difficulty with Rj Editor (+) ... goal is to export .omv file

Post by jenny7c »

My students are working with relatively large datasets that overwhelm jamovi (or Excel) on their computers, but are easily handled in R. Each student is just using a subset of variables, so I'm trying to use R to create personalized datasets for them that are much smaller and don't crash their computers - this is an intro level course.

I have both .Rdata and .sav files (but we don't get SPSS anymore) available, but the benefit of using the .sav files in jamovi is that they already have the variable names and at least some value labels entered.

Goal:
So I'm trying to use the .sav file loaded into jamovi and then jamoviReadWrite (which appears to require jamoviconnect) to output an .omv file with a subset of the data


System Details

I started with a fresh install of R 4.3.0 and a fresh install of jamovi since both were out of date. I was able to I could get some basic R commands using the jamovi version of R, but it just hung for the system R in both Rj Editor and Rj Editor+. From reading
https://github.com/jamovi/jamovi/issues/1243, it seemed like one of the issues was R 4.3.0, so I uninstalled that and went back to R 4.1.3. At this point, trying to even run summary (data[1:3]) crashed system R in both Rj Editor and Rj Editor+. I tried uninstalling and re-installing jamovi, but that same behavior continued. It also looked like I needed to install the packages in system R, so the jamovi R can't see them. I had trouble following some of the previous threads about libraries. But when some of those threads in github found an issue was related to libraries, it seemed related to the new version of R, so that was why I went back to 4.1.3 for the system R.

At this point tonight, I'm going to go back to doing it in RStudio with the .csv or .RData files since none of the different version combinations worked, but I want to be able to write jamovi files from within one of the R editors in the future.

Any suggestions? Are there ways to output a modified .omv file within one of the R editors using the jamovi R version? Or another file format that retains variable names, value labels, and values identified as missing?

Thanks for any help you can offer!
User avatar
MAgojam
Posts: 421
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

Re: difficulty with Rj Editor (+) ... goal is to export .omv file

Post by MAgojam »

Hey @jenny7c,
maybe there is a helpful hint in the attached screenshot to stick in the Rj+ editor with jamovi R, but R system libraries (R < 4.2.0).
Take a look.
Rj_jmvReadWrite.png
Rj_jmvReadWrite.png (313.27 KiB) Viewed 1941 times
Cheers,
Maurizio
jenny7c
Posts: 2
Joined: Thu May 04, 2023 12:10 am

Re: difficulty with Rj Editor (+) ... goal is to export .omv file

Post by jenny7c »

Maurizio,
I'm sorry, but I'm not sure what you're pointing me to with your picture - is it the locations of the libraries? Does it work to install packages into those folders within jamovi and be able to use system R?

Thanks for your response!
User avatar
MAgojam
Posts: 421
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

Re: difficulty with Rj Editor (+) ... goal is to export .omv file

Post by MAgojam »

Hey @jenny7c,
I apologize if I went too narrow on the colors.

I try to fix:
Reading your post led me to think that, after various tests, you are still with a Win SO and a version of "sytem R < 4.2.0", but you would like to be able to operate from jamovi R to select a subset of variables present and save as a file omv in a directory of your HD.
Important was that the variables did not lose their description (if any) in the possible steps.

Using Sebastian Jentschke's R package jmvReadWrite (v0.3.4) is a good suggestion.
At the moment it is not a library available with the snapshot of "jamovi R 4.1.2" following the installation of jamovi, but it can be recalled (if present), because installed with a "system R < 4.2.0", perhaps from RStudio ).

Then stay in jamovi R and use the R+ editor (simplifies the selection of the variables of interest) to create your subset of variables, with respect to those present in the sheet).
With data, in the simple R editor we refer to the whole dataframe (sheet variables), while in the R+ editor we refer only to the selected variables included in the Variables list.
For this I selected with an orange squircle the three selected variables (among the five available in the iris database) and indicated with a downward arrow (same color) the reference to date in the function).

As you can see the first 14 lines of code are to add the path to the jamovi R external libraries and display the paths, R version and OS in the output window.

On line 17 the jmvReadWrite library is loaded into the environment and on the next two lines the two functions of writing and reading a file in the omv format are used.

The iris.omv file present in the Data Library (or on disk) is opened in jamovi (5 variables) and only the 3 selected variables are saved as modiris.omv file in the "C:/temp" folder using the write_omv() function.
The read_omv() function reads the newly created modiris.omv file from disk and displays its contents in the output window.

On the right side of the screenshot the modiris.omv file is open in with another session of jamovi, to draw attention to the same data (the outlines are red), but above all the check to draw attention to the descriptions maintained for the variables.

Cheers,
Maurizio
Post Reply