Learn R Programming

smartsheetr (version 0.1.0)

ss_rename_columns: Rename columns

Description

Rename a set of columns. One of the following must be true:

  • column_names is not NULL

  • column_locs is not NULL, or

  • new_names is the same length as the number of columns of the ss_id sheet

Usage

ss_rename_columns(ss_id, new_names, column_names = NULL, column_locs = NULL)

Value

A list of ss_resp objects

Arguments

ss_id

The sheetId, permalink, or name of the Smartsheet sheet to read

new_names

A character vector of new names for the chosen columns

column_names

A vector of names of columns within the sheet to be replaced

column_locs

A vector of locations of columns within the sheet to be replaced

Examples

Run this code
if (FALSE) {
df = data.frame("PK"=character(), "temp"=character())
ss_id = ss_sheetid(ss_write_sheet(paste0("smartsheetr-example-",random_sheet_name()), data=df))
ss_rename_columns(ss_id, new_names="FK", column_names="temp")
ss_read_sheet(ss_id)
# clean up
ss_delete_sheet(ss_id)
}

Run the code above in your browser using DataLab