I have a data frame called "Region_Data" which I have created by performing some functions on it.
I want to take this data frame called "Region_Data" and use it an input and I want to subset it using the following function that I created. The function should produce the subset data frame:
Region_Analysis_Function <- function(Input_Region){
Subset_Region_Data = subset(Region_Data, Region == "Input_Region" )
Subset_Region_Data
}
However, when I create this function and then execute it using:
Region_Analysis_Fuction("North West")
I get 0 observations when I execute this code (though I know that there are xx number of observations in the data frame.)
I read that there is something called global / local environment, but I'm not really clear on that.
How do I solve this issue? Thank you so much in advance!!