Skip to content

Commit

Permalink
fix importing empty cells as NA
Browse files Browse the repository at this point in the history
  • Loading branch information
JanMarvin committed Dec 23, 2020
1 parent 7cb0ac8 commit c47948f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/loadWorkbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ loadWorkbook <- function(file, xlsxFile = NULL, isUnzipped = FALSE) {
vals <- getNodes(xml = sharedStrings, tagIn = "<si>")

if ("<si><t/></si>" %in% vals) {
vals[vals == "<si><t/></si>"] <- "<si><t>NA</t></si>"

This comment has been minimized.

Copy link
@JanMarvin

JanMarvin Dec 23, 2020

Author Owner

the issue from the issue. the other line is just for identical output

vals[vals == "<si><t/></si>"] <- "<si><t></t></si>"
Encoding(vals) <- "UTF-8"
attr(vals, "uniqueCount") <- uniqueCount - 1L
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/read_workbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ List getCellInfo(std::string xmlFile,
v[i] = sharedStrings[ss_ind];

if(v[i] == "openxlsx_na_vlu"){
v[i] = NA_STRING;
v[i] = "";
}

string_refs[i] = r[i];
Expand Down

1 comment on commit c47948f

@JanMarvin
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible fix for ycphs#72

Please sign in to comment.