Remove names or dimnames from an Object in R Programming – unname() Function
Last Updated :
16 Jun, 2020
unname()
function in R Language is used to remove the names or dimnames from an Object.
Syntax: unname(x)
Parameters:
x: Object
Example 1:
A = matrix(c( 1 : 9 ), 3 , 3 )
rownames(A) = c( "a" , "b" , "c" )
colnames(A) = c( "c" , "d" , "e" )
print (A)
unname(A)
|
Output:
c d e
a 1 4 7
b 2 5 8
c 3 6 9
[, 1] [, 2] [, 3]
[1, ] 1 4 7
[2, ] 2 5 8
[3, ] 3 6 9
Example 2:
Output:
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
1 1 8.3
2 2 10.3
3 3 19.0
4 4 16.0
5 5 15.6
6 7 19.8
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...