Create Data Frame from Another Existing Data Set in R (2 Examples) | Column Names & Index Position

preview_player
Показать описание
R code of this video:

x2 = 5:1,
x3 = letters[1:5],
x4 = "x",
x5 = 10)
data # Print example data frame

data_new1 <- data[ , c("x1", "x2", "x5")] # Extract certain columns
data_new1 # Print new data frame

data_new2 <- data[ , c(2, 3, 4)] # Extract certain columns
data_new2 # Print new data frame

Follow me on Social Media:

Рекомендации по теме
Комментарии
Автор

thank you so much! this helped me make a table from scratch which took me 2 hrs to research about but you explained it in 40 seconds

nez