bcw <- openxlsx::read.xlsx("../Data/bcw.xlsx", na.strings = ".")14 Read and Write Excel Data
Two popular packages to read Excel .xlsx files in R are:
14.1 Read .xslx
14.1.1 openxlsx::read.xlsx()
NA strings are defined with argument na.strings.
14.1.2 readxl::read_xlsx()
NA strings are defined with argument na.
bcw <- readxl::read_xlsx("../Data/bcw.xlsx", na = ".")14.2 Write .xlsx
14.2.1 openxlsx::write.xlsx()
openxlsx::write.xlsx(bcw, "../Data/bcw.xlsx")Note: The readxl package does not include a function to write .XLSX files.
14.3 Further study
Optional reading:
- PDSR: Read and Write Excel Data — Source chapter and continuing reference.