
Last chance! 50% off unlimited learning
Sale ends in
gs_read_listfeed(ss, ws = 1, reverse = NULL, orderby = NULL, sq = NULL, ..., verbose = TRUE)
googlesheet
objectprogress
col_types
readr::read_csv
or
readr::type_convert
. Follow those links
or read the vignette("column-types")
for details.
locale, trim_ws, na
readr::read_csv
or
readr::type_convert
.
comment, skip, n_max
col_names
TRUE
, FALSE
or a character
vector of column names. If TRUE
, the first row of the data rectangle
will be used for names. If FALSE
, column names will be X1, X2, etc.
If a character vector, it will be used as column names. If the sheet
contains column names and you just don't like them, specify skip = 1
so they don't show up in your data.
check.names
make.names
with unique = TRUE
, just like
read.table
does. By default, googlesheets
implements
the readr
data ingest philosophy, which leaves column names "as is",
with one exception: data frames returned by googlesheets
will have
a name for each variable, even if we have to create one.data.frame
or, if dplyr
is loaded, a
tbl_df
googlesheets
, we do
not let this happen and, instead, use the column names "as is", for
consistent output across all gs_read*
functions. If you direct
gs_read_listfeed
to pass query parameters to the actual API call,
you must refer to variables using the column names under this
API-enforced transformation. For example, to order the data by the column
with "Time 2 Eat!" in the header row, you must specify orderby =
"time2eat"
in the gs_read_listfeed
call.reverse=true
alone will NOT, in fact, reverse the row
order of the result. In our experience, the reverse
query parameter
will only have effect in combination with explicit specification of a
column to sort on via orderby
. The syntax for these queries
is
apparently undocumented, so keep it simple or bring your spirit of
adventure!gs_read_csv
. The
list feed also has some ability to sort and filter rows via the API (more
below). Consult the Google Sheets API documentation for more details about
the
list feed.
gs_read_cellfeed
,
gs_read_csv
, gs_read
,
gs_reshape_cellfeed
,
gs_simplify_cellfeed
## Not run:
# gap_ss <- gs_gap() # register the Gapminder example sheet
# oceania_lf <- gs_read_listfeed(gap_ss, ws = "Oceania")
# head(oceania_lf, 3)
#
# ## do row ordering and filtering in the API call
# oceania_fancy <-
# gs_read_listfeed(gap_ss,
# ws = "Oceania",
# reverse = TRUE, orderby = "gdppercap",
# sq = "lifeexp > 79 or year < 1960")
# oceania_fancy
#
# ## passing args through to readr::type_convert()
# oceania_crazy <-
# gs_read_listfeed(gap_ss,
# ws = "Oceania",
# col_names = paste0("z", 1:6), skip = 1,
# col_types = "ccncnn",
# na = "1962")
# oceania_crazy
# ## End(Not run)
Run the code above in your browser using DataLab