R names Function


names() function gets or sets the names of an object.

names(x)
names(x) <- value


x: R object
value: to be assigned to the x, with the same length as x, or NULL
...

> BOD

Time demand
1 1 8.3
2 2 10.3
3 3 19.0
4 4 16.0
5 5 15.6
6 7 19.8


> mode(BOD)

[1] "list"


> names(BOD)

[1] "Time" "demand"


> x <- c(5,7,3)
> names(x) <- c("red","greed","blue")
> names(x)

[1] "red" "greed" "blue"





endmemo.com © 2025  | Terms of Use | Privacy | Home