Thanks Bert this will do...
Andras
Sent from Yahoo Mail on Android
On Sun, Jan 6, 2019 at 1:09 PM, Bert Gunter wrote:
... and my reordering of column indices was unnecessary: merge(dat, d, all.y
= TRUE)will do.
Bert Gunter
"The trouble with having an open mind is that people keep comi
... and my reordering of column indices was unnecessary:
merge(dat, d, all.y = TRUE)
will do.
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Sun, Jan 6, 20
Like this (using base R only)?
dat<-data.frame(id=id,letter=letter,weight=weight) # using your data
ud <- unique(dat$id)
ul = unique(dat$letter)
d <- with(dat,
data.frame(
letter = rep(ul, e = length(ud)),
id = rep(ud, length(ul))
) )
merge(dat[,c(2,1,3)]
Hi!
Maybe this would do the trick:
--- snip ---
library(reshape2) # Use 'reshape2'
library(dplyr)# Use 'dplyr'
datatransfer<-data %>% mutate(letter2=letter) %>%
dcast(id+letter~letter2, value.var="weight")
--- snip ---
Or did I misunderstood something?
Best,
Kimmo
2019-01-06, 13:16
4 matches
Mail list logo