sm_write_excel {samadb}R Documentation

Export Wide Data to Excel

Description

This function exports a wide format dataset to a column- (default) or row-oriented Excel format.

Usage

sm_write_excel(
  data,
  ...,
  transpose = FALSE,
  transpose.date.format = "%d/%m/%Y"
)

Arguments

data

a wide dataset from sm_data or reshaped to a wide format with sm_pivot_wider.

...

further arguments to write_xlsx. As a minimum a path needs to be supplied that ends with the name of the Excel file. See Examples.

transpose

logical. If TRUE, the result is returned in a row-oriented Excel format. The default is column oriented (same as the dataset in R).

transpose.date.format

argument passed to sm_transpose, setting the format of date columns when data is transposed.

Value

Writes an Excel file to the specified path (no return value).

See Also

sm_transpose, write_xlsx, samadb

Examples

## Not run: 
# Getting electricity indicators from 2000
data <- sm_data("ELECTRICITY", from = 2000)

# Saving to different Excel formats
sm_write_excel(data, "ELECTRICITY.xlsx")
sm_write_excel(data, "ELECTRICITY.xlsx", transpose = TRUE)

# Saving to alternative path
sm_write_excel(data, "C:/Users/.../ELECTRICITY.xlsx")

## End(Not run)


[Package samadb version 0.3.0 Index]