Extract Single Element from Data Frame in R | Access Specific Position | Row Index & Variable Name

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

x2 = letters[1:5])

data[3, "x2"] # Extract element

data[3, 2] # Extract element

Follow me on Social Media:
Рекомендации по теме
Комментарии
Автор

Great video, and amazing explaination for newcomers like me. But, whenever I try the first value, as string instead of integer, then the output show NA.

> x <- c("a", "b", "c")
> y <- c(1, 2, 3)
> xy <- data.frame(x, y)
> xy["c", 2]
[1] NA

Would be great if you could help.

janilinbappi
Автор

What if you only know x2 and you want to return the value '3' (the other column value for that row)

CG-vdnu