Saturday, October 11, 2014

R unname Function

unname() function removes the names or dimnames attribute of an R object.
unname(obj, force=FALSE)

obj: an R object
force: logical; if true, the dimnames (names and row names) are removed even from data.frames


> 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

> unname(BOD)
  NA   NA
1  1  8.3
2  2 10.3
3  3 19.0
4  4 16.0
5  5 15.6
6  7 19.8

No comments:

Post a Comment