May be this helps: mymatrix<- matrix (1:5, nrow=5, ncol=columnas, byrow=TRUE, dimnames=(list(myrownames, c(1,2,3,4,5)))) #Error in matrix(1:5, nrow = 5, ncol = columnas, byrow = TRUE, dimnames = (list(myrownames, : # object 'columnas' not found
myrownames[which.max(nchar(myrownames))] #[1] "Ciencias Sociales y Jurídicas" nchar(myrownames)[which.max(nchar(myrownames))] #[1] 29 A.K. >Hello, > >I want to modify margin options in a barplot into a loop. I have, for example, >a matrix like this: > >myrownames <- c("Arte y Humanidades","Ciencias Sociales y Jurídicas", "Ciencias de la Salud","Ciencias", "Ingenierías y arquitectura") >mymatrix<- matrix (1:5, nrow=5, ncol=columnas, byrow=TRUE, >dimnames=(list(myrownames, c(1,2,3,4,5)))) >my_strings_length <- nchar(rownames(mymatrix)) >[1] 18 29 20 8 26 > >I want to find automatically the highest value in my_strings_length, i.e 29. >¿how can I do it? > >many thanks, > >-- >================================== >Ramón Ovelar >Campus Virtual Birtuala UPV/EHU >Tel: (34) 94 601 3407 >http://campusvirtual.ehu.es >University of the Basque Country ______________________________________________ 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.