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
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
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
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
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
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
The easiest way is to just do something like this:
> mdat <- matrix(c(4,2,3, 11,12,13), nrow = 2, ncol=3)
> mdat
[,1] [,2] [,3]
[1,]43 12
[2,]2 11 13
> as.vector ( colSums ( mdat ) )
[1] 6 14 25
>
HTH
--
David
-Original Message-
From: r-help-boun...@r-project.o
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,
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
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
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
11 matches
Mail list logo