Hello,
Bert:
Quoting Jeff, "Val has been posting to this list for almost a decade". I
didn't know about the "decade" part (didn't look it up) but that's why I
answered the question.
Val:
It's not that hard to run the code you post *before* posting it. Please.
Rui Barradas
Às 23:10 de 07/0
Thank you Jeff and all. I wish to go back to my student life.
ID is not necessary in dat2, sorry for that.
On Sat, Sep 7, 2019 at 5:10 PM Jeff Newmiller wrote:
>
> Val has been posting to this list for almost a decade [1] so seems unlikely
> to be a student... but in all this time has yet t
Val has been posting to this list for almost a decade [1] so seems unlikely to
be a student... but in all this time has yet to figure out how to post in plain
text to avoid corruption of code on this plain text mailing list. The ability
to generate small examples has improved, though execution s
Hello,
The problem itself is simple:
i <- match(dat1$ID, dat2$ID)
colSums(t(dat1[i, -1])*dat2[i, -1])
#1 2 3
#24.58 35.59 17.10
But both dat1 and dat2 are wrong and can be read with read.csv
dat1 <- read.csv(text = "
ID , x, y, z
A, 10, 34, 12
B, 25, 42, 18
C, 14, 20, 8 ", st
dat1 is wrong also. It should read:
dat1 <-read.table(text="ID, x, y, z
A, 10, 34, 12
B, 25, 42, 18
C, 14, 20, 8 ",sep=",",header=TRUE,stringsAsFactors=F)
Is this a homework problem? This list has a no homework policy.
Cheers,
Bert
Bert
Hi all
Correction for my previous posting.
dat2 should be read as
dat2 <-read.table(text="ID, weight
A, 0.25
B, 0.42
C, 0.65 ",sep=",",header=TRUE,stringsAsFactors=F)
On Sat, Sep 7, 2019 at 1:46 PM Val wrote:
>
> Hi All,
>
> I have two data frames with thousand rows and several columns.
6 matches
Mail list logo