NCEAS / datateam-training

Training and reference materials for ADC and SASAP data team members
https://nceas.github.io/datateam-training/training/
Apache License 2.0
7 stars 22 forks source link

Temporary fix for issue where units that should be standard show up as custom #210

Closed eeerika closed 3 years ago

eeerika commented 4 years ago
doc$dataset$dataTable[[i]]$attributeList$attribute[[i]]$measurementScale$ratio$unit$standardUnit <- "percent"
doc$dataset$dataTable[[i]]$attributeList$attribute[[i]]$measurementScale$ratio$unit$customUnit <- NULL

replace "i"s with the correct data table number and attribute number, replace "percent" with whatever the standard unit should be first line of code adds the standard unit, second gets rid of the custom unit

if you want to find all of the positions of a certain custom unit that should be standard, try this code (this is an example to find all "percent" units -- change to whatever you are looking for):

ls <- purrr::map(doc$dataset$dataTable[[i]]$attributeList$attribute, ~str_detect(.x$measurementScale$ratio$unit$customUnit, "percent"))
which(ls == TRUE)