cbind doesn't attribute the name of the column
I'm trying to create a new data frame that contains the row names and the first column of an existing data : i tried this
#To take the rownames of my old data
New_data - as.data.frame(row.names(old_data))
#To add the first column of my old data to a new data
New_data - cbind(old_data[,1])
When i visualize my new data using View(New_Data) i don't see the name of my the first column just V1
example
old_data
NAME AGE SEXE
A AQ 22 M
B RT 14 M
C DS 26 F
D YY 19 M
E IO 32 F
F PP 20 F
New_data - as.data.frame(row.names(old_data))
New_data
A
B
C
D
E
F
#add the first column of my old data to a new data
New_data - cbind(old_data[,1])
New_data
V1
A 22
B 14
C 26
D 19
E 32
F 20
As you can see the name of the column in my new data is V1 , i want to bind the first column of my old data with the name of this column like this
New_data
Name
A 22
B 14
C 26
D 19
E 32
F 20
Topic data programming statistics r
Category Data Science