multiple data subsets combined in to one variable.

multiple data subsets combined in to one variable. // I have 51 states broken into 4 separate locations. That need to be established into one variable "region" in base r.

Hi, and welcome. A reproducible example, called a reprex would help here. How the 51 states are broken into locations makes a big difference.

If you have four separate files, say, North, East, West, South"you can mutate each of them with the following pattern using dplyr

north <- north %>% mutate(region = "North")

and then rbind the results into your national data frame.

2 Likes

Im required to use base r functions unfortunately dplyr is not allowed

Would still need a reprex showing how your data is organized to help

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.