Re: [R] Dataframe help

2009-12-03 Thread Ramya
Thanks it worked!!! i was trying to use %in% and matching it. Ramya On Thu, Dec 3, 2009 at 2:06 PM, Peng Cai [via R] < ml-node+947950-541874...@n4.nabble.com > wrote: > Try this: > > both <- merge(left, right, by.x="column1", by.y="column1") > > left dataset > column1column2 > 121 1234

Re: [R] Dataframe help

2009-12-03 Thread Peng Cai
Try this: both <- merge(left, right, by.x="column1", by.y="column1") left dataset column1column2 121 12345 145 1675 167 2765 right datset column1 column3 121abc 345lmn 167efg HTH, Peng On Thu, Dec 3, 2009 at 2:47 PM, Ramya wrote: > > Hi there > > I

Re: [R] Dataframe help

2009-12-03 Thread David Winsemius
On Dec 3, 2009, at 2:47 PM, Ramya wrote: Hi there I have two dataframes Dataframe_1 column_1colum_2 121 12345 145 1675 167 2765 Dataframe_2 column_1 column2 121abc 345lmn 167efg I want a resulting dataframe 121 12345abc 167

[R] Dataframe help

2009-12-03 Thread Ramya
Hi there I have two dataframes Dataframe_1 column_1colum_2 121 12345 145 1675 167 2765 Dataframe_2 column_1 column2 121abc 345lmn 167efg I want a resulting dataframe 121 12345abc 167 2765 efg how do i go abt it Ramya -- V

Re: [R] DataFrame help

2009-07-17 Thread Uwe Ligges
Don MacQueen wrote: As others noted, you can use the built in function colSums, but you said you're writing your own. Given what you've got so far, that makes the issue one of structuring the output. Try csum <- function(m) { a = data.frame(m) s = lapply(a,sum) unlist(s) } lapp

Re: [R] DataFrame help

2009-07-16 Thread Don MacQueen
As others noted, you can use the built in function colSums, but you said you're writing your own. Given what you've got so far, that makes the issue one of structuring the output. Try csum <- function(m) { a = data.frame(m) s = lapply(a,sum) unlist(s) } lapply() return

Re: [R] DataFrame help

2009-07-16 Thread Jorge Ivan Velez
Dear voidobscura, Try either: colSums(mdat) # or apply(mdat, 2, sum) See ?colSums and ?apply for more details. HTH, Jorge On Thu, Jul 16, 2009 at 2:25 PM, voidobscura wrote: > > Alright, so I am trying to write my own function to calculate column sums > in > a matrix. I want the result a

Re: [R] DataFrame help

2009-07-16 Thread David Huffer
-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of voidobscura Sent: Thursday, July 16, 2009 2:26 PM To: r-help@r-project.org Subject: [R] DataFrame help Alright, so I am trying to write my own function to calculate column sums in a matrix. I want the result as a single list

[R] DataFrame help

2009-07-16 Thread voidobscura
Alright, so I am trying to write my own function to calculate column sums in a matrix. I want the result as a single list with the values. So far I have: csum<-function(m) { a = data.frame(m) s = lapply(a,sum) return(s) } What is the easiest way to have it return in a f

Re: [R] Dataframe help

2008-12-21 Thread Oliver Bandel
Rajasekaramya gmail.com> writes: > > > Hi there, > > I have a dataframe length.unique.info > > length.unique.info > abc 12 345 > def 16 550 > lmn 6 600 > I want those names that fall under the condition (length.unique.info[,2][i] > <=5 && length.unique.info[,3][i] >=500) [...] Hello,

Re: [R] dataframe help

2008-11-25 Thread David Winsemius
Not sure that solution properly focuses the unique function on the first column, and even when I tried to do so, my code using did not produce what I expected. The unique function does not return a logical vector. Try: ships[!duplicated(ships$type), ] And Rajasekaramya, please include code

Re: [R] dataframe help

2008-11-25 Thread stephen sefick
you will get more help if you provide code that can be copied and pasted into an R session. ?dput #untested to say the least foo[unique(foo),] On Mon, Nov 24, 2008 at 5:36 PM, Rajasekaramya <[EMAIL PROTECTED]> wrote: > > hi there > > I have a dataframe > > abc 123 345 > abc 345 456 > lmn 567 34

[R] dataframe help

2008-11-24 Thread Rajasekaramya
hi there I have a dataframe abc 123 345 abc 345 456 lmn 567 345 hkl 568 535 lmn 096 456 lmn 768 094 i want the uniques of column 1 and there corresponsing column 2 and 3 output abc 123 345 lmn 567 345 hkl 568 535 cbind(DF1[,1],DF1[which(unique(DF1[,1]),c(2,3)]) but didnt work kindly let m

Re: [R] Dataframe help

2008-11-05 Thread Erik Iverson
Hello - Rajasekaramya wrote: Hi there, I have a dataframe length.unique.info length.unique.info abc 12 345 def 16 550 lmn 6 600 Is this really the output when you print your data.frame? You may have column names for columns 1, 2, and 3? Is the first column a column of row.names, o

[R] Dataframe help

2008-11-05 Thread Rajasekaramya
Hi there, I have a dataframe length.unique.info > length.unique.info abc 12 345 def 16 550 lmn 6 600 I want those names that fall under the condition (length.unique.info[,2][i] <=5 && length.unique.info[,3][i] >=500) abcder<-length.unique.info[which(length.unique.info[,2][i] <=5 && length.