Hi, May be this helps: month.dayslong<-rep(31,7) names(month.dayslong)<- c("January","March","May","July","August","October","December") month.dayslong # January March May July August October December # 31 31 31 31 31 31 31
unname(month.dayslong) #[1] 31 31 31 31 31 31 31 #or as.vector(month.dayslong) #[1] 31 31 31 31 31 31 31 identical(unname(month.dayslong),as.vector(month.dayslong)) #[1] TRUE identical(unname(month.dayslong),month.dayslong) #[1] FALSE A.K. >I have started learning R and have the following query : > >i have a named vector like below > > month.dayslong > January March May July August October December > 31 31 31 31 31 31 31 > >like the command names(months.days) giving only the names from the vector , is there any command which will give only the numeric values : like >31 31 31 31 etc... ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.