Page 1 of 1

unable to import data

Posted: Thu Dec 03, 2020 3:24 pm
by sabo
Hi there!

as part of a larger project, I used Rstudio to prepare data files and merged them. I then exported the new dataframe, using the following functions:

Code: Select all

#### export of finaler Datensatz to csv ####
write.table(dat, file="dat_HH1_Skalen.csv", sep= ";", dec = ",", col.names  = NA, fileEncoding = "UTF-8") 

####save RData-file ####
save(dat, file = "dat_HH1_Skalen.Rdata")

#### export of data.frame to sav ####
write_sav(dat, "dat_HH1_Skalen.sav")
Now, if I try to import the SPSS and Rdata file into Jamovi, I get the following error message:
unable to convert string to the requested encoding (invalid byte sequence)
I know it has something to do with encoding but I am not sure how to fix it. Does anyone have a similar problem and could fix it?

Thanks in advance!

Cheers,

sabo

Re: unable to import data

Posted: Thu Dec 03, 2020 5:33 pm
by sabo
Short update:

When I open the SPSS-file, I created with RStudio and save it again as "SPSS Statistics Local Coding (*.sav)", I can open it with Jamovi.

But I still wonder if there is a way to export the dataframe in RStudio without having to use SPSS in order to open it in Jamovi.

Thanks!

Re: unable to import data

Posted: Thu Dec 03, 2020 7:53 pm
by sbalci
Hi,
You may try saveRDS to save .RDS file then import it to jamovi.
There is also a package:
https://cran.r-project.org/web/packages/jmvReadWrite/index.html

Re: unable to import data

Posted: Thu Dec 03, 2020 9:46 pm
by jonathon
if you can provide all these different files (either attach here, or send it to contact <at> jamovi.org), then i'll take a look (actually, your best bet would be to create an issue on our github page, that way it won't get forgotten). it looks like there's a corrupt string somewhere in the file (a sequence of bytes considered illegal by UTF-8). that's the issue, but we should handle it better than we do.

cheers

jonathon

Re: unable to import data

Posted: Mon May 10, 2021 6:05 am
by ricslator
Simplest of all Solutions:

import pandas as pd
df = pd.read_csv('file_name.csv', engine='python')

http://net-informations.com/ds/pda/csv.htm