R/get_data_for_variable.R

Defines functions get_data_for_variable

Documented in get_data_for_variable

#' @title Extracts data for a specific variable from a data set.
#' @description Extracts data for specific variable from a data set. Default is the Entrances data set.
#'
#' @param VarName character string or vector with character strings with the name(s) of the variable(s).
#' @param data dataframe, from which you want to extract your data. The data frame must contain a column called variable. Default is the EntrancesData data set.
#' @return dataframe
#' @export
#' @examples
#' #extracts data for a specific variable from a data frame. Default is the EntrancesData data set.
#' get_data_for_variable(VarName="GDP_EUR", data=EntrancesData)
get_data_for_variable<- function(VarName, data=EntrancesData){
  dataout<-data[which(data$variable %in% VarName),]
  return(dataout)
}
THartl1/EntrancesDataPackage documentation built on Dec. 18, 2021, 4:01 p.m.