swirldev / swirl_courses

:mortar_board: A collection of interactive courses for the swirl R package.
http://swirlstats.com
Other
4.32k stars 7.24k forks source link

Practice Programming Assignment: swirl Lesson 7: Matrices and Data Frames #471

Open bayniyazov0518 opened 3 years ago

bayniyazov0518 commented 3 years ago

Since we have six columns (including patient names), we'll need to first create a vector containing one element for each column. Create a character vector called cnames that contains the following values (in order) -- "patient", "age", "weight", "bp", "rating", "test".

bayniyazov0518 commented 3 years ago

please help me

gsouk94 commented 3 years ago

Hi, i think this is the correct answer:

cnames <- c("patient", "age", "weight", "bp", "rating", "test") # create the character vector with the names

colnames(my_data) <- cnames # assign the cnames vector to the data frame you created earlier

my_ data # see the results

I hope this helps :)

(i am a beginner following the steps. this worked for me, i hope it's okay)

bayniyazov0518 commented 3 years ago

thanks