gs_simplify_cellfeed: Simplify data from the "cell feed"

Description Usage Arguments Value See Also Examples

Description

In some cases, you do not want to convert the data retrieved from the cell feed into a data frame via gs_reshape_cellfeed. Instead, you want the data as an atomic vector. That's what this function does. Note that, unlike gs_reshape_cellfeed, embedded empty cells will NOT necessarily appear in this result. By default, the API does not transmit data for these cells; googlesheets inserts these cells in gs_reshape_cellfeed because it is necessary to give the data rectangular shape. In contrast, empty cells will only appear in the output of gs_simplify_cellfeed if they were already present in the data from the cell feed, i.e. if the original call to gs_read_cellfeed had argument return_empty set to TRUE.

Usage

1
2
3
gs_simplify_cellfeed(x, convert = TRUE, literal = TRUE, locale = NULL,
  trim_ws = NULL, na = NULL, notation = c("A1", "R1C1", "none"),
  col_names = NULL)

Arguments

x

a data frame returned by gs_read_cellfeed

convert

logical. Indicates whether to attempt to convert the result vector from character to something more appropriate, such as logical, integer, or numeric. If TRUE, result is passed through readr::type_convert; if FALSE, result will be character.

literal

logical, indicating whether to work only with literal values returned by the API or to consult alternate cell contents

locale, trim_ws, na

Optionally, specify locale, the fate of leading or trailing whitespace, or a character vector of strings that should become missing values. Passed straight through to readr::type_convert.

notation

character. The result vector can have names that reflect which cell the data came from; this argument selects between the "A1" and "R1C1" positioning notations. Specify "none" to suppress names.

col_names

if TRUE, the first row of the input will be interpreted as a column name and NOT included in the result; useful when reading a single column or variable.

Value

a vector

See Also

Other data consumption functions: gs_read_cellfeed, gs_read_csv, gs_read_listfeed, gs_read, gs_reshape_cellfeed

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
gap_ss <- gs_gap() # register the Gapminder example sheet
(gap_cf <- gs_read_cellfeed(gap_ss, range = cell_rows(1)))
gs_simplify_cellfeed(gap_cf)
gs_simplify_cellfeed(gap_cf, notation = "R1C1")

(gap_cf <- gs_read_cellfeed(gap_ss, range = "A1:A10"))
gs_simplify_cellfeed(gap_cf)
gs_simplify_cellfeed(gap_cf, col_names = FALSE)

ff_ss <- gs_ff() # register example sheet with formulas and formatted nums
ff_cf <- gs_read_cellfeed(ff_ss, range = cell_cols(3))
gs_simplify_cellfeed(ff_cf)                  # rounded to 2 digits
gs_simplify_cellfeed(ff_cf, literal = FALSE) # hello, more digits!

## End(Not run)

googlesheets documentation built on May 2, 2019, 1:57 p.m.