I am trying to export a data table from R into excel. I installed the xlsx package and it gave me the following output:
Installing package into ‘C:/Users/Jack/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL
'https://mirrors.sorengard.com/cran/bin/windows/contrib/3.4/xlsx_0.5.7.zip'
Content type 'application/zip' length 401236 bytes (391 KB)
downloaded 391 KB
package ‘xlsx’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Jack\AppData\Local\Temp\Rtmp04FZrB\downloaded_packages
Then when I went to load with library("xlsx")
, It said:
Loading required package: rJava
Loading required package: xlsxjars
Then I tried to do the line:
write.xlsx(x,file="myfile.xlsx",sheetName="Sheet1",append=False)
but it never let me enter the command, it kept pushing me onto a new line.
Can somebody give me some guidance on what is wrong?
Just tried running this on my R console.
It's because in R, logical FALSE
should be capitalized or just called as F
.
With write.xlsx(x, file = "myfile.xlsx", sheetName = "Sheet1", append = False)
, it thinks False
is a predefined variable.
Try write.xlsx(x, file = "myfile.xlsx", sheetName = "Sheet1", append = FALSE)
. It works for me.