[Rd] make.packages.html

2009-11-17 Thread Gabor Grothendieck
In R version 2.10.0 Patched (2009-11-15 r50445) on Windows Vista
upon issuing help.start() and clicking on Packages I get this.

Packages in C:\Users\Gabor\Documents\R\win-library\2.10

C:\Users\Gabor\Documents/R/win-library/2.10/AER/DESCRIPTION -- Title
is missing --
C:\Users\Gabor\Documents/R/win-library/2.10/akima/DESCRIPTION -- Title
is missing --
C:\Users\Gabor\Documents/R/win-library/2.10/car/DESCRIPTION -- Title
is missing --
C:\Users\Gabor\Documents/R/win-library/2.10/caroline/DESCRIPTION --
Title is missing --
...

Looking at make.packages.html in utils, this code:

for (lib in lib.loc) {
pg - Sys.glob(file.path(lib, *, DESCRIPTION))
pkgs[[lib]] - sort(sub(paste(lib, ([^/]*), DESCRIPTION$,
sep = /), \\1, pg))
}

has the problem that lib can contain regular expression characters but
is used in the pattern of sub.  This could be changed to the following
which does not use lib in any pattern. Only the pkgs[[lib]]-
statement is changed relative to the original:

for (lib in lib.loc) {
pg - Sys.glob(file.path(lib, *, DESCRIPTION))
pkgs[[lib]] - sort(sub(.*[\\/], , sub(.DESCRIPTION$, , pg)))
}

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


Re: [Rd] make.packages.html

2009-11-17 Thread Duncan Murdoch

On 17/11/2009 5:33 AM, Gabor Grothendieck wrote:

In R version 2.10.0 Patched (2009-11-15 r50445) on Windows Vista
upon issuing help.start() and clicking on Packages I get this.

Packages in C:\Users\Gabor\Documents\R\win-library\2.10

C:\Users\Gabor\Documents/R/win-library/2.10/AER/DESCRIPTION -- Title
is missing --
C:\Users\Gabor\Documents/R/win-library/2.10/akima/DESCRIPTION -- Title
is missing --
C:\Users\Gabor\Documents/R/win-library/2.10/car/DESCRIPTION -- Title
is missing --
C:\Users\Gabor\Documents/R/win-library/2.10/caroline/DESCRIPTION --
Title is missing --
...

Looking at make.packages.html in utils, this code:

for (lib in lib.loc) {
pg - Sys.glob(file.path(lib, *, DESCRIPTION))
pkgs[[lib]] - sort(sub(paste(lib, ([^/]*), DESCRIPTION$,
sep = /), \\1, pg))
}

has the problem that lib can contain regular expression characters but
is used in the pattern of sub.  This could be changed to the following
which does not use lib in any pattern. Only the pkgs[[lib]]-
statement is changed relative to the original:

for (lib in lib.loc) {
pg - Sys.glob(file.path(lib, *, DESCRIPTION))
pkgs[[lib]] - sort(sub(.*[\\/], , sub(.DESCRIPTION$, , pg)))
}


Thanks, I'll take a look.

Duncan Murdoch

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


Re: [Rd] make.packages.html

2009-11-17 Thread Duncan Murdoch

On 17/11/2009 5:33 AM, Gabor Grothendieck wrote:

In R version 2.10.0 Patched (2009-11-15 r50445) on Windows Vista
upon issuing help.start() and clicking on Packages I get this.

Packages in C:\Users\Gabor\Documents\R\win-library\2.10

C:\Users\Gabor\Documents/R/win-library/2.10/AER/DESCRIPTION -- Title
is missing --
C:\Users\Gabor\Documents/R/win-library/2.10/akima/DESCRIPTION -- Title
is missing --
C:\Users\Gabor\Documents/R/win-library/2.10/car/DESCRIPTION -- Title
is missing --
C:\Users\Gabor\Documents/R/win-library/2.10/caroline/DESCRIPTION --
Title is missing --
...

Looking at make.packages.html in utils, this code:

for (lib in lib.loc) {
pg - Sys.glob(file.path(lib, *, DESCRIPTION))
pkgs[[lib]] - sort(sub(paste(lib, ([^/]*), DESCRIPTION$,
sep = /), \\1, pg))
}

has the problem that lib can contain regular expression characters but
is used in the pattern of sub.  This could be changed to the following
which does not use lib in any pattern. Only the pkgs[[lib]]-
statement is changed relative to the original:

for (lib in lib.loc) {
pg - Sys.glob(file.path(lib, *, DESCRIPTION))
pkgs[[lib]] - sort(sub(.*[\\/], , sub(.DESCRIPTION$, , pg)))
}


I've committed your patch to R-devel and R-patched now.  Thanks!

Duncan Murdoch

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


Re: [Rd] How to generate dependency file that can be used by gnu make?

2009-11-17 Thread Peng Yu
This may not easy to do, when the filename are not hard coded strings.
For example, the variable 'filename' is a vector of strings.

for (i in 1:length(filename)){
do something...
save(,file=filename[i])
}

On Mon, Nov 16, 2009 at 11:33 PM, Linlin Yan yanlinli...@gmail.com wrote:
 I don't think this function is same as gcc's option -MM. Because gcc
 checks pre-compile command #include, in which the filename can be
 fetched definitely. But in your scenario, the filename may be from
 some variables, which can not be determined by the R script only.
 Maybe you can write a tool by yourself to parse the R syntax to
 resolve your problem.

 On Tue, Nov 17, 2009 at 11:51 AM, Peng Yu pengyu...@gmail.com wrote:
 On Sun, Nov 15, 2009 at 8:45 PM, Peng Yu pengyu...@gmail.com wrote:
 gcc has options like -MM, which can generate the dependence files for
 a C/C++ file that I can be used by gnu make. I'm wondering if there is
 a tool that can generate dependence file for an R script.

 For example, I have an R script test.R

 #test.R
 load('input.RData')
 save.image('output.RData')


 I want to generate a dependence file like the following. Is there a
 tool to do so?

 output.RData:test.R input.RData

 Is there a way to automatically generate the output files that depends
 on an R script and the input files and sourced files that are depended
 by an R script? I don't see this option in R. But I wish this can be
 implemented in future version of R.

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



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


Re: [Rd] How to generate dependency file that can be used by gnu make?

2009-11-17 Thread Seth Falcon

On 11/17/09 5:02 AM, Peng Yu wrote:

This may not easy to do, when the filename are not hard coded strings.
For example, the variable 'filename' is a vector of strings.

for (i in 1:length(filename)){
do something...
save(,file=filename[i])
}



That's right.  I don't think there is a feasible general solution.  You 
might have more success with a convention-based approach for your 
scripts that would allow a simple parser to identify output files by 
name convention, for example.


+ seth

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


[Rd] Codoc mismatches

2009-11-17 Thread Hadley Wickham
I have a function:

source_dir - function(path, pattern = \\.[rR]$, chdir = TRUE) ...

documented with

...
\usage{source_dir(path, pattern=\\.[rR]$, chdir=TRUE)}
...

But I get

Codoc mismatches from documentation object 'source_dir':
source_dir
  Code: function(path, pattern = \\.[rR]$, chdir = TRUE)
  Docs: function(path, pattern = \.[rR]$, chdir = TRUE)
  Mismatches in argument default values:
Name: 'pattern' Code: \\.[rR]$ Docs: \.[rR]$


Is this a bug, or do I need

\usage{source_dir(path, pattern=.[rR]$, chdir=TRUE)}

?

Hadley

-- 
http://had.co.nz/

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


Re: [Rd] R crash with intToUtf8 on huge vectors (PR#14068)

2009-11-17 Thread Duncan Murdoch

On 11/16/2009 8:10 AM, g.russ...@eos-solutions.com wrote:

Full_Name: George Russell
Version: 2.10.0
OS: Windows XP Professional Version 2002 Service Pack 2
Submission from: (NULL) (217.111.3.131)


Typing the following command into R --vanilla causes R to crash:

k - intToUtf8(rep(1e3,1e7))



Brian Ripley has tracked this one down and a fix should appear shortly. 
   The intToUtf8 code was written for reasonably small conversions, and 
it overflowed the stack when it tried to produce a 20 megabyte string there.


Do you have a real application that works with such large strings?

Duncan Murdoch


This is the output of sessionInfo():
R version 2.10.0 (2009-10-26) 
i386-pc-mingw32 


locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C   
[5] LC_TIME=German_Germany.1252


attached base packages:
[1] stats graphics  grDevices datasets  utils methods   base 


other attached packages:
[1] RODBC_1.3-1

Many thanks for your help and best wishes,

George Russell

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


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


Re: [Rd] R crash with intToUtf8 on huge vectors (PR#14068)

2009-11-17 Thread Prof Brian Ripley
Basically you have exceeded a resource limit, and Windows has not 
handled that gracefully (other OSes do in your example).  You are 
trying to create a single 20Mb string and no one envisaged anyone 
wanting to do that (nor that Windows would not fail gracefully, 
although generically that comes as no real surprise)).


We'll change the method to cope with very large strings (more slowly), 
but perhaps you could explain the real-world problem that needs 20Mb

strings to be produced from integer representations of Unicode points?

On Mon, 16 Nov 2009, g.russ...@eos-solutions.com wrote:


Full_Name: George Russell
Version: 2.10.0
OS: Windows XP Professional Version 2002 Service Pack 2
Submission from: (NULL) (217.111.3.131)


Typing the following command into R --vanilla causes R to crash:

k - intToUtf8(rep(1e3,1e7))

This is the output of sessionInfo():
R version 2.10.0 (2009-10-26)
i386-pc-mingw32

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252

attached base packages:
[1] stats graphics  grDevices datasets  utils methods   base

other attached packages:
[1] RODBC_1.3-1

Many thanks for your help and best wishes,

George Russell

__
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] make.packages.html

2009-11-17 Thread William Dunlap

 -Original Message-
 From: r-devel-boun...@r-project.org 
 [mailto:r-devel-boun...@r-project.org] On Behalf Of Duncan Murdoch
 Sent: Tuesday, November 17, 2009 2:50 AM
 To: Gabor Grothendieck
 Cc: r-devel@r-project.org
 Subject: Re: [Rd] make.packages.html
 
 On 17/11/2009 5:33 AM, Gabor Grothendieck wrote:
  In R version 2.10.0 Patched (2009-11-15 r50445) on Windows Vista
  upon issuing help.start() and clicking on Packages I get this.
  
  Packages in C:\Users\Gabor\Documents\R\win-library\2.10
  
  C:\Users\Gabor\Documents/R/win-library/2.10/AER/DESCRIPTION -- Title
  is missing --
  
 C:\Users\Gabor\Documents/R/win-library/2.10/akima/DESCRIPTION -- Title
  is missing --
  C:\Users\Gabor\Documents/R/win-library/2.10/car/DESCRIPTION -- Title
  is missing --
  C:\Users\Gabor\Documents/R/win-library/2.10/caroline/DESCRIPTION --
  Title is missing --
  ...
  
  Looking at make.packages.html in utils, this code:
  
  for (lib in lib.loc) {
  pg - Sys.glob(file.path(lib, *, DESCRIPTION))
  pkgs[[lib]] - sort(sub(paste(lib, ([^/]*), 
 DESCRIPTION$,
  sep = /), \\1, pg))
  }
  
  has the problem that lib can contain regular expression 
 characters but
  is used in the pattern of sub.  This could be changed to 
 the following
  which does not use lib in any pattern. Only the pkgs[[lib]]-
  statement is changed relative to the original:
  
  for (lib in lib.loc) {
  pg - Sys.glob(file.path(lib, *, DESCRIPTION))
  pkgs[[lib]] - sort(sub(.*[\\/], , 
 sub(.DESCRIPTION$, , pg)))
  }
 
 Thanks, I'll take a look.

Hadley Wickham asked last week about a function that escaped
all the regular-expression special characters in a
string, so one could use gsub with fixed=TRUE,
and I suggested

   asFixedRegex - function(pattern) {
  gsub(([][^${}().?*+|\\]), \\1, pattern)
   }

(I left out the | in the original mail).  asFixedRegex()
could be used to fix this problem by changing 'lib' to
'asFixedRegex(lib)' in the offending call to sub
  sub(paste(asFixedRegex(lib), ([^/]*), DESCRIPTION$, sep = /),
 \\1, pg)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

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

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


Re: [Rd] Codoc mismatches

2009-11-17 Thread Yihui Xie
You need . See R-exts 2.14.2. It also confused me the other day.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA



On Tue, Nov 17, 2009 at 9:26 AM, Hadley Wickham had...@rice.edu wrote:
 I have a function:

 source_dir - function(path, pattern = \\.[rR]$, chdir = TRUE) ...

 documented with

 ...
 \usage{source_dir(path, pattern=\\.[rR]$, chdir=TRUE)}
 ...

 But I get

 Codoc mismatches from documentation object 'source_dir':
 source_dir
  Code: function(path, pattern = \\.[rR]$, chdir = TRUE)
  Docs: function(path, pattern = \.[rR]$, chdir = TRUE)
  Mismatches in argument default values:
    Name: 'pattern' Code: \\.[rR]$ Docs: \.[rR]$


 Is this a bug, or do I need

 \usage{source_dir(path, pattern=.[rR]$, chdir=TRUE)}

 ?

 Hadley

 --
 http://had.co.nz/

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


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


[Rd] R_NilValue and segfault.

2009-11-17 Thread Guillaume Yziquel

Hello.

I've been trying to wrap up the R_NilValue into OCaml-R. I nevertheless 
get a segfault.


As I gathered, R_NilValue is declared in Rinternals.h:


/* Special Values */
LibExtern SEXP  R_NilValue; /* The nil object */
LibExtern SEXP  R_UnboundValue; /* Unbound marker */
LibExtern SEXP  R_MissingArg;   /* Missing argument marker */


So, in my r_data.c file, I have:

-1- an #include directive.


#include Rinternals.h


-2- the function wrapping R data in OCaml data


CAMLprim value Val_sexp (SEXP sexp)
{
  CAMLparam0();
  CAMLlocal1(result);
  result = caml_alloc(1, Abstract_tag);
  Field(result, 0) = (value) sexp;
/* Do not use Val_long in the above statement,
   as it will drop the top bit. See mlvalues.h. */
  CAMLreturn(result);
}


and a function taking no argument (in the sense of OCaml), and returning 
an OCaml object encapsulating a pointer which is R_NilValue. (R_NilValue 
is already a pointer, so we just copy it).



/* The NULL constant in R... */

CAMLprim value r_null (value unit) {
  CAMLparam1(unit);
  CAMLreturn(Val_sexp(R_NilValue));
}


OCaml code is straightforward:


external null_creator : unit - sexp = r_null
let null = null_creator ()


And I get a segfault:


Objective Caml version 3.11.1

# R.sexptype (R.sexp 1);;
- : R.sexptype = R.RealSxp
# R.sexptype Quantmod.getSymbols;;
- : R.sexptype = R.PromSxp


The two above are fine, but inspecting the type of R.null gives me a 
segfault.



# R.sexptype R.null;;
/usr/bin/ocaml-batteries: line 2:  3723 Erreur de segmentation  
/usr/lib/ocaml/batteries/toplevel.top /usr/lib/ocaml/batteries/top.ml $@


Please tell me if there's anything obvious which causes this. There's a 
lot of conditional compilation directives in Rinternals.h, and I'm 
wondering whether or not that might be an issue.


All the best,

--
 Guillaume Yziquel
http://yziquel.homelinux.org/

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


Re: [Rd] R_NilValue and segfault.

2009-11-17 Thread Guillaume Yziquel

Guillaume Yziquel a écrit :

Hello.

I've been trying to wrap up the R_NilValue into OCaml-R. I nevertheless 
get a segfault.


Is the value of R_NilValue (I mean the address in the R_NilValue pointer 
located in the uninitialized data section - i.e. the BSS section) set up 
*after* the init function is called?


--
 Guillaume Yziquel
http://yziquel.homelinux.org/

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


Re: [Rd] R_NilValue and segfault.

2009-11-17 Thread Guillaume Yziquel

Guillaume Yziquel a écrit :

Guillaume Yziquel a écrit :

Hello.

I've been trying to wrap up the R_NilValue into OCaml-R. I 
nevertheless get a segfault.


Is the value of R_NilValue (I mean the address in the R_NilValue pointer 
located in the uninitialized data section - i.e. the BSS section) set up 
*after* the init function is called?


I mean: after the Rf_initEmbeddedR is called?

I Objective Caml is really static. Which means that if I declare R.null 
to be R_NilValue, it will take the value of the pointer before 
Rf_initEmbeddedR is executed. And it would be garbage. That would 
perhaps be my issue.


Could someone confirm?

All the best,

--
 Guillaume Yziquel
http://yziquel.homelinux.org/

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