x <- 1:5 class(x) # output: [1] "integer"
x <- 1:5 attributes(x) #output: $names # [1] "age"
x<-5 names(x) # output NULL names(x) <- "age" # Or attr(x,'names')<-"age" names(x) # output [1] "age"
x <- 1:6 # print x : [1] 1 2 3 4 5 6 dim(x) <- c(2,3) # or attr(x,'dim') <- c(2,3) # print x : # [,1] [,2] [,3] # [1,] 1 3 5 # [2,] 2 4 6