View source: R/export.snowprofileCsv.R
export.snowprofileCsv | R Documentation |
Export or write a snowprofile object to a CSV table
export.snowprofileCsv( profile, filename = stop("filename must be provided"), sep = ",", export.all = "Layers", variables = NA )
profile |
snowprofile object |
filename |
character string, e.g. 'path/to/file.csv' |
sep |
csv column separator as character string |
export.all |
one of If |
variables |
A tag-value list of the format, e.g. height = 'height_top', to specify column names of specific variables,
to customize column order, and/or to include specific profile meta data if |
Note that existing files with the specified filename will be overwritten without warning!
Writes csv file to disk, no return value in R
fherla
snowprofileCsv
## export an entire snowprofile object: export.snowprofileCsv(SPpairs$A_manual, filename = file.path(tempdir(), 'file.csv'), export.all = TRUE) ## export only the layer properties of a snowprofile object, # and change the column order with few column names: # All layer variables will be exported, but the three ones provided in 'variables' # will be the first three columns of the csv table, and their column names will be changed # accordingly. export.snowprofileCsv(SPpairs$A_manual, filename = file.path(tempdir(), 'file.csv'), export.all = 'Layers', variables = list(height = 'height_top', hardness = 'hardness', gtype = 'gt1')) ## export all layer properties of a snowprofile object plus the station ID: export.snowprofileCsv(SPpairs$A_manual, filename = file.path(tempdir(), 'file.csv'), export.all = 'Layers', variables = list(station_id = 'station_id')) ## check the content of the exported csv file: csv_content <- read.csv(file.path(tempdir(), 'file.csv')) head(csv_content) ## or re-import the csv file as snowprofile object: csv_snowprofile <- snowprofileCsv(file.path(tempdir(), 'file.csv')) print(csv_snowprofile)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.