Generating data.tables from a j function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Generating data.tables from a j function

Farrel Buchinsky
I am relatively certain that data.table can handle a function in the J position that generates a data.frame or a data.table. However, how does one handle the output? Can you please point me to a url that discusses the capability?

For instance, I sometimes use the package dtables to generate descriptive statistics. It generates a table for 

So one could go

library(dtables)
dtable(dt)

But what if one wanted to get descriptive statistics by a trichotomous variable

dt[ , dtable(.SD), by=trichotomous.variable]

I am looking for a general article or blogpost about how to handle outputs that are not single numbers or two numbers. There are functions that yield data.tables or lists or specialized objects such a models. Any suggestions?

I know one can simply print the output to the console

dt[ , print(dtable(.SD)_, by=trichotomous.variable]  

But that does not let me do anything intelligent afterwards. 
--
Farrel Buchinsky
(412) 567-7870 (gets me everywhere)

_______________________________________________
datatable-help mailing list
[hidden email]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
Reply | Threaded
Open this post in threaded view
|

Re: Generating data.tables from a j function

Cook, Malcolm

 

Result.dt<-dt[ , list(sd.dtable=dtable(.SD)), by=trichotomous.variable]  # untested

 

will return a Result.dt with 2 columns: trichotomous.variable and sd.dtable

 

The value of Result.dt[1,sd.dtable][[1]] will give the 1st groups dtable results

 

~[hidden email]

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Farrel Buchinsky
Sent: Friday, October 20, 2017 1:14 PM
To: [hidden email]
Subject: [datatable-help] Generating data.tables from a j function

 

I am relatively certain that data.table can handle a function in the J position that generates a data.frame or a data.table. However, how does one handle the output? Can you please point me to a url that discusses the capability?

 

For instance, I sometimes use the package dtables to generate descriptive statistics. It generates a table for 

 

So one could go

 

library(dtables)

dtable(dt)

 

But what if one wanted to get descriptive statistics by a trichotomous variable

 

dt[ , dtable(.SD), by=trichotomous.variable]

 

I am looking for a general article or blogpost about how to handle outputs that are not single numbers or two numbers. There are functions that yield data.tables or lists or specialized objects such a models. Any suggestions?

 

I know one can simply print the output to the console

 

dt[ , print(dtable(.SD)_, by=trichotomous.variable]  

 

But that does not let me do anything intelligent afterwards. 

--

Farrel Buchinsky

(412) 567-7870 (gets me everywhere)


_______________________________________________
datatable-help mailing list
[hidden email]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
Reply | Threaded
Open this post in threaded view
|

Re: Generating data.tables from a j function

Farrel Buchinsky
Thank you. That did it. 
I would still like to read more. What does one call this? What are the correct buzzwords to search for. Do you know of any blog posts / articles?

On Fri, Oct 20, 2017 at 2:28 PM Cook, Malcolm <[hidden email]> wrote:

 

Result.dt<-dt[ , list(sd.dtable=dtable(.SD)), by=trichotomous.variable]  # untested

 

will return a Result.dt with 2 columns: trichotomous.variable and sd.dtable

 

The value of Result.dt[1,sd.dtable][[1]] will give the 1st groups dtable results

 

~[hidden email]

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Farrel Buchinsky
Sent: Friday, October 20, 2017 1:14 PM
To: [hidden email]
Subject: [datatable-help] Generating data.tables from a j function

 

I am relatively certain that data.table can handle a function in the J position that generates a data.frame or a data.table. However, how does one handle the output? Can you please point me to a url that discusses the capability?

 

For instance, I sometimes use the package dtables to generate descriptive statistics. It generates a table for 

 

So one could go

 

library(dtables)

dtable(dt)

 

But what if one wanted to get descriptive statistics by a trichotomous variable

 

dt[ , dtable(.SD), by=trichotomous.variable]

 

I am looking for a general article or blogpost about how to handle outputs that are not single numbers or two numbers. There are functions that yield data.tables or lists or specialized objects such a models. Any suggestions?

 

I know one can simply print the output to the console

 

dt[ , print(dtable(.SD)_, by=trichotomous.variable]  

 

But that does not let me do anything intelligent afterwards. 

--

Farrel Buchinsky

<a href="tel:(412)%20567-7870" value="+14125677870" target="_blank">(412) 567-7870 (gets me everywhere)

--
Farrel Buchinsky
(412) 567-7870 (gets me everywhere)

_______________________________________________
datatable-help mailing list
[hidden email]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
Reply | Threaded
Open this post in threaded view
|

Re: Generating data.tables from a j function

Cook, Malcolm

Hmm.  Good question.  Not sure where I learned this.  I use data.table allot for many years now.

 

Search https://cran.r-project.org/web/packages/data.table/vignettes/datatable-intro.html for “do in j”

 

Read https://rawgit.com/wiki/Rdatatable/data.table/vignettes/datatable-faq.html#im-using-c-in-j-and-getting-strange-results.

 

Then search the same document for ‘ j ‘ and selectively read what seems pertinent.

 

That should get you most of the way there.

 

~[hidden email]

 

From: Farrel Buchinsky [mailto:[hidden email]]
Sent: Friday, October 20, 2017 3:31 PM
To: Cook, Malcolm <[hidden email]>; [hidden email]
Subject: Re: [datatable-help] Generating data.tables from a j function

 

Thank you. That did it. 

I would still like to read more. What does one call this? What are the correct buzzwords to search for. Do you know of any blog posts / articles?

 

On Fri, Oct 20, 2017 at 2:28 PM Cook, Malcolm <[hidden email]> wrote:

 

Result.dt<-dt[ , list(sd.dtable=dtable(.SD)), by=trichotomous.variable]  # untested

 

will return a Result.dt with 2 columns: trichotomous.variable and sd.dtable

 

The value of Result.dt[1,sd.dtable][[1]] will give the 1st groups dtable results

 

~[hidden email]

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Farrel Buchinsky
Sent: Friday, October 20, 2017 1:14 PM
To: [hidden email]
Subject: [datatable-help] Generating data.tables from a j function

 

I am relatively certain that data.table can handle a function in the J position that generates a data.frame or a data.table. However, how does one handle the output? Can you please point me to a url that discusses the capability?

 

For instance, I sometimes use the package dtables to generate descriptive statistics. It generates a table for 

 

So one could go

 

library(dtables)

dtable(dt)

 

But what if one wanted to get descriptive statistics by a trichotomous variable

 

dt[ , dtable(.SD), by=trichotomous.variable]

 

I am looking for a general article or blogpost about how to handle outputs that are not single numbers or two numbers. There are functions that yield data.tables or lists or specialized objects such a models. Any suggestions?

 

I know one can simply print the output to the console

 

dt[ , print(dtable(.SD)_, by=trichotomous.variable]  

 

But that does not let me do anything intelligent afterwards. 

--

Farrel Buchinsky

<a href="tel:(412)%20567-7870" target="_blank">(412) 567-7870 (gets me everywhere)

--

Farrel Buchinsky

(412) 567-7870 (gets me everywhere)


_______________________________________________
datatable-help mailing list
[hidden email]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help