[Rd] Creating data.frame from c-language

2013-08-10 Thread Boris Aronshtam
I need to create a data.frame from C-language and populate it. I Know how to 
create lists from C, but I cannot figure out how to create a data.frame. Does 
anyone have a sample code for creating a data.frame, setting column names, and 
populating it with data?

Thanks!


[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Creating data.frame from c-language

2013-08-10 Thread Prof Brian Ripley

On 09/08/2013 22:48, Boris Aronshtam wrote:

I need to create a data.frame from C-language and populate it. I Know how to 
create lists from C, but I cannot figure out how to create a data.frame. Does 
anyone have a sample code for creating a data.frame, setting column names, and 
populating it with data?


Use data.frame() via an eval() call from C.

Or see the code is stats/src/model.c, as part of model.frame.default 
(but I would only do that if speed were essential).


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] broken link in docs for Binormial functions

2013-08-10 Thread Sean O'Riordain
On the local documentation page for Binomial, i.e.
http://127.0.0.1:/library/stats/html/Binomial.html

The link to Catherine Loader's paper
"Catherine Loader (2000). *Fast and Accurate Computation of Binomial
Probabilities*; available from
http://www.herine.net/stat/software/dbinom.html.";

appears to be broken.

Kind regards,
Seán

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Creating data.frame from c-language

2013-08-10 Thread Dirk Eddelbuettel

On 10 August 2013 at 14:17, Prof Brian Ripley wrote:
| On 09/08/2013 22:48, Boris Aronshtam wrote:
| > I need to create a data.frame from C-language and populate it. I Know how 
to create lists from C, but I cannot figure out how to create a data.frame. 
Does anyone have a sample code for creating a data.frame, setting column names, 
and populating it with data?
| 
| Use data.frame() via an eval() call from C.
|
| Or see the code is stats/src/model.c, as part of model.frame.default 
| (but I would only do that if speed were essential).

Or if C++ is an option for you, below if a six-line Rcpp source example:

R> sourceCpp("/tmp/dataframe.cpp")   ## see the file below
R> set.seed(42);  getDataFrame(5)## set RNG seed, request a dataframe
  ab
1  1.370958 0.457742
2 -0.564698 0.719112
3  0.363128 0.934672
4  0.632863 0.255429
5  0.404268 0.462293
R> 
 
The source file used above follows below.

Dirk


#include 

using namespace Rcpp;

// [[Rcpp::export]]
DataFrame getDataFrame(int n) {
  NumericVector a = rnorm(n);
  NumericVector b = runif(n);
  return DataFrame::create(Named("a") = a,
   Named("b") = b);
}




-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] broken link in docs for Binormial functions

2013-08-10 Thread Prof Brian Ripley

On 10/08/2013 14:48, Sean O'Riordain wrote:

On the local documentation page for Binomial, i.e.
http://127.0.0.1:/library/stats/html/Binomial.html

The link to Catherine Loader's paper
"Catherine Loader (2000). *Fast and Accurate Computation of Binomial
Probabilities*; available from
http://www.herine.net/stat/software/dbinom.html.";

appears to be broken.


And what should it be replaced by?  (We've fixed this up at least once 
before.)


As Berners-Lee says, URIs should be permanent 



Kind regards,
Seán

[[alternative HTML version deleted]]



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] broken link in docs for Binormial functions

2013-08-10 Thread peter dalgaard

On Aug 10, 2013, at 20:11 , Prof Brian Ripley wrote:

> On 10/08/2013 14:48, Sean O'Riordain wrote:
>> On the local documentation page for Binomial, i.e.
>> http://127.0.0.1:/library/stats/html/Binomial.html
>> 
>> The link to Catherine Loader's paper
>> "Catherine Loader (2000). *Fast and Accurate Computation of Binomial
>> Probabilities*; available from
>> http://www.herine.net/stat/software/dbinom.html.";
>> 
>> appears to be broken.
> 
> And what should it be replaced by?  (We've fixed this up at least once 
> before.)
> 
> As Berners-Lee says, URIs should be permanent 

It can be dug up via Google Scholar fairly easily, but the link goes to an 
attachment to an Octave enhancement request!

Perhaps we should ask permission to nail the thing down somewhere on 
r-project.org?

-pd

(Berners-Lee et al. never foresaw the chaos created by the commercialization of 
the web, or indeed of other academic infrastructures. Try locating Catherine 
herself or even the stats department at CWRU to see what I mean.)

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] broken link in docs for Binormial functions

2013-08-10 Thread David Winsemius

On Aug 10, 2013, at 11:11 AM, Prof Brian Ripley wrote:

> On 10/08/2013 14:48, Sean O'Riordain wrote:
>> On the local documentation page for Binomial, i.e.
>> http://127.0.0.1:/library/stats/html/Binomial.html
>> 
>> The link to Catherine Loader's paper
>> "Catherine Loader (2000). *Fast and Accurate Computation of Binomial
>> Probabilities*; available from
>> http://www.herine.net/stat/software/dbinom.html.";
>> 
>> appears to be broken.
> 
> And what should it be replaced by?  (We've fixed this up at least once 
> before.)

A copy can be had at:

http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CC0QFjAA&url=http%3A%2F%2Fprojects.scipy.org%2Fscipy%2Fraw-attachment%2Fticket%2F620%2Floader2000Fast.pdf&ei=Q4cGUpuGA8qWyAHN6ICgAQ&usg=AFQjCNG2mDFe3iE0Xahyl0d6f2cazTKgFQ&sig2=Ghc7H91rILXLrBLlJjQTJA

Ugggh. Does anyone else hate the Google encoding that was adopted a couple of 
years ago?

http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf‎


> 
> As Berners-Lee says, URIs should be permanent 
> 
>> 
>> Kind regards,
>> Seán
>> 
>>  [[alternative HTML version deleted]]
>> 
>> 

-- 
David Winsemius
Alameda, CA, USA

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel