[datatable-help] Create matrix of columns from grouped rows
Eric Archer
Eric.Archer at noaa.gov
Wed Nov 23 20:20:22 CET 2016
Thanks! That's about 2-3x faster. I wasn't familiar with stack/unstack. Now
I have another tool.
Cheers,
e.
----
*Eric Archer, Ph.D.*
Southwest Fisheries Science Center (NMFS/NOAA)
8901 La Jolla Shores Drive
La Jolla, CA 92037 USA
858-546-7121 (work)
858-546-7003 (FAX)
Marine Mammal Genetics Group: swfsc.noaa.gov/mmtd-mmgenetics
GitHub: github/ericarcher
&
Adjunct Professor, Marine Biology
Scripps Institution of Oceanography
University of California, San Diego
http://profiles.ucsd.edu/frederick.archer
"
*The universe doesn't care what you believe. The wonderful thing about
science is that it doesn't ask for your faith, it just asks for your
eyes.*" - Randall Munroe
"*Lighthouses are more helpful than churches.*"
- Benjamin Franklin
"*...but I'll take a GPS over either one.*"
- John C. "Craig" George
On Wed, Nov 23, 2016 at 11:11 AM, nachti [via R] <
ml-node+s789695n4726778h3 at n4.nabble.com> wrote:
> Try this:
>
> t1 <- dt[, unlist(.SD), by = id]
> t(unstack(t1, form = V1 ~ id))
>
> (I think you get done with the colnames yourself ...)
>
> Cheers,
> ~g
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://r.789695.n4.nabble.com/Create-matrix-of-columns-from-grouped-rows-
> tp4726777p4726778.html
> To unsubscribe from Create matrix of columns from grouped rows, click here
> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4726777&code=RXJpYy5BcmNoZXJAbm9hYS5nb3Z8NDcyNjc3N3w5MjQwOTkzNjU=>
> .
> NAML
> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://r.789695.n4.nabble.com/Create-matrix-of-columns-from-grouped-rows-tp4726777p4726779.html
Sent from the datatable-help mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20161123/9d3e8de8/attachment.html>
More information about the datatable-help
mailing list