楼主: weidongyi156
1793 7

[问答] R能不能将数据导入到excel特定工作簿、特定工作表、特定单元格里? [推广有奖]

  • 0关注
  • 0粉丝

博士生

26%

还不是VIP/贵宾

-

威望
0
论坛币
859 个
通用积分
5.3301
学术水平
5 点
热心指数
0 点
信用等级
0 点
经验
1961 点
帖子
124
精华
0
在线时间
222 小时
注册时间
2008-7-29
最后登录
2024-3-26

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
如题,R能不能将数据导入到excel特定工作簿、特定工作表、特定单元格里?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:EXCEL exce 数据导入 xcel 单元格

沙发
nieqiang110 学生认证  发表于 2019-9-5 20:42:14 |只看作者 |坛友微信交流群
openxlsx,试试

使用道具

藤椅
weidongyi156 发表于 2019-9-6 08:54:40 |只看作者 |坛友微信交流群
nieqiang110 发表于 2019-9-5 20:42
openxlsx,试试
貌似不成功,可否具体点解释

使用道具

板凳
nieqiang110 学生认证  发表于 2019-9-7 07:08:56 |只看作者 |坛友微信交流群
看看openxilsx包write.xlsx 函数里面的参数,应该可以解决

使用道具

报纸
nieqiang110 学生认证  发表于 2019-9-7 07:10:30 |只看作者 |坛友微信交流群
Optional parameters are:
createWorkbook Parameters
• creator A string specifying the workbook author
addWorksheet Parameters
• sheetName Name of the worksheet
• gridLines A logical. If FALSE, the worksheet grid lines will be hidden.
• tabColour Colour of the worksheet tab. A valid colour (belonging to colours()) or a valid hex
colour beginning with "#".
• zoom A numeric between 10 and 400. Worksheet zoom level as a percentage.
writeData/writeDataTable Parameters
• startCol A vector specifying the starting column(s) to write df
• startRow A vector specifying the starting row(s) to write df
• xy An alternative to specifying startCol and startRow individually. A vector of the form
c(startCol, startRow)
• colNames or col.names If TRUE, column names of x are written.
• rowNames or row.names If TRUE, row names of x are written.
• headerStyle Custom style to apply to column names.
• borders Either "surrounding", "columns" or "rows" or NULL. If "surrounding", a border is
drawn around the data. If "rows", a surrounding border is drawn a border around each row.
If "columns", a surrounding border is drawn with a border between each column. If "all" all
cell borders are drawn.
• borderColour Colour of cell border
• borderStyle Border line style.
• keepNA If TRUE, NA values are converted to #N/A in Excel else NA cells will be empty.
Defaults to FALSE.

使用道具

地板
nieqiang110 学生认证  发表于 2019-9-7 07:13:27 |只看作者 |坛友微信交流群
writeData Write an object to a worksheet
Description
Write an object to worksheet with optional styling.
Usage
writeData(wb, sheet, x, startCol = 1, startRow = 1, xy = NULL,
colNames = TRUE, rowNames = FALSE, headerStyle = NULL,
borders = c("none", "surrounding", "rows", "columns", "all"),
borderColour = getOption("openxlsx.borderColour", "black"),
borderStyle = getOption("openxlsx.borderStyle", "thin"),
withFilter = FALSE, keepNA = FALSE, name = NULL, sep = ", ")
Arguments
wb A Workbook object containing a worksheet.
sheet The worksheet to write to. Can be the worksheet index or name.
x Object to be written. For classes supported look at the examples.
startCol A vector specifying the starting column to write to.
startRow A vector specifying the starting row to write to.
xy An alternative to specifying startCol and startRow individually. A vector of
the form c(startCol, startRow).
colNames If TRUE, column names of x are written.
rowNames If TRUE, data.frame row names of x are written.
headerStyle Custom style to apply to column names.
borders Either "none" (default), "surrounding", "columns", "rows" or respective abbreviations.
If "surrounding", a border is drawn around the data. If "rows",
a surrounding border is drawn with a border around each row. If "columns", a
surrounding border is drawn with a border between each column. If "all" all
cell borders are drawn.
borderColour Colour of cell border. A valid colour (belonging to colours() or a hex colour
code, eg see here).
borderStyle Border line style
• none no border
• thin thin border
• medium medium border
• dashed dashed border
• dotted dotted border
• thick thick border
已有 1 人评分论坛币 收起 理由
jiangbeilu + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

7
nieqiang110 学生认证  发表于 2019-9-7 07:14:37 |只看作者 |坛友微信交流群
weidongyi156 发表于 2019-9-6 08:54
貌似不成功,可否具体点解释
看看write.xlsx和writeData两个函数以及参数

使用道具

8
weidongyi156 发表于 2019-9-11 16:39:08 |只看作者 |坛友微信交流群
nieqiang110 发表于 2019-9-7 07:14
看看write.xlsx和writeData两个函数以及参数
能否给个成功的例子?搞不定

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-28 11:11