简体   繁体   English

在R中使用xlsx包

[英]Using the xlsx package in R

I am trying to export a data table from R into excel. 我正在尝试将数据表从R导出到excel。 I installed the xlsx package and it gave me the following output: 我安装了xlsx软件包,它给了我以下输出:

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: 然后,当我去加载library("xlsx") ,它说:

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. 刚刚尝试在我的R控制台上运行它。
It's because in R, logical FALSE should be capitalized or just called as F . 这是因为在R中,逻辑FALSE应该大写或简称为F
With write.xlsx(x, file = "myfile.xlsx", sheetName = "Sheet1", append = False) , it thinks False is a predefined variable. 使用write.xlsx(x, file = "myfile.xlsx", sheetName = "Sheet1", append = False) ,它认为False是预定义变量。
Try write.xlsx(x, file = "myfile.xlsx", sheetName = "Sheet1", append = FALSE) . 尝试write.xlsx(x, file = "myfile.xlsx", sheetName = "Sheet1", append = FALSE) It works for me. 这个对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM