A few things in play here: 1) I'm guessing you are new to R, so I'd advise you to take some time to read some introductory materials at this point. If you type help.start() into your R session, a good introductory manual will be available.
2) You don't need any of this "textConnection" business, that's just one way of reading in data from an email. If you are reading in your data via read.table() you don't need anything else. 3) Your code should perhaps look something like this, but I can't be certain without an actual sample of your data: lista <- read.table("lista.txt",header=T,dec=",") vit<-subset(lista, (lista$familia == "Vittariaceae") , select=c(ingreso, familia, genero,categoria,ira5,ira6,ira7,ira8,ira9,ira10,irah5,irah6,irah7,irah8,irah9,irah10,ed5)) boxplot( t(vit[grepl("ira",rownames(vit)),]), col = ifelse(vit[,NCOL(vit)] == "C", 2,3)) but at this point, I'd spend some a little more time learning how to manipulate and subset in R before trying to handle this finer sort of detail. I'll quickly parse that last line for you, though, just in case this is a time sensitive project: working from the inside out: grepl("ira", rownames(vit)) # Identify those rows that have ira in the name vit[grepl("ira", rownames(vit)),] # Select only those rows from vit t( ) # transpose since boxplot takes in columns (see my above note) vit[,NCOL(vit)] # isolate the last column ** == "C" # Test for being of type "C" ifelse( **, 2, 3) ## assign either a two or a three depending whethere it was a "C" or not col = # color the boxplots 4) On another note, are you sure you want to do your boxplots rowwise? It's pretty standard in R that columns represent similar data while rows are independent measurements/observations. 5) And just for the record, the error you got is because you passed boxplot something that wasn't a data object, but rather an empty textConnection(). Hope this helps, Michael PS -- It's good form (and usually more helpful to you) to cc the whole list on each step of the correspondance. It lets other voices chime in if I start leading you astray as well as ensuring that there are replies coming even at all hours of the day since R-help has a world-wide readership. Also, it makes sure everything gets archived nicely so someone can read them in the future. On Fri, Oct 14, 2011 at 9:19 AM, Ruth Arias <rueu...@yahoo.es> wrote: > thanks for answer me michel > > I made some modifications to your suggestion. > I have tried this: >> lista <- read.table("lista.txt",header=T,dec=",") >> vit<-subset(lista, (lista$familia == "Vittariaceae") , select=c(ingreso, >> familia, >> genero,categoria,ira5,ira6,ira7,ira8,ira9,ira10,irah5,irah6,irah7,irah8,irah9,irah10,ed5)) >> vitbp<-textConnection("vit") >> closeAllConnections() >> boxplot(vitbp[,1:5], col = ifelse(V[,6] == "C", 2,3)) > and I have this answer: > Error en plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs) > : > se necesitan valores finitos de 'ylim' = needs finite values > Además: Mensajes de aviso perdidos = also: message > 1: In min(x) : ningún argumento finito para min; retornando Inf = no finite > argument for minimun > 2: In max(x) : ningun argumento finito para max; retornando -Inf = no finite > argument for maximun > > and what I want is to make a box plot to let me see the differences in > different iras (ira5, ira6 ...) between the category C and E > > > > I'm not sure what the "column to identify other the other columns" > maps to graphically, but perhaps something like this will get you > started > > V <- read.table(textConnection(" > 4 5 6 7 8 site > 23 56 41 45 63 C > > 21 89 42 10 63 E > > 32 45 14 17 96 E > > 45 74 13 63 41 C > > 68 32 10 20 03 E > > 95 10 84 45 96 C > "),header=TRUE) > closeAllConnections() > > boxplot(V[,1:5], col = ifelse(V[,6] == "C", 2,3)) > > > Michael > > On Thu, Oct 13, 2011 at 5:54 PM, Ruth Arias <rueu...@yahoo.es> wrote: >> hello >> >> I want to make a boxplot with diferents rows and also include a column to >> sort into two groups to each of the other columns >> >> my date set looks like this: >> >> 4 5 6 7 8 site >> 23 56 41 45 63 C >> >> 21 89 42 10 63 E >> >> 32 45 14 17 96 E >> >> 45 74 13 63 41 C >> >> 68 32 10 20 03 E >> >> 95 10 84 45 96 C >> >> THANKS >> >> [[alternative HTML version deleted]] >> >> >> ______________________________________________ >> 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. >> >> > > > ______________________________________________ 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.