Try this:
xtabs(value ~ row + column, d)[]
On 10/5/07, Chris Long <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm building a matrix m from a data frame d which includes the matrix row,
> column and value.
>
> This works well enough:
>
> m <- tapply(d[,"value"],d[,c("row","column")],c)
>
> However, I'
Hi,
I'm building a matrix m from a data frame d which includes the matrix row,
column and value.
This works well enough:
m <- tapply(d[,"value"],d[,c("row","column")],c)
However, I'd like to replace any missing values with 0, not NA. The
obvious doesn't work, however:
m <- tapply(d[,"value"],
2 matches
Mail list logo