Re: [R] Problem setting TMPDIR on the fly

2006-10-31 Thread Benjamin Lloyd-Hughes
Sorted - sort of...

I've simply wrapped the invocation of R in a shell script along with the 
necessary environment variables.  However, this is precisely the solution that 
I was hoping to avoid!  

I can see why it would be inadvisable to switch TMPDIR mid way through a 
session, but wouldn't it be useful to able switch it on the way in?

As ever thanks for the help, cheers, Ben


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
Sent: 30 October 2006 17:08
To: Benjamin Lloyd-Hughes
Cc: Peter Dalgaard
Subject: Re: [R] Problem setting TMPDIR on the fly

Benjamin Lloyd-Hughes [EMAIL PROTECTED] writes:

 Hi Peter,
 
 Thanks for the swift response!
 
 The problem is arising because I'm running R in batch mode through cron.  As 
 such I'd rather set all such environment variables explicitly and not make 
 any assumptions about what variables maybe getting set on the way in.  A 
 typical call looks like this

 
 /usr/bin/R CMD BATCH --vanilla foo.R bar.Rout
 
 The first few lines of foo.R might run
 
 .libPaths(c(/usr/lib/R/library, /eurotempest/software/src/R/packages))
 Sys.putenv(TMPDIR = /eurotempest/tmp/R/)
 
 Hence the problem.
 
 Is there a more sensible way to go?

I'd just set it on the command line, as in

TMPDIR=/eurotempest/tmp/R/ R

 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
 Sent: 30 October 2006 16:33
 To: Benjamin Lloyd-Hughes
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Problem setting TMPDIR on the fly
 
 Benjamin Lloyd-Hughes [EMAIL PROTECTED] writes:
 
  Hi folks,
  
   
  
  I'm having a spot of bother with tempdir().  If I set the environment
  variable TMPDIR in my shell prior to invoking R it works as expected:
  
   
  
   Sys.getenv(TMPDIR)
  
TMPDIR 
  
  /eurotempest/tmp/R 
  
   tempdir()
  
  [1] /eurotempest/tmp/R/Rtmp0xY4XD
  
   
  
  However if I don't set it prior to entry, but attempt to set it from
  within the current session, the change is not detected/respected:
  
   
  
   Sys.getenv(TMPDIR)
  
  TMPDIR 
  
   
  
   Sys.putenv(TMPDIR = /eurotempest/tmp/R/)
  
   Sys.getenv(TMPDIR)
  
 TMPDIR 
  
  /eurotempest/tmp/R/ 
  
   tempdir()
  
  [1] /tmp/Rtmp9chsNX
  
   
  
  Any ideas?
 
 You're not supposed to do that. There is one and only one tempdir per
 R session. This is used for storing stuff which R expects to be able to
 find again later, so it would be a bad thing just to switch it out.
 
 -- 
O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907
 
 
 --
 This e-mail and its contents are intended for the use of the addressee(s) and 
 may be confidential/privileged. No-one else may review, copy, disclose or 
 otherwise use it or its contents. If you receive this e-mail in error, please 
 contact the originator and delete it as soon as possible.
 Benfield Limited is authorised by the Financial Services Authority under the 
 reference number 311884. Registered in England no 1170753. Registered office 
 55 Bishopsgate.
 
 Please refer to Benfield Limited's terms and conditions 
 (www.benfieldgroup.com/terms) for a description of our services, duties and 
 points of contact. Please review these terms and conditions at inception and 
 renewal of all reinsurance and insurance contracts.  
 
 Please note that our terms and conditions and interests in other companies 
 may change over time and these changes will be reflected on the Benfield 
 Limited website. The latest version of our terms and conditions supersedes 
 all previous versions.
 ==
 
 

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907


--
This e-mail and its contents are intended for the use of the addressee(s) and 
may be confidential/privileged. No-one else may review, copy, disclose or 
otherwise use it or its contents. If you receive this e-mail in error, please 
contact the originator and delete it as soon as possible.
Benfield Limited is authorised by the Financial Services Authority under the 
reference number 311884. Registered in England no 1170753. Registered office 55 
Bishopsgate.

Please refer to Benfield Limited's terms and conditions 
(www.benfieldgroup.com/terms) for a description of our services, duties and 
points of contact. Please review

[R] Problem setting TMPDIR on the fly

2006-10-30 Thread Benjamin Lloyd-Hughes
Hi folks,

 

I'm having a spot of bother with tempdir().  If I set the environment
variable TMPDIR in my shell prior to invoking R it works as expected:

 

 Sys.getenv(TMPDIR)

  TMPDIR 

/eurotempest/tmp/R 

 tempdir()

[1] /eurotempest/tmp/R/Rtmp0xY4XD

 

However if I don't set it prior to entry, but attempt to set it from
within the current session, the change is not detected/respected:

 

 Sys.getenv(TMPDIR)

TMPDIR 

 

 Sys.putenv(TMPDIR = /eurotempest/tmp/R/)

 Sys.getenv(TMPDIR)

   TMPDIR 

/eurotempest/tmp/R/ 

 tempdir()

[1] /tmp/Rtmp9chsNX

 

Any ideas?

 

Cheers, Ben

 

 R.Version()

$platform

[1] i686-redhat-linux-gnu

$arch

[1] i686

$os

[1] linux-gnu

$system

[1] i686, linux-gnu

$status

[1] 

$major

[1] 2

$minor

[1] 3.0

$year

[1] 2006

$month

[1] 04

$day

[1] 24

$`svn rev`

[1] 37909

$language

[1] R

$version.string

[1] Version 2.3.0 (2006-04-24)

 

 

 

 


--
This e-mail and its contents are intended for the use of the addressee(s) and 
may be confidential/privileged. No-one else may review, copy, disclose or 
otherwise use it or its contents. If you receive this e-mail in error, please 
contact the originator and delete it as soon as possible.
Benfield Limited is authorised by the Financial Services Authority under the 
reference number 311884. Registered in England no 1170753. Registered office 55 
Bishopsgate.

Please refer to Benfield Limited's terms and conditions 
(www.benfieldgroup.com/terms) for a description of our services, duties and 
points of contact. Please review these terms and conditions at inception and 
renewal of all reinsurance and insurance contracts.  

Please note that our terms and conditions and interests in other companies may 
change over time and these changes will be reflected on the Benfield Limited 
website. The latest version of our terms and conditions supersedes all previous 
versions.
==

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Matrix rotation

2005-11-24 Thread Benjamin Lloyd-Hughes
Dearest All,

Ok so I've had a couple of glasses of wine over lunch today... This is 
likely to be trivial but I'm struggling to find a more elegant way to 
obtain the following matrix rotations:

  M - matrix(c(1,0,0,0), ncol=2)
  M
  [,1] [,2]
[1,]10
[2,]00
  N - abind(M[2,],M[1,],along=2)
  N
  [,1] [,2]
[1,]01
[2,]00
  P - abind(N[2,],N[1,],along=2)
  P
  [,1] [,2]
[1,]00
[2,]01
  Q - abind(P[,2],P[,1],along=2)
  Q
  [,1] [,2]
[1,]00
[2,]10

And, more generally wish to rotate a n-dimensional data cube about some 
specified axis.

Cheers, Ben

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Fwd: Matrix rotation

2005-11-24 Thread Benjamin Lloyd-Hughes
Ok I warned you that I'd been drinking! What I really meant was 
something to go from:

  [,1] [,2]
[1,]12
[2,]43

to

  [,1] [,2]
[1,]41
[2,]32

to

  [,1] [,2]
[1,]34
[2,]21

to

  [,1] [,2]
[1,]23
[2,]14

Sorry for being a muppet, B


Begin forwarded message:

 From: Benjamin Lloyd-Hughes [EMAIL PROTECTED]
 Date: 24 November 2005 16:15:58 GMT
 To: r-help@stat.math.ethz.ch
 Subject: Matrix rotation

 Dearest All,

 Ok so I've had a couple of glasses of wine over lunch today... This is 
 likely to be trivial but I'm struggling to find a more elegant way to 
 obtain the following matrix rotations:

  M - matrix(c(1,0,0,0), ncol=2)
  M
  [,1] [,2]
 [1,]10
 [2,]00
  N - abind(M[2,],M[1,],along=2)
  N
  [,1] [,2]
 [1,]01
 [2,]00
  P - abind(N[2,],N[1,],along=2)
  P
  [,1] [,2]
 [1,]00
 [2,]01
  Q - abind(P[,2],P[,1],along=2)
  Q
  [,1] [,2]
 [1,]00
 [2,]10

 And, more generally wish to rotate a n-dimensional data cube about 
 some specified axis.

 Cheers, Ben


[[alternative text/enriched version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] whether R can import netcdf file format data ?

2004-11-12 Thread Benjamin Lloyd-Hughes
I've been using the ncdf package for reading climate data (mostly, NCEP/NCAR
and ECMWF reanalysis stuff). The package does what it says on the tin, but
can become quite slow when working with large data sets (e.g. a stack of
daily grids say 144x73 elements 1970-to date). Does anyone have any tips for
speedy retrieval? I'm thinking about typical drilling/slicing type
operations.

Cheers, Ben

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Prof Brian Ripley
Sent: 12 November 2004 15:05
To: Yogesh K. Tiwari
Cc: [EMAIL PROTECTED]
Subject: Re: [R] whether R can import netcdf file format data ?


On Fri, 12 Nov 2004, Yogesh K. Tiwari wrote:

 Whether 'R' can import Netcdf format data files ??

It can read from and write to them, at least.

 Any package in 'R' that can help me on this front ??

Do look at the `R Data Import/Export' manual that ships with R (a recent
version is needed), or the R FAQ or the list of packages on CRAN.
You will find RNetCDF, ncdf and ncvar.

--
Brian D. Ripley,  [EMAIL PROTECTED]
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

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] rgdal under windows?

2004-08-24 Thread Benjamin Lloyd-Hughes
Success!

I'm pleased to inform that Roger's recipe worked a treat for compiling
rgdal_0.2-7 in conjunction with gdal-1.2.1 and proj-4.4.8.  Using
MinGW-3.1.0 with MYS-1.0.8 on an xp pro box (SP1) Proj-4 compiled straight
out of the box. Gdal needed a couple of minor tweaks wrt how the boolean
type is defined.  I suspect that gcc is being strict about name spaces.  My
hack was an explicit typedef in jpeglib.h: typedef unsigned char boolean;
and to comment out the definition in jmorecfg.h
After that it was plain sailing except for the curious behaviour of the
MinGW dlltool.exe which refused to to pick up R.dll unless it was given the
full path _irrespective_ of what was placed in $PATH.

Big thanks to Roger and Brian for their helpful advice.  Complicated? Not if
you learn to read!

Cheers, Ben

-Original Message-
From: Roger Bivand [mailto:[EMAIL PROTECTED] 
Sent: 19 August 2004 19:27
To: Prof Brian Ripley
Cc: Benjamin Lloyd-Hughes; [EMAIL PROTECTED]
Subject: Re: [R] rgdal under windows?

On Thu, 19 Aug 2004, Prof Brian Ripley wrote:

 On Thu, 19 Aug 2004, Benjamin Lloyd-Hughes wrote:
 
  Has anyone had any joy getting the rgdal package to compile under
windows?
 
 First you need to meet the system requirements:
 
 SystemRequirements: GDAL library from 
 http://www.remotesensing.org/gdal/download.html
 
 Since that has build instructions which say
 
   GDAL can be built on Windows using MS VC++ 6.x and MS Visual Studio .NET

   (C++) at the DOS command line.
 
 you will first need to get a copy of DOS and those compilers.  (I suspect
 they mean the Windows command prompt, but they don't seem to know the
 difference which is not confidence-inspiring.  I also suspect they mean
 `or' not `and'.)  Then you will have to fathom out how to link against a
 VC++ DLL which since this C++ is very unlikely to work with MinGW.  So you
 probably need to make the package's rgdal.dll under VC++ -- see
 README.packages.
 
 I have tried and failed to make GDAL with MinGW.
 
  I've been trying with MinGW using Duncan Murdoch's Rtools but to no
avail.
 
 Do read README.packages and follow the advice at the top.  You don't have 
 the (mis-attributed) tools in your path.  But that is probably the least 
 of your potential problems.
 

Exactly. The closest anyone has got so far is Hisaji Ono, who used MSYS 
(http://www.mingw.org/) to build PROJ.4 and GDAL (GDAL depends on PROJ.4, 
PROJ.4 needs a PATH to metadata files for projection and transformation), 
and then hand-pasted the paths to the GDAL headers and library into 
src/Makevars, running Rcmd INSTALL rgdal at the Windows command prompt as 
usual. All of this can be repeated, but is not portable, and does not suit 
the very valuable standard binary package build system for Windows. 
Roughly:

1. Download everything you need to build source packages under Windows and 
make sure it works;

2. Download MSYS and make sure it works;

3. Download the GDAL and PROJ.4 source tarballs, and possibly other
libraries you want to use with GDAL, and *within MSYS* untar, ./configure
with the appropriate arguments, at least make but maybe also make install
- now leave MSYS;

4. Download the rgdal source package, and *at the Windows command prompt*
untar it, change the name of configure to something else, create
src/Makevars manually from src/Makevars.in, insert the correct values of:
PKG_CPPFLAGS as -Ipath to the directory with the GDAL headers, PKG_LIBS
as -L ... GDAL libraries -lgdal, run Rcmd INSTALL rgdal (better first 
Rcmd check rgdal), and repeat until all the problems are resolved.

5. The installation should work locally, but some paths are compiled into 
the resulting *.dll, so it will, most likely, not be portable.

Both Hisaji and I were surprised that this actually seemed to work (as of
late Autumn last year for the versions of MinGW and MSYS available then;  
further fragility is introduced by much of GDAL being written in C++); it
is not wholly impossible that it could be made available portably as a
Windows binary with an installer, but not through the regular R binary
package repositories.

 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] rgdal under windows?

2004-08-19 Thread Benjamin Lloyd-Hughes
Hi,

 

Has anyone had any joy getting the rgdal package to compile under windows?
I've been trying with MinGW using Duncan Murdoch's Rtools but to no avail.
After unpacking the tarball I put it here:

 

D:\rw1091\src\library\rgdalls

DESCRIPTION  Rconfigure inst   man

INDEXcleanup  configure.in  install.R  src

 

And then tried:

 

D:\rw1091\src\gnuwin32make pkg-rgdal

make: *** [pkg-rgdal] Error 255

 

Any help would be most appreciated!

 

Cheers, Ben


[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html