You need to create a data.frame in a different way is
all
Try this:
df1 <-
data.frame(rownames(affect),matrix(affect,nrow=3))
merge(age,df1, by.x=1, by.y=1)
--- "Boks, M.P.M." <[EMAIL PROTECTED]> wrote:
> Dear R-experts,
>
>
> I have got a dataframe:
> data
> ID disease
> V1 V2
> 1
Perhaps:
affect <- as.data.frame(do.call('rbind', tapply(data$V2, data$V1, table)))
merge(age, affect, by.x=1, by.y=0)
On 04/02/2008, Boks, M.P.M. <[EMAIL PROTECTED]> wrote:
> Dear R-experts,
>
>
> I have got a dataframe:
> data
> ID disease
> V1 V2
> 1 p1 1
> 2 p1 3
> 3 p3 3
> 4 p3 5
> 5
Dear R-experts,
I have got a dataframe:
data
ID disease
V1 V2
1 p1 1
2 p1 3
3 p3 3
4 p3 5
5 p5 1
>From which I extract a usefull table: affect
affect
1 3 5
p1 1 1 0
p3 0 1 1
p5 1 0 0
I want to merge this with anotherdataframe:
age
p1 23
p2 24
p3 23
p4 11
p5 45
3 matches
Mail list logo