Re: [R] how to keep row name if there is only one row selected from a data frame

2011-11-29 Thread agent dunham
Dear Community: Thank you Michael, I did it as you said. However I still have a little problem with this staff. I try my lm's in my df1's variables. Let's say: lm1 <- lm( df1$vi) ~ df1$v1 + df1$v2) Then I usally type: plot(lm1, 1:4) I'd like to see in the plots obtained the name of the rown

Re: [R] how to keep row name if there is only one row selected from a data frame

2011-11-23 Thread agent dunham
I've manged this way: df2 <- df1[-match(784, row.names(df1)), ] Isn't there any other way?? How can I retrieve/delete three rows with the same command line?u...@host.com -- View this message in context: http://r.789695.n4.nabble.com/how-to-keep-row-name-if-there-is-only-one-row-selected-from

Re: [R] how to keep row name if there is only one row selected from a data frame

2011-11-23 Thread R. Michael Weylandt
You probably mean this: df1[!(rownames(df1) %in% c("2098","2970","784")), ] Remember, row names are strings: if you give R an integer, it will interpret it as a row index. Michael On Wed, Nov 23, 2011 at 5:37 AM, agent dunham wrote: > Dear Community, > > I'm having a similar problem. I'm worki

Re: [R] how to keep row name if there is only one row selected from a data frame

2011-11-23 Thread agent dunham
Dear Community, I'm having a similar problem. I'm working with the data.frame attached ( http://r.789695.n4.nabble.com/file/n4099139/df1.xls df1.xls ), let's call it df1 (and when I type str(df1) it answers data.frame) df1 has its own rownames (In the .xls the column "id", not 1,2,3, ...), and

Re: [R] how to keep row name if there is only one row selected from a data frame

2009-07-12 Thread hadley wickham
On Mon, Jul 13, 2009 at 5:55 AM, Weiwei Shi wrote: > Hi, there: > > Assume I have a dataframe with rownames like A with rownames like a to e, > >> A >  [,1] [,2] > a    1    6 > b    2    7 > c    3    8 > d    4    9 > e    5   10 > > when I use A[1,], I lost the rowname for it, like below. How co

Re: [R] how to keep row name if there is only one row selected from a data frame

2009-07-12 Thread Moshe Olshansky
Try A[1,,drop=FALSE] - see help("\[") --- On Mon, 13/7/09, Weiwei Shi wrote: > From: Weiwei Shi > Subject: [R] how to keep row name if there is only one row selected from a > data frame > To: "r-h...@stat.math.ethz.ch" > Received: Monday, 13 July, 2009,

[R] how to keep row name if there is only one row selected from a data frame

2009-07-12 Thread Weiwei Shi
Hi, there: Assume I have a dataframe with rownames like A with rownames like a to e, > A [,1] [,2] a16 b27 c38 d49 e5 10 when I use A[1,], I lost the rowname for it, like below. How could I keep it? Is there an easy way instead that I have to modify by mys