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
Hello Everyone,
would you be able to assist with some expertise on how to get the following
done in a way that can be applied to a data set with different dimensions and
without all the line items here?
we have:
id<-c(1,1,1,2,2,2,2,3,3,4,4,4,4,5,5,5,5)#length of unique IDs may differ of
cours
5 matches
Mail list logo