I apologize, I posted this same question yesterday but phrased it very poorly. I have no idea how to go about approaching this problem. I have approximately 2000 rows of data, with an owner, percentage of credit to the owner, an employee, and a percentage of credit to the employee. I have provided an example row.
owner<- c("bob") percentage_owner<- .75 employee<- c("sydney") employee_percent<- .25 For each row of data, I am attempting to create a new row of data that places the owner's name into the employee column, and his percentage as the employees percentage, keeping all other columns the same in the new row, like so:
owner2<- c("bob", "bob") percentage_owner2<- c(.75, .75) employee2<- c("sydney", "bob") employee_percent2<- c(.25,.75) sample_data<-data.frame(owner, percentage_owner, employee, employee_percent) goal_data <- data.frame(owner = owner2, percentage_owner = percentage_owner2, employee = employee2, employee_percent = employee_percent2) I want this to occur for all rows of the data, essentially doubling the dataset. How would I go about doing this? I don't have much experience using R for this sort of data manipulation. Any help is greatly appreciated!