I am trying to replicate a column of a data frame into the same or a new data frame. My data frame df only contains one column:
col
1
2
3
4
5
I hope to get something like this (another/same data frame, not a matrix):
col1 col2 col3 col4 col5
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
5 5 5 5 5
I tried to create a new data frame by using new_df <- rep(df[,c(1)],5), which I don't understand why it didn't work.