Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature-Request]: export dataset from REDCap to JASP with labels #1581

Open
3 tasks done
iijpma opened this issue Jan 21, 2022 · 9 comments
Open
3 tasks done

[Feature-Request]: export dataset from REDCap to JASP with labels #1581

iijpma opened this issue Jan 21, 2022 · 9 comments

Comments

@iijpma
Copy link

iijpma commented Jan 21, 2022

JASP Version

0.15

Commit ID

No response

JASP Module

No response

What analysis are you seeing the problem on?

No response

What OS are you seeing the problem on?

Windows 10

Bug Description

We want to import our datasets from REDCap to JASP. We can export an *.csv file (raw data or labels), *.sps file, *.r file, .sas syntax file, *.do file (STATA) and CDISC ODM file.
When importing the *.csv (the only supported file in JASP), we would like to have the corresponding data-labels in JASP. However, this is not the case. Since we do not have other statistical programs (we only want to use JASP), we cannot use other export options from Redcap (spss, sas or stata-files). How can we export datasets from REDCap to JASP in a way that we have all information in one file (the numbers + corresponding labels) in JASP?

Expected Behaviour

Export with all information in one file (the numbers + corresponding labels).

Steps to Reproduce

(question)

Log (if any)

No response

Final Checklist

  • I have included a screenshot showcasing the issue, if any.
  • I have included a JASP file that causes the crash/bug, if any.
  • I have accurately described the bug, and steps to reproduce it.
@shun2wang
Copy link
Contributor

shun2wang commented Jan 23, 2022

Hi @iijpma , sorry this is probably not a JASP related bug. but as far as I know, the data with labels and unlabeled exported from REDcap differ only in the storage format of the values (numbers or characters), which .csv file is universal and can be imported normally in JASP.

For your question, you can also export to a supported data format (.sav,.dta.....) from REDcap, taking SPSS data as an example, you can do as follows:

  1. Download all three files (*.bat, *.csv, *.sps) to the same folder from the REDcap SPSS file export column
  2. Double-click to run the .bat file
  3. Double-click to run the .sps syntax file (if you have SPSS installed), select Run All
  4. now you may see a new .sav dataset generated.

If you can't use commercial software, perhaps the R syntax provided by REDcap can still be tried,If the above solution does not work, you may need to manually edit the variable name and value level labels after importing the csv file. please close this issue when the above solves your problem .

Cheers

@iijpma
Copy link
Author

iijpma commented Jan 25, 2022

Thank you for the response. We do not have access to other statistical programs (SPSS, SAS or STATA), so we can only use JASP. Therefore, we can only use .csv and not the other supported data formats to export the datasets to JASP.
What do you mean with 'perhaps the R syntax provided by REDcap can still be tried'? How does that work in JASP? Indeed, manual editing is an option, but we have very large datasets with many (>100) variables). So not really feasible and sensitive to errors.

@shun2wang
Copy link
Contributor

so we can only use JASP

Sorry I may have overlooked this, but it still may not be a jasp bug, maybe a feature request.

For the R syntax I'm talking about, you can also export 2 files (.r & .csv) from REDcap.then:

  • We can open the .r file using notepad file and see its code
  • Navigate to the R.exe you have installed (or you can use the R package in jasp, usually located in JASP\R\bin)
  • Paste the code into the command line of R.exe
  • Import the haven package by using library(haven)
  • Then use write_sav(data,"dataname.sav") to generate a sav file (or other types of files) in the same level folder of r.exe
  • Now you can use the file into JASP

Note that you may need some basic knowledge of R to use the above functions,and read the help documentation for these packages.This is not a JASP recommended practice, but may solve your problem temporarily

@boutinb
Copy link
Contributor

boutinb commented Jan 28, 2022

Hi @iijpma, JASP can load SPSS files with sav and par formats, STATA files with .dta format, and SAS files with as7bdat and sas7bcat formats. All these formats contain the labels. That would be quite a bad luck if REDCap cannot convert to at least of these formats...
As @icekylin said, you can still use R with the haven library, or even python with the pandas library to convert a R object into a sav file.

@JorisGoosen
Copy link
Contributor

As an aside and to go more towards the feature request @icekylin mentioned.

But the next version of jasp (2 months out probably) will be with much better data-editing support and one of the features I was planning to implement was making sure that nominal-text-columns (as I assume your REDcap label csv data ends up as) are actually convertible to ordinal/nominal and perhaps even scale (losing information there). See #1633

Would that actually solve your problem @iijpma ?

@shun2wang
Copy link
Contributor

shun2wang commented Feb 23, 2022

@JorisGoosen I think this feature request is perhaps a related data file generation (by values and labels). but I agree with your feature request about variable type conversion.Here is something about value and label records in sav (which I think you probably already know, since Readstat is mostly built on these standards).

I will give you two files that exported from REDcap( R object files and csv data ). It can generate a dataset with labels following the steps I said. In fact, in SPSS and STATA software, data can be stored separately from labels. For example, the .sps I provided only stores labels and commands to generate datasets.
dataset.zip

@juliuspfadt juliuspfadt added the Waiting for requester If waiting for a long time it is reasonable to close an issue label Sep 1, 2022
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

This issue or pull request will be automatically closed in 42 days due to inactivity. Feel free to leave a comment if you believe this is still relevant.

@github-actions github-actions bot added the Stale Issues and pull requests that have not had recent interaction label Nov 8, 2022
@JorisGoosen JorisGoosen removed Waiting for requester If waiting for a long time it is reasonable to close an issue Stale Issues and pull requests that have not had recent interaction labels Nov 8, 2022
@tomtomme
Copy link
Member

@boutinb
To this day there is still no direct export of SAV (or the other file formats) within RedCap. I looked it up in their documentation. RedCap always only exports the csv and the syntax and a bat.

@shun2wang & @JorisGoosen
The solution you propose - could that kind of SAV-generation be automated within JASP?
Like: "import from R- and CSV-file to get labels and other metadata", where you point JASP to those two files and then it does the magic for you?

related: #611

@JorisGoosen
Copy link
Contributor

The solution you propose - could that kind of SAV-generation be automated within JASP?
Like: "import from R- and CSV-file to get labels and other metadata", where you point JASP to those two files and then it does the magic for you?

We could add a "labels" import to the csv import. Where labels would be in json format.
{ column0: { "0": "label 0", "1": "label 1"} }

This could be a nice feature, if combined with some R code of ours that people could run to generate the json with for instance. But it will be a while before we would get to that.
It makes more sense to focus on importing all data from ReadStat correctly first.
And if we are adding a new importer then it should probably be from Excel

I think running R code during data import from random sources would be a pretty terrible idea btw.

@tomtomme tomtomme changed the title [bug]: export dataset from REDCap to JASP with labels [Feature-Request]: export dataset from REDCap to JASP with labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants