[R] Errors melt()ing data...
Neil Shephard
nshephard at gmail.com
Thu Feb 28 14:26:23 CET 2008
Hi Hadley,
On Thu, Feb 28, 2008 at 1:15 PM, hadley wickham <h.wickham at gmail.com> wrote:
>
> I think the problem is that reshape adds some extra information to the
> cast data.frame, but this info is no longer relevant when you've
> removed some of the columns. Try as.data.frame to strip off this
> extra info.
>
> t <- melt(subset(as.data.frame(t.norm1), select= c("Sample.Name",
> "SNP", "Pool", "polar.1", "polar.2")), id=c("Sample.Name", "SNP"))
>
Thats done the trick, thank you very much.
> (Also, can't you get to cast.height.norm1 directly from norm1 ?
> cast.height.norm1 <- cast(norm1, SNP ~ Sample.Name + variable, sum)
Yep, you can, but I need t.norm1 as an intermediate for deriving
polar.1 and polar.2 for each Sample.Name and SNP, although I wouldn't
be surprised if this can be done at the same time, as your reshape()
package is exceptionally flexible (and as you can probably tell, I'm
still climbing the R learning curve!).
In fact I think I shall sit down and work out how to do this!
Thanks for your help (again),
Neil
--
Email - nshephard at gmail.com / n.shephard at sheffield.ac.uk
More information about the R-help
mailing list