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

`#NV` (Excel function error) translate to string `error` instead of `NA` #62

Closed
petermeissner opened this Issue Apr 11, 2015 · 3 comments

Comments

3 participants
@petermeissner

petermeissner commented Apr 11, 2015

I read in values from a table where some cells with functions have an error and show #NV. While reading this data works, those function errors are translated to error within R. This is surprising and might lead to further errors along the way. I think, NA (the value for not defined/not available data) should be used instead.

@hadley

This comment has been minimized.

Member

hadley commented Apr 13, 2015

Could you please supply a reproducible example? (i.e. upload it somewhere and link to it from here)

@petermeissner

This comment has been minimized.

petermeissner commented Apr 13, 2015

It seems that there has to be a #NV error in an old XLS-file for this to happen ...

require(readxl)

download.file("http://pmeissner.com/download/test3.xls","test3.xls", mode="wb")
download.file("http://pmeissner.com/download/test3.xlsx","test3.xlsx", mode="wb")

read_excel("test3.xls")
##  lookup   key
##1  error  Test
##2 ASD345 Test2


read_excel("test3.xlsx")
##  lookup   key
##1   <NA>  Test
##2 ASD345 Test2
R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.1252    

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

other attached packages:
[1] readxl_0.1.0

loaded via a namespace (and not attached):
[1] bitops_1.0-6   devtools_1.7.0 httr_0.6.1     Rcpp_0.11.5    RCurl_1.95-4.5 stringr_0.6.2  tools_3.1.3   
@jennybc

This comment has been minimized.

Member

jennybc commented Jan 21, 2017

@petermeissner Would you make these files available again? Either in the location indicated above or some other way?

How to provide a readxl reprex

We're in a much better position to address your issue if you can provide a reprex (reproducible example). Provide as much of this as you can:

  • An actual xls or xlsx file. Preferably stripped down to the minimal size and complexity to demonstrate your point. And, obviously, stripped of any sensitive data.
  • A small bit of R code that uses readxl on the provided xls or xlsx file and demonstrates your point.
    • Consider using the reprex package to prepare this. In addition to nice formatting, this ensures your reprex is self-contained. Currently GitHub-only, but going to CRAN soon.
  • Any details about your environment that seem clearly relevant, such as operating system.
    reprex(..., si = TRUE)
    will append a standard summary, folded neatly away, at the bottom of your reprex.

How to provide the xls/xlsx file? In order of preference:

  1. Attach the file directly to your issue. Instructions are always at the bottom of the issue or comment box.
  2. Share via DropBox or Google Drive and provide the link in your issue.
  3. Explain you absolutely cannot provide a relevant file via github.com and offer to provide privately.
  4. Don't share a file and realize you're hoping for, e.g., a bug fix with no concrete example to go on.

jennybc added a commit that referenced this issue Feb 26, 2017

Handle xls record type BoolErr (number 517); fixes #259, relates to #… (
#274)

* Handle xls record type BoolErr (number 517); fixes #259, relates to #270, relates to #62

This record type is also used for errors, but only errors that are not a result of a formula, which is most of them. So if OP on #62 provides an example, we could conceivably do more in the else branch here.

* Fix NEWS

@jennybc jennybc added this to TODO in jennybc Feb 26, 2017

@jennybc jennybc closed this in #277 Mar 5, 2017

@jennybc jennybc moved this from TODO to Done in jennybc Mar 10, 2017

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