knitr::opts_chunk$set(echo = TRUE)
library(devtools) install_github("metadevpro/traitbaser") library(traitbaser) #cnx <- connect(url = "http://traitbase-qa.herokuapp.com/", "", "") #demo not working cnx <- connect(url = "https://traitbase-dev.herokuapp.com/", "demo", "1234") #demo not working
To add data you need a user and pws with permits...
d <- read.csv("tests/testdata.csv", header = TRUE, sep = ";") head(d) errors <- validateDataset(cnx, d) errors parseErrors(errors) #way to clean errors #create helper functions temp <- cleanSpecies(species = d$species[1:3], verbose = FALSE) #Fix one manually d[7,"year"] <- 2019 #test one by one d[7,] errors <- validateDataset(cnx, d[7,-21]) parseErrors(errors) #FIX Error in paste error when no error. importDataset(cnx,csvData = d[7,-21]) #works!
off <- resource(cnx, "species") query(off) #query all database. query(off, conditions = buildCondition("genus", "==", "Bombus ")) #fix example query species for genus. ##FUCK genus has an space at the end FIX IN DATABASE!!!! query(off, conditions = buildCondition("species", "==", "Bombus terrestris")) #fix example query species for genus. query(off, limit=2, skip=0) query(off, limit=2, skip=2) query(off) #query all database. query(off, conditions = buildCondition("genus", "==", "Bombus ")) #fix example query species for genus. ##FUCK genus has an space at the end FIX IN DATABASE!!!! query(off, conditions = buildCondition("species", "==", "Bombus terrestris")) #fix example query species for genus. query(off, limit=2, skip=0) query(off, limit=2, skip=2)
Only admins can do this on traitbase. However, here we can ...
#Fetch dataset ID off <- resource(cnx, "dataSets") #Wierdspelling out <- query(off) datasetId <- out[7,1] #make safe deleteDatasetById(cnx, "5893230250271204003cf074") #deletes datasets, but not observations. #make better output deleteDatasetById(cnx = cnx, datasetId = "fake") #need better errors when id do not exist.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.