Quantcast

Avoiding print when using := ?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Avoiding print when using := ?

cybaea
Is there any way of tuning off the printing when using the :=
assignment? I have taken to writing code like

library("data.table")
DT <- data.table(idx = 1:10, key = "idx")
for (i in 1) { # Avoid default print
     DT[, v := runif(idx)]
}

just to avoid cluttering my screen. I could of course wrap it in
invisible() instead, though I am not sure that makes for much cleaner
code, or use

DT$v <- with(DT, runif(idx))

when adding new columns. But I thought := was clever and used an
overallocation trick, and I of course wanted to benefit from this.

Allan


_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

Steve Lianoglou-6
Hi,

On Thu, Sep 13, 2012 at 5:16 PM, Allan Engelhardt <[hidden email]> wrote:

> Is there any way of tuning off the printing when using the := assignment? I
> have taken to writing code like
>
> library("data.table")
> DT <- data.table(idx = 1:10, key = "idx")
> for (i in 1) { # Avoid default print
>     DT[, v := runif(idx)]
> }
>
> just to avoid cluttering my screen. I could of course wrap it in invisible()
> instead, though I am not sure that makes for much cleaner code, or use
>
> DT$v <- with(DT, runif(idx))
>
> when adding new columns. But I thought := was clever and used an
> overallocation trick, and I of course wanted to benefit from this.

This has come up in the past, see:

https://r-forge.r-project.org/tracker/index.php?func=detail&aid=2128&group_id=240&atid=978

Which also links you here for some ideas on how to get around it:

http://stackoverflow.com/questions/11359553/how-to-suppress-output-when-using-in-r-data-table

But, doesn't this only bite you when you are working interactively? If
the call to `:=` is inside a function or script, then the output won't
be printed, so ... does that mean you're writing these for() loops
during an interactive session? (¡ouch!).

For the interactive session, perhaps your easiest "fix" (for now) is
to reassign [, := ...] back to itself, or to a one-letter dummy var

HTH,
-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

cybaea
In reply to this post by cybaea
Ooops, I guess this is FAQ 2.22. But what is the preferred idiom for
those of us who want to avoid the print?

Allan

On 13/09/12 22:16, Allan Engelhardt wrote:

> Is there any way of tuning off the printing when using the :=
> assignment? I have taken to writing code like
>
> library("data.table")
> DT <- data.table(idx = 1:10, key = "idx")
> for (i in 1) { # Avoid default print
>     DT[, v := runif(idx)]
> }
>
> just to avoid cluttering my screen. I could of course wrap it in
> invisible() instead, though I am not sure that makes for much cleaner
> code, or use
>
> DT$v <- with(DT, runif(idx))
>
> when adding new columns. But I thought := was clever and used an
> overallocation trick, and I of course wanted to benefit from this.
>
> Allan
>
>
> _______________________________________________
> datatable-help mailing list
> [hidden email]
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help 
>

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

mbacou
In reply to this post by Steve Lianoglou-6
Just to echo Allan's request -- I think many of us data.table users do
work interactively at times, so the default `:=` print behavior can be a
problem with large tables.

What would be the cons of using a default print behavior for `:=` that
only prints top and last `n` rows as in data.table:::print.data.table ?

--Mel.

On 9/13/2012 5:41 PM, Steve Lianoglou wrote:

> Hi,
>
> On Thu, Sep 13, 2012 at 5:16 PM, Allan Engelhardt <[hidden email]> wrote:
>> Is there any way of tuning off the printing when using the := assignment? I
>> have taken to writing code like
>>
>> library("data.table")
>> DT <- data.table(idx = 1:10, key = "idx")
>> for (i in 1) { # Avoid default print
>>      DT[, v := runif(idx)]
>> }
>>
>> just to avoid cluttering my screen. I could of course wrap it in invisible()
>> instead, though I am not sure that makes for much cleaner code, or use
>>
>> DT$v <- with(DT, runif(idx))
>>
>> when adding new columns. But I thought := was clever and used an
>> overallocation trick, and I of course wanted to benefit from this.
> This has come up in the past, see:
>
> https://r-forge.r-project.org/tracker/index.php?func=detail&aid=2128&group_id=240&atid=978
>
> Which also links you here for some ideas on how to get around it:
>
> http://stackoverflow.com/questions/11359553/how-to-suppress-output-when-using-in-r-data-table
>
> But, doesn't this only bite you when you are working interactively? If
> the call to `:=` is inside a function or script, then the output won't
> be printed, so ... does that mean you're writing these for() loops
> during an interactive session? (¡ouch!).
>
> For the interactive session, perhaps your easiest "fix" (for now) is
> to reassign [, := ...] back to itself, or to a one-letter dummy var
>
> HTH,
> -steve
_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

Steve Lianoglou-6
Hi,

On Thu, Sep 13, 2012 at 6:15 PM, Bacou, Melanie <[hidden email]> wrote:
> Just to echo Allan's request -- I think many of us data.table users do work
> interactively at times, so the default `:=` print behavior can be a problem
> with large tables.
>
> What would be the cons of using a default print behavior for `:=` that only
> prints top and last `n` rows as in data.table:::print.data.table ?

It already does this:

R> library(data.table)
R> dt = data.table(a=rnorm(200), b=sample(letters, 200, rep=T))
R> dt[, y := runif(200)]

              a b         y
  1:  0.1486739 m 0.4442021
  2: -1.2787850 y 0.9538030
  3: -1.6507274 y 0.3171195
  4: -0.1445559 d 0.2074747
  5:  0.9884454 m 0.3392145
 ---
196:  1.0310931 i 0.7000658
197:  1.4269618 k 0.4968695
198:  1.0283900 s 0.7806085
199: -0.6082233 v 0.3105555
200:  0.8320824 q 0.7372878

The `---` cutting kicks in if the nrow(data.table) > 100, (see the
`nrows` param in data.table:::print.data.table).

Perhaps the `nrows` param in print.data.table should be user
configurable by some `option`, maybe something like:

print.data.table <- function(x,
nrows=getOption('datatable.print.nrows', 100), ...) { ... }

Then you could `options(datatable.print.nrows=20)` if 100 is too high ...

Maybe?

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

cybaea
On 13/09/12 23:42, Steve Lianoglou wrote:

> Perhaps the `nrows` param in print.data.table should be user
> configurable by some `option`, maybe something like:
>
> print.data.table <- function(x,
> nrows=getOption('datatable.print.nrows', 100), ...) { ... }
>
> Then you could `options(datatable.print.nrows=20)` if 100 is too high ...
>
> Maybe?
>
> -steve

I really like this suggestion. You could perhaps even set it to 0
temporarily while you were doing lots of := work. Do you want to raise a
feature request Steve?

Allan

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

cybaea
In reply to this post by Steve Lianoglou-6

On 13/09/12 22:41, Steve Lianoglou wrote:
> But, doesn't this only bite you when you are working interactively? If
> the call to `:=` is inside a function or script, then the output won't
> be printed, so ... does that mean you're writing these for() loops
> during an interactive session? (¡ouch!).

Yes and yes. I am writing training material which I will show
(interactively) during class. The printout from := clutters the R
session so I need to get rid of it.

Allan

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

Steve Lianoglou-6
In reply to this post by cybaea
Hi,

On Fri, Sep 14, 2012 at 1:56 AM, Allan Engelhardt (CYBAEA)
<[hidden email]> wrote:

> On 13/09/12 23:42, Steve Lianoglou wrote:
>>
>> Perhaps the `nrows` param in print.data.table should be user
>> configurable by some `option`, maybe something like:
>>
>> print.data.table <- function(x,
>> nrows=getOption('datatable.print.nrows', 100), ...) { ... }
>>
>> Then you could `options(datatable.print.nrows=20)` if 100 is too high ...
>>
>> Maybe?
>>
>> -steve
>
>
> I really like this suggestion. You could perhaps even set it to 0
> temporarily while you were doing lots of := work. Do you want to raise a
> feature request Steve?

I just committed code to SVN to support this. In short there are two
new `options` one can set to customize the amount of a data.table
summariazed to the console (these can always be sidestepped by calling
`print(dt)` directly).

The options are:

* datatable.print.nrows : When the data.table has more than this
number (defaults to 100) the `---` summary stuff is triggered. If this
is set to 0, no data.table will be printed to the console unless you
call `print(your.data.table, ...)`

* datatable.print.topn : When a summary is triggered during printing,
this number show the top and bottom `topn` rows (defaults to 10)

FAQs 2.11 and 2.22 to show you how you might use it, but in short:

R> library(data.table)
R> dt = data.table(a=letters[1:10], b=rnorm(10))
R> options(datatable.print.nrows=8)
R> dt
    a          b
 1: a -1.1423662
 2: b  0.2878413
---
 9: i -0.1247109
10: j -0.6932983

R> dt[, something := rnorm(10)]
    a          b    something
 1: a -1.1423662  0.700697859
 2: b  0.2878413 -0.007995077
---
 9: i -0.1247109  0.060807862
10: j -0.6932983 -0.796266433

R> options(datatable.print.nrows=0)
R> dt[, another := runif(10)]
R> print(dt, 100)
    a          b    something   another
 1: a -1.1423662  0.700697859 0.3831220
 2: b  0.2878413 -0.007995077 0.3894803
 3: c -0.9657560 -0.511566173 0.1208057
 4: d -0.1065197  0.685830341 0.2878074
 5: e -0.7630674 -0.161960447 0.3378524
 6: f -1.1561141  0.464995932 0.2487832
 7: g  0.2408447 -0.175998144 0.8600236
 8: h -0.4386328  1.002378381 0.7682450
 9: i -0.1247109  0.060807862 0.1635926
10: j -0.6932983 -0.796266433 0.4739380

The caveat is that I didn't check in with Matthew to see if he's OK
with this, so unless he objects ... there it is. It is in SVN now (at
r-forge), and you can grab it from there and install. If you aren't
setup to do that, you will have to wait for 1.8.3 to release.

The other thing is that this really doesn't address the `:=` printing
behavior specifically, so not sure how helpful this is in the long run
unless you don't mind calling `print` to view things explicitly.

HTH,
-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

Steve Lianoglou-6
While taking my dog for a walk, though, I was wondering if we couldn't
hijack the `history` mechanism in the `print.data.table` function to
do this "better".

We might first check `if (interactive())`, then see if the last call
involved `:=`, in which case we could just silence the print ... just
a thought.

-steve

On Fri, Sep 14, 2012 at 7:22 AM, Steve Lianoglou
<[hidden email]> wrote:

> Hi,
>
> On Fri, Sep 14, 2012 at 1:56 AM, Allan Engelhardt (CYBAEA)
> <[hidden email]> wrote:
>> On 13/09/12 23:42, Steve Lianoglou wrote:
>>>
>>> Perhaps the `nrows` param in print.data.table should be user
>>> configurable by some `option`, maybe something like:
>>>
>>> print.data.table <- function(x,
>>> nrows=getOption('datatable.print.nrows', 100), ...) { ... }
>>>
>>> Then you could `options(datatable.print.nrows=20)` if 100 is too high ...
>>>
>>> Maybe?
>>>
>>> -steve
>>
>>
>> I really like this suggestion. You could perhaps even set it to 0
>> temporarily while you were doing lots of := work. Do you want to raise a
>> feature request Steve?
>
> I just committed code to SVN to support this. In short there are two
> new `options` one can set to customize the amount of a data.table
> summariazed to the console (these can always be sidestepped by calling
> `print(dt)` directly).
>
> The options are:
>
> * datatable.print.nrows : When the data.table has more than this
> number (defaults to 100) the `---` summary stuff is triggered. If this
> is set to 0, no data.table will be printed to the console unless you
> call `print(your.data.table, ...)`
>
> * datatable.print.topn : When a summary is triggered during printing,
> this number show the top and bottom `topn` rows (defaults to 10)
>
> FAQs 2.11 and 2.22 to show you how you might use it, but in short:
>
> R> library(data.table)
> R> dt = data.table(a=letters[1:10], b=rnorm(10))
> R> options(datatable.print.nrows=8)
> R> dt
>     a          b
>  1: a -1.1423662
>  2: b  0.2878413
> ---
>  9: i -0.1247109
> 10: j -0.6932983
>
> R> dt[, something := rnorm(10)]
>     a          b    something
>  1: a -1.1423662  0.700697859
>  2: b  0.2878413 -0.007995077
> ---
>  9: i -0.1247109  0.060807862
> 10: j -0.6932983 -0.796266433
>
> R> options(datatable.print.nrows=0)
> R> dt[, another := runif(10)]
> R> print(dt, 100)
>     a          b    something   another
>  1: a -1.1423662  0.700697859 0.3831220
>  2: b  0.2878413 -0.007995077 0.3894803
>  3: c -0.9657560 -0.511566173 0.1208057
>  4: d -0.1065197  0.685830341 0.2878074
>  5: e -0.7630674 -0.161960447 0.3378524
>  6: f -1.1561141  0.464995932 0.2487832
>  7: g  0.2408447 -0.175998144 0.8600236
>  8: h -0.4386328  1.002378381 0.7682450
>  9: i -0.1247109  0.060807862 0.1635926
> 10: j -0.6932983 -0.796266433 0.4739380
>
> The caveat is that I didn't check in with Matthew to see if he's OK
> with this, so unless he objects ... there it is. It is in SVN now (at
> r-forge), and you can grab it from there and install. If you aren't
> setup to do that, you will have to wait for 1.8.3 to release.
>
> The other thing is that this really doesn't address the `:=` printing
> behavior specifically, so not sure how helpful this is in the long run
> unless you don't mind calling `print` to view things explicitly.
>
> HTH,
> -steve
>
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact



--
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

cybaea
In reply to this post by Steve Lianoglou-6

On 14/09/12 12:22, Steve Lianoglou wrote:

> Hi,
>
> On Fri, Sep 14, 2012 at 1:56 AM, Allan Engelhardt (CYBAEA)
> <[hidden email]> wrote:
>> On 13/09/12 23:42, Steve Lianoglou wrote:
>>> Perhaps the `nrows` param in print.data.table should be user
>>> configurable by some `option`, maybe something like:
>>>
>>> print.data.table <- function(x,
>>> nrows=getOption('datatable.print.nrows', 100), ...) { ... }
>>>
>>> Then you could `options(datatable.print.nrows=20)` if 100 is too high ...
>>>
>>> Maybe?
>>>
>>> -steve
>>
>> I really like this suggestion. You could perhaps even set it to 0
>> temporarily while you were doing lots of := work. Do you want to raise a
>> feature request Steve?
> I just committed code to SVN to support this.

Thanks! I look forward to this one making its way to the released versions.

> The other thing is that this really doesn't address the `:=` printing
> behavior specifically, so not sure how helpful this is in the long run
> unless you don't mind calling `print` to view things explicitly.

I love calling print [1] so this one works for me. Thanks again.

Allan

[1] No, really: I do! There are too many side effects in R as it is, so
for training I like to be explicit. Also I find that a lot of students
have never heard of the print() function which is kind of a shame....
_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

Matthew Dowle
In reply to this post by Steve Lianoglou-6

Hi Steve,

Your commits are fantastic! Yes just feel free to go ahead and make
progress, no need to check with me first.

On `history` and `interactive()`, yes great idea. I had been trying to
suppress the print method from being called after a :=, but couldn't do it
for the reasons in faq 2.22 as you know. Letting the print method run but
switching inside it hadn't crossed my mind.

How about setting an internal global "noprint" flag in :=, so the print
method still runs afterwards but does nothing when noprint is on (other
than than set it back to off). Problem with that is that the print method
might not run (e.g. when := is inside a function) which could mean the
next time you type "DT" at the prompt, or even "print(DT)" nothing happens
and you have to type it again. Which isn't desirable. Is there a way to
know inside := inside [.data.table _if_ the output will be printed?  If
the parent.env() is .GlobalEnv, or something perhaps? Then only if it is
would := set the noprint flag on.

Or yes the `history()` way sounds cleaner than having a global flag. Then
it would self contained within print.data.table.

Matthew



> While taking my dog for a walk, though, I was wondering if we couldn't
> hijack the `history` mechanism in the `print.data.table` function to
> do this "better".
>
> We might first check `if (interactive())`, then see if the last call
> involved `:=`, in which case we could just silence the print ... just
> a thought.
>
> -steve
>
> On Fri, Sep 14, 2012 at 7:22 AM, Steve Lianoglou
> <[hidden email]> wrote:
>> Hi,
>>
>> On Fri, Sep 14, 2012 at 1:56 AM, Allan Engelhardt (CYBAEA)
>> <[hidden email]> wrote:
>>> On 13/09/12 23:42, Steve Lianoglou wrote:
>>>>
>>>> Perhaps the `nrows` param in print.data.table should be user
>>>> configurable by some `option`, maybe something like:
>>>>
>>>> print.data.table <- function(x,
>>>> nrows=getOption('datatable.print.nrows', 100), ...) { ... }
>>>>
>>>> Then you could `options(datatable.print.nrows=20)` if 100 is too high
>>>> ...
>>>>
>>>> Maybe?
>>>>
>>>> -steve
>>>
>>>
>>> I really like this suggestion. You could perhaps even set it to 0
>>> temporarily while you were doing lots of := work. Do you want to raise
>>> a
>>> feature request Steve?
>>
>> I just committed code to SVN to support this. In short there are two
>> new `options` one can set to customize the amount of a data.table
>> summariazed to the console (these can always be sidestepped by calling
>> `print(dt)` directly).
>>
>> The options are:
>>
>> * datatable.print.nrows : When the data.table has more than this
>> number (defaults to 100) the `---` summary stuff is triggered. If this
>> is set to 0, no data.table will be printed to the console unless you
>> call `print(your.data.table, ...)`
>>
>> * datatable.print.topn : When a summary is triggered during printing,
>> this number show the top and bottom `topn` rows (defaults to 10)
>>
>> FAQs 2.11 and 2.22 to show you how you might use it, but in short:
>>
>> R> library(data.table)
>> R> dt = data.table(a=letters[1:10], b=rnorm(10))
>> R> options(datatable.print.nrows=8)
>> R> dt
>>     a          b
>>  1: a -1.1423662
>>  2: b  0.2878413
>> ---
>>  9: i -0.1247109
>> 10: j -0.6932983
>>
>> R> dt[, something := rnorm(10)]
>>     a          b    something
>>  1: a -1.1423662  0.700697859
>>  2: b  0.2878413 -0.007995077
>> ---
>>  9: i -0.1247109  0.060807862
>> 10: j -0.6932983 -0.796266433
>>
>> R> options(datatable.print.nrows=0)
>> R> dt[, another := runif(10)]
>> R> print(dt, 100)
>>     a          b    something   another
>>  1: a -1.1423662  0.700697859 0.3831220
>>  2: b  0.2878413 -0.007995077 0.3894803
>>  3: c -0.9657560 -0.511566173 0.1208057
>>  4: d -0.1065197  0.685830341 0.2878074
>>  5: e -0.7630674 -0.161960447 0.3378524
>>  6: f -1.1561141  0.464995932 0.2487832
>>  7: g  0.2408447 -0.175998144 0.8600236
>>  8: h -0.4386328  1.002378381 0.7682450
>>  9: i -0.1247109  0.060807862 0.1635926
>> 10: j -0.6932983 -0.796266433 0.4739380
>>
>> The caveat is that I didn't check in with Matthew to see if he's OK
>> with this, so unless he objects ... there it is. It is in SVN now (at
>> r-forge), and you can grab it from there and install. If you aren't
>> setup to do that, you will have to wait for 1.8.3 to release.
>>
>> The other thing is that this really doesn't address the `:=` printing
>> behavior specifically, so not sure how helpful this is in the long run
>> unless you don't mind calling `print` to view things explicitly.
>>
>> HTH,
>> -steve
>>
>> --
>> Steve Lianoglou
>> Graduate Student: Computational Systems Biology
>>  | Memorial Sloan-Kettering Cancer Center
>>  | Weill Medical College of Cornell University
>> Contact Info: http://cbio.mskcc.org/~lianos/contact
>
>
>
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
> _______________________________________________
> datatable-help mailing list
> [hidden email]
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>


_______________________________________________
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
|  
Report Content as Inappropriate

Re: Avoiding print when using := ?

Steve Lianoglou-6
Howdy folks,

On Fri, Sep 14, 2012 at 8:33 AM, Matthew Dowle <[hidden email]> wrote:
>
> Hi Steve,
>
> Your commits are fantastic!

Thanks :-)

> Yes just feel free to go ahead and make
> progress, no need to check with me first.

> On `history` and `interactive()`, yes great idea.

I actually committed a first (likely too simple) hack at this to SVN .. witness:

R> library(data.table)
R> dt <- data.table(a=letters[1:5], score=rnorm(5))
R> dt
   a      score
1: a -0.7509320
2: b  0.9898114
3: c  0.2222932
4: d -0.8143132
5: e -0.9038881

R> dt[, zz := runif(5)]   ## ... crickets ...
R> dt
   a      score        zz
1: a -0.7509320 0.7769256
2: b  0.9898114 0.3341632
3: c  0.2222932 0.1541943
4: d -0.8143132 0.7989931
5: e -0.9038881 0.1405818

One downside is that as your R session gets long in the tooth, calling
history() becomes more onerous since `history` is implemented by
writing all of the history to a temp file, then reading the entire
file, then just picking off the last line ... I think the length of
the history that's saved is stored in `R_HISTSIZE` (see ?history) and
defaults to 512, so .. maybe not so terrible? ... or ... ?

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
_______________________________________________
datatable-help mailing list
[hidden email]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
Loading...