Im new to R.
Im trying to make a data frame
df = data_frame(data$Name, data$classification, data$HP, data$Weight, data$Height, data$Att, data$Def, data$Spe, data$Spa, data$Spd, data$Type_1, data$Type_2, data$Abilities, data$Generation, data$Legendary, data$Catch_Rate)
but the only way I found for it to work is if I put "data$" before each column. Is there a way to make it without "data$" by making the data some sort of default???
Thanks
CodePudding user response:
data_frame()
was deprecated in tibble 1.1.0.
Instead, you may try
library(tidyverse)
data %>%
select(Name, classification, HP, Weight, Height, Att, Def, Spe, Spa, Spd, Type_1, Type_2, Abilities, Generation, Legendary, Catch_Rate) %>%
tibble()
CodePudding user response:
Usually we do
data <- data[c("Name", "classification", "HP", "Weight", "Height", "Att",
"Def", "Spe", "Spa", "Spd", "Type_1", "Type_2", "Abilities",
"Generation", "Legendary", "Catch_Rate")]
CodePudding user response:
Also you can use names(df)
to change the names of your df
names(df)<-c("Name", "Classification","HP", "Weight","Height", "Att", "Def","Spe","Spa","Spd","Type_1","Type_2", "Abilities","Generation","Legendary","Catch_Rate")