## Not run: ------------------------------------
# # Just passing the datasetid without fields gives all columns back
# erddap_table('erdCalCOFIfshsiz')
#
# # Pass time constraints
# erddap_table('erdCalCOFIfshsiz', 'time>=2001-07-07', 'time<=2001-07-08')
#
# # Pass in fields (i.e., columns to retrieve) & time constraints
# erddap_table('erdCalCOFIfshsiz','time>=2001-07-07','time<=2001-07-10',
# fields=c('longitude','latitude','fish_size','itis_tsn'))
# erddap_table('erdCinpKfmBT', fields=c('latitude','longitude',
# 'Aplysia_californica_Mean_Density','Muricea_californica_Mean_Density'),
# 'time>=2007-06-24','time<=2007-07-01')
#
# # Get info on a datasetid, then get data given information learned
# erddap_info('erdCalCOFIlrvsiz')$variables
# erddap_table('erdCalCOFIlrvsiz', fields=c('latitude','longitude','larvae_size',
# 'itis_tsn'), 'time>=2011-10-25', 'time<=2011-10-31')
#
# # An example workflow
# ## Search for data
# (out <- erddap_search(query='fish', which = 'table'))
# ## Using a datasetid, search for information on a datasetid
# id <- out$info$dataset_id[7]
# erddap_info(id)$variables
# ## Get data from the dataset
# erddap_table(id, fields = c('fish','landings','year'))
#
# # Time constraint
# ## Limit by time with date only
# (info <- erddap_info('erdCalCOFIfshsiz'))
# erddap_table(info, fields = c('latitude','longitude','scientific_name'),
# 'time>=2001-07-14')
#
# # Use distinct parameter
# erddap_table('erdCalCOFIfshsiz',fields=c('longitude','latitude','fish_size','itis_tsn'),
# 'time>=2001-07-07','time<=2001-07-10', distinct=TRUE)
#
# # Use units parameter
# ## In this example, values are the same, but sometimes they can be different given the units
# ## value passed
# erddap_table('erdCinpKfmT', 'time>=2007-09-19', 'time<=2007-09-21',
# fields=c('longitude','latitude','time','temperature'), units='udunits')
# erddap_table('erdCinpKfmT', 'time>=2007-09-19', 'time<=2007-09-21',
# fields=c('longitude','latitude','time','temperature'), units='ucum')
#
# # Use orderby parameter
# erddap_table('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
# 'time>=2007-09-19', 'time<=2007-09-21', orderby='temperature')
# # Use orderbymax parameter
# erddap_table('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
# 'time>=2007-09-19', 'time<=2007-09-21', orderbymax='temperature')
# # Use orderbymin parameter
# erddap_table('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
# 'time>=2007-09-19', 'time<=2007-09-21', orderbymin='temperature')
# # Use orderbyminmax parameter
# erddap_table('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
# 'time>=2007-09-19', 'time<=2007-09-21', orderbyminmax='temperature')
# # Use orderbymin parameter with multiple values
# erddap_table('erdCinpKfmT', fields=c('longitude','latitude','time','depth','temperature'),
# 'time>=2007-06-10', 'time<=2007-09-21', orderbymax=c('depth','temperature'))
#
# # Spatial delimitation
# erddap_table('erdCalCOFIfshsiz', fields = c('latitude','longitude','scientific_name'),
# 'latitude>=34.8', 'latitude<=35', 'longitude>=-125', 'longitude<=-124')
#
# # Integrate with taxize
# out <- erddap_table('erdCalCOFIfshsiz',
# fields = c('latitude','longitude','scientific_name','itis_tsn'))
# tsns <- unique(out$itis_tsn[1:100])
# library("taxize")
# classif <- classification(tsns, db = "itis")
# head(rbind(classif)); tail(rbind(classif))
#
# # Write to memory (within R), or to disk
# (out <- erddap_info('erdCalCOFIfshsiz'))
# ## disk, by default (to prevent bogging down system w/ large datasets)
# ## you can also pass in path and overwrite options to disk()
# erddap_table('erdCalCOFIfshsiz', store = disk())
# ## the 2nd call is much faster as it's mostly just the time of reading in the table from disk
# system.time( erddap_table('erdCalCOFIfshsiz', store = disk()) )
# system.time( erddap_table('erdCalCOFIfshsiz', store = disk()) )
# ## memory
# erddap_table(x='erdCalCOFIfshsiz', store = memory())
## ---------------------------------------------
Run the code above in your browser using DataLab