R/get_data_nuts2.R

Defines functions get_data_NUTS2

Documented in get_data_NUTS2

#' @title Extracts data on the NUTS2-level of a data set.
#' @description Extracts all observations/rows which are on the NUTS2-level from a data set. Default is the Entrances data set.
#'
#' @param data dataframe, from which you want to extract your data. The data frame must contain the regional IDs in the first column. Default is the EntrancesData data set.
#' @return dataframe containing only observations with NUTS2_IDs
#' @export
#' @examples
#' #extracts data only for the NUTS2 level from a data set. Default is the EntrancesData data set.
#' get_data_NUTS2(data=EntrancesData)
get_data_NUTS2<-function(data=EntrancesData) {
  NUTS2<-NUTS_data$NUTS[which(nchar(NUTS_data$NUTS)==4)]
  dataout<-data[which(data[,1] %in% NUTS2),]
  return(dataout)
}
THartl1/EntrancesDataPackage documentation built on Dec. 18, 2021, 4:01 p.m.