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

Autocompletion doesn't work for columns in data frame imported from SPSS #14672

Open
3 of 4 tasks
JamesGillerITS opened this issue May 8, 2024 · 14 comments
Open
3 of 4 tasks
Labels
autocompletion Issues relating to autocomplete and autocompletion bug

Comments

@JamesGillerITS
Copy link

System details

RStudio Edition : Desktop
RStudio Version :  2024.04.0 Build 735
OS Version      :  Windows 10 Pro (Version 22H2)
R Version       : 4.0

Steps to reproduce the problem

Read data using read_sav from the Haven package (version 2.5.4).
Try to use autocompletion to access columns in the data set.

Describe the problem in detail

Typing the first few characters of the data set variable name triggers autocompletion normally.

dataset_autocomplete

When trying to use $ to access a column, autocompletion results in (No matches).

dataset_no_matches

Autocompletion works with built in dataset mtcars, and another SAV file found on Github: https://github.com/UtrechtUniversity/R-data-cafe/blob/master/exercises/practiceFileReading/data/mtcars.sav

The problem only became apparent after installing the latest version of RStudio.

Describe the behavior you expected

I expected to see a tooltip with a list of column names for my data set, and to be able to autocomplete code to access columns using $.

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
@JamesGillerITS JamesGillerITS added bug new New incoming issues, ready for initial review. labels May 8, 2024
@ronblum
Copy link
Contributor

ronblum commented May 8, 2024

@JamesGillerITS Thank you for raising this! I'm unable to reproduce the issue, though. I've tried importing a few SPSS datasets and autocomplete works. Can you provide a sample input file that we can use to reproduce the issue?

@ronblum ronblum added info needed Additional information requested—reprex, steps, open question, etc. autocompletion Issues relating to autocomplete and autocompletion and removed new New incoming issues, ready for initial review. labels May 8, 2024
@laivincent528
Copy link

Thank you for posting this! I was having the exact same issue and thought that I was just going mad. I'm not able to provide a sample file at this time, but in case it's helpful I am able to create a dataframe containing variables from the original dataset and autocompletion does work on it. The dataset that was giving me issues is also pretty large, with over 7000 columns. When downgrading RStudio versions, the autocompletion works as expected. I hope this helps at all!

@ronblum
Copy link
Contributor

ronblum commented May 9, 2024

@laivincent528 How did you create the dataframe--was it also by importing using read_sav()?

@ronblum
Copy link
Contributor

ronblum commented May 9, 2024

Also, I tried both a 10K x 10K dataframe created in R and the same importing with read_sav() but both give me the column names.

@JamesGillerITS
Copy link
Author

@JamesGillerITS Thank you for raising this! I'm unable to reproduce the issue, though. I've tried importing a few SPSS datasets and autocomplete works. Can you provide a sample input file that we can use to reproduce the issue?

Hi @ronblum, unfortunately I can't provide the data file in question, as it contains confidential information. As with @laivincent528, I can select a subset of the columns in the data into another variable, which can then be used with autompletion normally. It may be an issue with some particular variable(s) in the data.

@kevinushey
Copy link
Contributor

Thanks, but unfortunately unless you can provide us with an example that can help us reproduce the issue locally, we will be unable to fix this issue.

@JamesGillerITS
Copy link
Author

I will try to create a file. I have an idea that might work. Please give me some time.

@kevinushey
Copy link
Contributor

Much appreciated! Please keep us informed.

@PanosChatzi
Copy link

PanosChatzi commented May 13, 2024

Hi all. I have noticed the exact same issue and I was worried that there was something wrong with my laptop or installation.

Like in James case, accessing the data with dollar sign ($) doesn't provide any matches using the current desktop version of RStudio ("2024.04.0+735"), however, it seems to work in a previous version in Posit cloud ("2023.12.1+402.pro1"). Also, this issue seems to occur when exporting data to '.sav' format using the current version of SPSS (v29). When I tried some older '.sav' files it worked okay.

Please, find attached a '.sav' file downloaded from the internet which works (manipulate.sav), and a sample dataset exported from SPSS v29 (test_data.sav) which doesn't work.

spss_data.zip

Let me know if that helps.

@kevinushey kevinushey removed the info needed Additional information requested—reprex, steps, open question, etc. label May 13, 2024
@kevinushey kevinushey added this to the Cranberry Hibiscus milestone May 13, 2024
@kevinushey
Copy link
Contributor

Thanks! I was able to reproduce the issue locally; this is a regression from recent work to support variable labels in the completion popup display. We'll take a look.

@PanosChatzi
Copy link

Glad it helped! Thanks!

@ronblum ronblum changed the title Autocompletion doesn't work for columns in data frame Autocompletion doesn't work for columns in data frame imported from SPSS May 14, 2024
@kateto
Copy link

kateto commented May 20, 2024

Same problem here. I think it may be related to labels (haven_labelled class) --- when I use zap_labels() on the tibble containing the SPSS-imported data, autocomplete starts working again.

@melindahiggins2000
Copy link

I agree. I just upgraded my RStudio yesterday to "2021.04.1 Build 748" running on R version 4.4.0 (2024-04-24 ucrt); Platform: x86_64-w64-mingw32/x64; Running under: Windows 11 x64 (build 22000). When I read in a SPSS dataset using df <- haven::read_sav("dataset.sav"), the auto-complete no longer works for the resulting data frame which is of class: "tbl_df" "tbl" "data.frame". I look forward to downloading the bug-fix when ready. Thank you.

@melindahiggins2000
Copy link

I agree. I just upgraded my RStudio yesterday to "2021.04.1 Build 748" running on R version 4.4.0 (2024-04-24 ucrt); Platform: x86_64-w64-mingw32/x64; Running under: Windows 11 x64 (build 22000). When I read in a SPSS dataset using df <- haven::read_sav("dataset.sav"), the auto-complete no longer works for the resulting data frame which is of class: "tbl_df" "tbl" "data.frame". I look forward to downloading the bug-fix when ready. Thank you.

This morning, I rolled back to the previous RStudio version RStudio-2024.04.0-735.exe and still have the same issue. However, I then rolled back one more version to RStudio-2023.12.1-402.exe and autocompletion now works for a SPSS dataset read in using haven_2.5.4 where the dataset includes labeled variables of class "haven_labelled" "vctrs_vctr" "double".

sessionInfo()

R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22000)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] haven_2.5.4 dplyr_1.1.4

loaded via a namespace (and not attached):
 [1] gtable_0.3.4       compiler_4.4.0     tidyselect_1.2.1  
 [4] Rcpp_1.0.12        ggstats_0.5.1      tidyr_1.3.1       
 [7] scales_1.3.0       yaml_2.3.8         fastmap_1.1.1     
[10] GGally_2.2.1       ggplot2_3.4.4      R6_2.5.1          
[13] plyr_1.8.9         generics_0.1.3     knitr_1.45        
[16] forcats_1.0.0      tibble_3.2.1       munsell_0.5.0     
[19] pillar_1.9.0       RColorBrewer_1.1-3 rlang_1.1.3       
[22] utf8_1.2.4         xfun_0.42          cli_3.6.2         
[25] magrittr_2.0.3     digest_0.6.35      grid_4.4.0        
[28] rstudioapi_0.15.0  hms_1.1.3          lifecycle_1.0.4   
[31] vctrs_0.6.5        evaluate_0.23      glue_1.7.0        
[34] fansi_1.0.6        colorspace_2.1-0   rmarkdown_2.26    
[37] purrr_1.0.2        tools_4.4.0        pkgconfig_2.0.3   
[40] htmltools_0.5.7   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autocompletion Issues relating to autocomplete and autocompletion bug
Projects
None yet
Development

No branches or pull requests

7 participants