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

write_sav: wrong column names for tables with more than 10k columns #410

Closed
Majid-Eismann opened this issue Oct 9, 2018 · 3 comments
Closed

Comments

@Majid-Eismann
Copy link

Hallo,
when creating a sav file with more than 10.000 columns the column names are probably repeated.

In the code bellow I couldn´t show the repetition of names because read_sav corrects duplicate names. read.spss does not import the file. Opening the file in Statistica showed duplicated names.
The same occurs with varying the names to random strings of 32 letters.

library(foreign)
library(tibble)

# create data frame with more than 10k columns and export
randomDF <- data.frame(as.list(1:10001))

# write sample files
write_sav(randomDF[1:10000], "test1.sav")
write_sav(randomDF[1:10001], "test2.sav")

# error reading system-file header
if (F) foreign::read.spss("test2.sav")

# reimport corrects duplicate names (first & last position)
data_frame(
  column_position = 1:10001,
  a = c(names(read_sav("test1.sav")), rep("-", 1)),
  b = names(read_sav("test2.sav"))
) %>% 
filter(a != b)

Thanks!

@Majid-Eismann Majid-Eismann changed the title write_sav: wrong column names for tables with more then 10k columns write_sav: wrong column names for tables with more than 10k columns Oct 9, 2018
@evanmiller
Copy link
Collaborator

Related discussion here: WizardMac/ReadStat#122

This should be fixed in the latest version of ReadStat.

@hadley hadley closed this as completed in aeea2db Jan 23, 2019
@hadley
Copy link
Member

hadley commented Jan 23, 2019

Looks good to me now.

@Majid-Eismann in future, using the reprex package would be much appreciated as it makes it easier for me to see exactly what results you got.

@hadley hadley reopened this Jan 23, 2019
@hadley hadley closed this as completed Jan 23, 2019
@lock
Copy link

lock bot commented Jul 22, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants