I am pretty new to R and am trying to combine a df with a factor.
My df is a dataframe of 300 by 2, and the factor is created from sampling the 300 rows and assigning them to 1,2,3. I would like to know how to combine my factor to the df. Basically, I want the factor variable shown as a column of my df.
I tried merge(db, factor) but it did not work. I also tried to turn the factor variable into a df, but still couldn't get it to work.