clearNamedRegion-methods(XLConnect)
clearNamedRegion-methods()所属R语言包:XLConnect
Clearing named regions in a workbook
在工作簿中的清除已命名的区域
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Clears named regions in a workbook.
清除在workbook命名的区域。
用法----------Usage----------
## S4 method for signature 'workbook,character'
clearNamedRegion(object, name)
参数----------Arguments----------
参数:object
The workbook to use
workbook使用
参数:name
The name of the named region to clear
命名的区域的名称,以清除
Details
详细信息----------Details----------
Clearing a named region/range means to remove any cells associated with that named region. Clearing named regions can be useful if (named) data sets in a worksheet need to be replaced, i.e. data is first read, modified in R and finally written back to the the same named region. Without clearing the named region first, (parts of) the original data may still be visible if it occupied a larger range in the worksheet.
清除指定区域/范围,以消除任何有关的单元,命名区域。结算所命名的区域可能是有用的,如果设置工作表中的数据(命名)需要更换,即数据是第一次读到,在R修改,最后写回相同的命名区域。不先清除命名区域的情况下,(部分)的原始数据仍然是可见的,如果在工作表中占据更大的范围内。
(作者)----------Author(s)----------
Nicola Lambiase<br>
Mirai Solutions GmbH <a href="http://www.mirai-solutions.com">http://www.mirai-solutions.com</a>
参见----------See Also----------
workbook, clearSheet, clearRange, clearRangeFromReference
workbook,clearSheet,clearRange,clearRangeFromReference
实例----------Examples----------
# mtcars xlsx file from demoFiles subfolder of [mtcars demoFiles子文件夹的xlsx文件]
# package XLConnect[包XLConnect]
demoExcelFile <- system.file("demoFiles/mtcars.xlsx",
package = "XLConnect")
# Load workbook[负载工作簿]
wb <- loadWorkbook(demoExcelFile)
# Read named region 'mtcars'[阅读命名区域“mtcars”]
data <- readNamedRegion(wb, name = "mtcars", header = TRUE)
# Only consider cars with a weight >= 5[只考虑车的重量> = 5]
data <- data[data$wt >= 5, ]
# Clear original named region[清除原区域]
clearNamedRegion(wb, name = "mtcars")
# Write subsetted data back[写子集数据]
# Note: this is covering a smaller area now -[注:这是现在一个较小的区域覆盖 - ]
# writeNamedRegion automatically redefines the named region[writeNamedRegion自动重新定义了命名区域]
# to the size/area of the data[到的数据的大小/区域]
writeNamedRegion(wb, data = data, name = "mtcars",
header = TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|