I am trying to combine two sets of data into one set. I have tried to use c() but it will not work. I have also tried to use rbind() and merge() with no luck. The only command that has worked so far is cbind() but when I ask for the summary it gives me vector 1 and vector 2 instead of it being one single variable. I have also tried lm() and keep getting: lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases
I see that your data frame HW3data has two numeric columns D7A and D7B. What result do you want when you combine these columns? Say D7A = 5 and D7B = 4. What will the combined result be that will be stored in the partyid column??
I am still not sure I understand your goal. In the code below, I invented a little data frame with two columns named D7A and D7B and then I made a new column that is a list column. Each row in that column contains a vector of length two the contains the two values from D7A and D7B. Is that what you want?
Well, some part of the requirement has to be set aside. You can have a list column in the original data frame as in my first response or a separate vector. Why are you trying to make this new column? What is the goal of the process?
I suspect there is a miscommunication somewhere. The three ways I can think of to "combine" the data are the two I have shown or a mathematical combination like taking the mean or the sum.