Learn R Programming

ClimMobTools (version 1.4)

getDataCM: Get ClimMob data

Description

Fetch the data from a ClimMob project using an application programming interface (API) key

Usage

getDataCM(
  key,
  project,
  userowner,
  as.data.frame = TRUE,
  as.text = FALSE,
  server = "climmob3",
  ...
)

# S3 method for CM_list as.data.frame(x, ..., tidynames = TRUE, pivot.wider = FALSE)

Value

An object of class 'CM_list' or a text file or a data.frame with class "CM_df" with the variables:

id

the participant's package id

moment

the data collection moment

variable

the variable name

value

the value for each variable

Arguments

key

character, the user's API key

project

character, the project id

userowner

character, username of project's owner

as.data.frame

logical, to return a data frame, as.data.frame = FALSE returns a list

as.text

logical, to return a text file that can be parsed to json

server

character, to indicate from which server the data will be retrieved. See details

...

additional arguments passed to methods

x

an object of class CM_list

tidynames

logical, TRUE make clean column names

pivot.wider

logical, if TRUE return a wider object where each tricot package is a row

Author

Kauê de Sousa

Details

server: options are: "climmob" or "1000farms"

See Also

Other GET functions: getProjectProgress(), getProjectsCM()

Examples

Run this code
if (FALSE) { # interactive()

# This function only works with an API key
# the API key can be obtained from your ClimMob account
 
library("ClimMobTools")
my_key = "d39a3c66-5822-4930-a9d4-50e7da041e77"

getDataCM(key = my_key,
          project = "breadwheat",
          userowner = "gosset",
          server = "climmob3")
          
# get in the wide format

getDataCM(key = my_key,
          project = "breadwheat",
          userowner = "gosset",
          server = "climmob3",
          pivot.wider = TRUE)
}

Run the code above in your browser using DataLab