# Example 1: Import data exported from the TRY database
# Specify file path to the raw data provided within the rtry package
input_path <- system.file("testdata", "data_TRY_15160.txt", package = "rtry")
# For own data and Windows users the path might rather look similar to this:
# input_path <- "C:/Users/User/Desktop/data_TRY_15160.txt"
# Import data file using rtry_import
input <- rtry_import(input_path)
# Explicit notation:
# input <- rtry_import(input_path, separator = "\t", encoding = "Latin-1",
# quote = "", showOverview = TRUE)
# Expected message:
# input: ~/R/R-4.0.5/library/rtry/testdata/data_TRY_15160.txt
# dim: 1782 28
# col: LastName FirstName DatasetID Dataset SpeciesName AccSpeciesID AccSpeciesName
# ObservationID ObsDataID TraitID TraitName DataID DataName OriglName
# OrigValueStr OrigUnitStr ValueKindName OrigUncertaintyStr UncertaintyName
# Replicates StdValue UnitName RelUncertaintyPercent OrigObsDataID ErrorRisk
# Reference Comment V28
# Example 2: Import CSV file
# Specify file path to the raw data provided within the rtry package
input_path <- system.file("testdata", "data_locations.csv", package = "rtry")
# Import data file using rtry_import
input <- rtry_import(input_path, separator = ",", encoding = "UTF-8",
quote = "\"", showOverview = TRUE)
# Expected message:
# input: ~/R/R-4.0.5/library/rtry/testdata/data_locations.csv
# dim: 20 3
# col: Country code Country Location
Run the code above in your browser using DataLab