obm_put: Put Function

Description Usage Arguments Examples

View source: R/openbiomaps.R

Description

This function allows put data into an OpenBioMaps server.

Usage

1
2
3
obm_put(scope = NULL, form_header = NULL, data_file = NULL,
  media_file = NULL, form_id = "", form_data = "", soft_error = "",
  token = OBM$token, pds_url = OBM$pds_url, data_table = OBM$project)

Arguments

scope

currently put_data supported

form_id

the form's id

form_data

JSON array of data

soft_error

JSON array of 'Yes' strings (or translations of it) to skip soft error messages

token

OBM$token

header_names

database column names vector, if missing default is the full list from the form

csv_file

a csv file with header row

url

OBM$url

table

OBM$table

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
using own list of columns
  obm_get('get_form_list',0)
  form <- obm_get('get_form_data',57)
  columns <- unlist(form[,'column'])
  t <- obm_put('put_data',columns[1:3],form_id=57,data_file='~/teszt2.csv')

using default columns list:
  t <- obm_put(scope='put_data',form_id=57,csv_file='~/teszt2.csv')

JSON upload
  data <- matrix(c(c("Tringa totanus",'egyed',"AWBO",'10','POINT(47.1 21.3)'),c("Tringa flavipes",'egyed',"BYWO",'2','POINT(47.3 21.4)')),ncol=5,nrow=2,byrow=T)
  #colnames(data)<-c("species","nume","place","no","geom")
  t <- obm_put(scope='put_data',form_id=57,form_data=as.data.frame(data),form_header=c('faj','szamossag','hely','egyedszam'))

with attached file
  data <- matrix(c(c("Tringa totanus",'egyed',"AWBO",'10','szamok.odt'),c("Tringa flavipes",'egyed',"BYWO",'2','a.pdf')),ncol=5,nrow=2,byrow=T)
  #colnames(data)<-c("species","nume","place","no",'Attach')
  t <- obm_put(scope='put_data',form_id=57,form_data=as.data.frame(data),form_header=c('faj','szamossag','hely','egyedszam','obm_files_id'),media_file=c('~/szamok.odt','~/a.pdf'))

OpenBioMaps/obm.r documentation built on June 14, 2018, 1:21 p.m.