Skip to content

Commit

Permalink
remove dplyr dependecnies
Browse files Browse the repository at this point in the history
  • Loading branch information
omarbenites committed Jun 1, 2018
1 parent 04b9b4b commit 414cdb0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/trait_tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ get_trait_type <- function(trait,trait_dict, dsource = 1)
}
if(dsource == 2){
#tp <- as.character(trait_dict[trait_dict$CO_VAR==trait,c("TYPE")])
tp <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("TYPE") %>% pull() %>% as.character()
tp <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("TYPE") %>% unlist() %>% as.character()# %>% dplyr::pull() %>% as.character()
}

#tp <- na.exclude(tp)
Expand Down Expand Up @@ -70,7 +70,7 @@ get_trait_name <- function(trait,trait_dict, dsource=1 )
}
if(dsource == 2){
#tp <- as.character(trait_dict[trait_dict$CO_VAR==trait,c("VAR")])
tp <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("VAR") %>% pull() %>% as.character()
tp <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("VAR") %>% unlist() %>% as.character()#%>% dplyr::pull() %>% as.character()
}


Expand Down Expand Up @@ -111,7 +111,7 @@ get_trait_units <- function(trait,trait_dict, dsource = 1)
}
if(dsource == 2){
#tp <- as.character(trait_dict[trait_dict$CO_VAR==trait,c("UNITS")])
tp <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("UNITS") %>% pull() %>% as.character()
tp <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("UNITS") %>% unlist() %>% as.character()#%>% dplyr::pull() %>% as.character()
}

#tp <- na.exclude(tp)
Expand Down Expand Up @@ -151,7 +151,7 @@ get_trait_crop <- function(trait,trait_dict, dsource = 1)
}
if(dsource == 2){
#tp <- as.character(trait_dict[trait_dict$CO_VAR==trait,c("VAR")])
tp <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("VAR") %>% pull() %>% as.character()
tp <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("VAR") %>% unlist() %>% as.character() #%>% dplyr::pull() %>% as.character()
}

#tp <- na.exclude(tp)
Expand Down Expand Up @@ -203,11 +203,11 @@ get_scale_trait <- function(trait,trait_dict, dsource = 1){
}
if(dsource ==2){
#ll <- as.numeric(trait_dict[trait_dict$CO_VAR==trait,c("LOWER")])
ll <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("LOWER") %>% pull() %>% as.character()
ll <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("LOWER") %>% unlist() %>% as.character()# %>% dplyr::pull() %>% as.character()
if(is.na(ll)) {ll <- 0}
#print(ll)
#ul <- as.numeric(trait_dict[trait_dict$CO_VAR==trait,c("UPPER")])
ul <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("UPPER") %>% pull() %>% as.character()
ul <- trait_dict %>% dplyr::filter(TRAIT_COID == trait) %>% select_("UPPER") %>% unlist() %>% as.character() #%>% dplyr::pull() %>% as.character()
#In case trait is defined but dont have ul scale values will take 100000
if(is.na(ul)) {ul <- 1000000}
}
Expand Down

0 comments on commit 414cdb0

Please sign in to comment.