Remove "names" or "dimnames"

DESCRIPTION:

Remove the names or dimnames of an object.

USAGE:

unname(obj)
 

REQUIRED ARGUMENTS:

obj
an object for which you want to remove the names or dimnames.

VALUE:

Object like obj, but without names or dimnames.

EXAMPLES:

x <- fuel.frame$Weight
 
y <- factor(cut(x, seq(min(x), max(x), length=6)))
 
z <- table(y)
 
z  # names are longer than the data
 
unname(z)
 

 
# Some calculations are substantially faster if you remove names
 
# from input vectors first.
 
z1 <- runif(1000)
 
names(z1) <- as.character(1:1000)
 
sys.time(for(i in 1:1000) z1[i] <- z1[i]) # .219 seconds
 
z1 <- unname(z1)
 
sys.time(for(i in 1:1000) z1[i] <- z1[i]) # .062 seconds