xlcDump: Dumping data sets to Excel files

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/xlcDump.R

Description

Dumps data sets to Excel files by writing each object to a separate worksheet.

Usage

1
xlcDump(list, ..., file = "dump.xlsx", pos = -1, overwrite = FALSE)

Arguments

list

character vector of names of objects inside environment pos to dump into an Excel file. Objects will be written using writeWorksheet - as such any object will be coerced to a data.frame. If missing, the list of objects will be determined via the function ls which takes any arguments specified via ....

...

Arguments that will be passed to the ls function for getting a list of object names in case the list argument is missing.

file

Excel file to which objects will be dumped. Can be an existing or a new file. Defaults to "dump.xlsx".

pos

Environment in which to look for objects. Can be specified either as an integer specifying the position in the search list, as a character naming an element in the search list or as an environment. Defaults to -1 which refers to the current environment.

overwrite

logical specifying if data should be overwritten if objects with the same name have already been dumped to the Excel file.

Details

Each object is written to a separate worksheet named by the name of the object. Objects are written using the writeWorksheet method - as such any object will be coerced to data.frame.

Value

Named logical vector specifying if objects have been dumped or not. An object may not be dumped because there was an issue with the coercion to a data.frame or the object already existed (and overwrite = FALSE) in the workbook.

Author(s)

Martin Studer
Mirai Solutions GmbH http://www.mirai-solutions.com

See Also

xlcRestore, writeNamedRegion, writeWorksheet, writeNamedRegionToFile, writeWorksheetToFile, xlcEdit

Examples

1
2
3
4
require(datasets)
xlcDump(c("airquality", "CO2", "iris", "PlantGrowth", "swiss"),
        file = "myDump.xlsx", pos = "package:datasets")
xlcRestore(file = "myDump.xlsx", overwrite = TRUE)

Example output

Loading required package: XLConnectJars
OpenJDK 64-Bit Server VM warning: Can't detect initial thread stack location - find_vma failed
XLConnect 0.2-12 by Mirai Solutions GmbH [aut],
  Martin Studer [cre],
  The Apache Software Foundation [ctb, cph] (Apache POI, Apache Commons
    Codec),
  Stephen Colebourne [ctb, cph] (Joda-Time Java library),
  Graph Builder [ctb, cph] (Curvesapi Java library)
http://www.mirai-solutions.com ,
http://miraisolutions.wordpress.com
ZoneInfo: /usr/share/javazi/ZoneInfoMappings (Permission denied)
 airquality         CO2        iris PlantGrowth       swiss 
       TRUE        TRUE        TRUE        TRUE        TRUE 
 airquality         CO2        iris PlantGrowth       swiss 
       TRUE        TRUE        TRUE        TRUE        TRUE 
Warning message:
system call failed: Cannot allocate memory 

XLConnect documentation built on April 6, 2018, 1:03 a.m.