Skip to content

Instantly share code, notes, and snippets.

@abalter
Last active December 24, 2019 21:46
Show Gist options
  • Save abalter/a04e26b5c044f47109326372548ecb7e to your computer and use it in GitHub Desktop.
Save abalter/a04e26b5c044f47109326372548ecb7e to your computer and use it in GitHub Desktop.
Strange xlsx for stackoverflow question

https://stackoverflow.com/questions/59473614/r-object-does-not-exist-but-is-in-environment

I'm loading a number of sheets from an XLSX file with openxlsx. I've never had this problem before. All of my sheets load into my environment and are visible in the environment explorer (I load them as individual variables). I can View all of the variables. However, one of them does not exist in the environment.

There are some other funny things with this file as well. When I make changes to it, they don't appear when I read the XLSX file into R again. The only way I can see the changes is if I upload the file to a gist and then download it again. I've tried saving the file under different names as well as exporting it.

So, this is probably some issue with the XLSX file, and I could try posting for help on a Windows forum, but since the problems only show up in R, they would probably send me back here.

> svn_copy = read.xlsx(
+   snv_or_filename,
+   sheet="SNV Copy",
+   colNames=T,
+   check.names=T,
+   fillMergedCells = T
+ )
> View(svn_copy)
> exists('snv_copy')
[1] FALSE
> snv_copy
Error: object 'snv_copy' not found
> 

I created a very reduced version of the XLSX that still has the same problem.

https://gist.github.com/abalter/a04e26b5c044f47109326372548ecb7e

enter image description here

enter image description here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment