With the R package xlsx, is it possible to set na.strings when reading an Excel file? -
I'm reading an Excel file using read.xlsx
, and I set Want to do Na.strings as you can with read.table
. Is this possible? It just does not work to add na.strings to call like this:
data & lt; - read.xlsx ("my file.xlsx", sheetName = "MyData", No. string = "no information")
Is there any other way to do this?
No, it is not possible for simple reason that read.xlsx
Does not take care of special missing values. But this could be a potential increase for the getCellvalue
function.
You can either replace missing values like something:
data [data == "no information"] & Lt; - NA
Or, by changing your data to CSV and using read.csv
, or the other package that takes care of the unavailable values as a comment Use
Use the XLConnect package Edit:
Exposure parameters using the XLConnect
package setMissingValue
function Takes care of The equivalent code can be written here:
Library ("XLconnect") wb & lt; - loadWorkbook ("My file .xlsx") Setting value (wb, value = "no info") readWorksheet (Wb, Sheet = "Myadata")
Comments
Post a Comment