[R] linking options -lblas

2011-10-22 Thread jgarcia
Hi all,
I want to install some packages in R in a computer where I haven't root
privilegues, and R is already installed. The system manager is extremely
busy and at the moment I'm afraid that I have to manage my own
installations.

So, I am trying to install 'quadprog' and I'm getting the message:

/usr/bin/ld: cannot find -lblas
collect2: ld returned 1 exit status
make: *** [quadprog.so] Error 1
ERROR: compilation failed for package 'quadpr

on the other hand in the system there is a /usr/lib64/libblas.so.3 but not
a libblas.so. Thus I've created the soft link in my $HOME/lib/libblas.so
and set LD_LIBRARY_PATH=$HOME/lib

I would expect that 'quadprog' to find the link but the message is still
the same. Please, could you tell me how to specify to "R CMD INSTALL
quadprog" where to find libblas.so?

Thanks in advance,
Javier
---

__
R-help@r-project.org 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.


Re: [R] html help not built

2010-04-07 Thread jgarcia
Hi Duncan,
I must be misunderstanding something. It is not that I want them built at
installation time, but when I try to display the html help for any
function the html page is not built; e.g. cliking on the link to get() in
the base library, the message appears:

An error occurred while loading
file:///usr/local/lib64/R/library/base/html/get.html:
The file or folder /usr/local/lib64/R/library/base/html/get.html does not
exist.

Javier
---


> On 07/04/2010 10:49 AM, jgar...@ija.csic.es wrote:
>> Hi,
>>
>> I've just installed R 2.10.1 for linux, and html help has not been built
>> (just the index page of each package but not the documentation for the
>> individual functions in the packages.
>>
>> I cannot see any flag in the ./configure to set if html is going to be
>> build.
>>
>> Please could you tell me what should I do to biuld html files?
>
> Why would you want to build them before displaying them?  There are a
> few uses for that sort of thing (e.g. Jon Baron's site that RSiteSearch
> looks at), but you have to realize that you won't get the same files as
> would be displayed to a normal user, links won't necessarily work, etc.
>
> If you still want to do it, then just re-install all of your packages
> with the "--html" option.
>
> Duncan Murdoch
>

__
R-help@r-project.org 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] --enable-prebuilt-html

2010-04-07 Thread jgarcia
Hi,
Sorry about my last question. I've found the solution in the
documentation, and yes; there is a flag in ./configure I did not see.

Thanks
Javier
---

__
R-help@r-project.org 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] html help not built

2010-04-07 Thread jgarcia
Hi,

I've just installed R 2.10.1 for linux, and html help has not been built
(just the index page of each package but not the documentation for the
individual functions in the packages.

I cannot see any flag in the ./configure to set if html is going to be build.

Please could you tell me what should I do to biuld html files?

Thanks and best regards,
Javier
---

__
R-help@r-project.org 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] Selective load of .First() function just for Rgui.exe

2010-02-12 Thread jgarcia
Hi all,
I have a  .First <- function() {...} in the Rprofile.site file. Through
.First() I'm adding several menus to the GUI to access several functions
I've been developing for own use.

However, I also need to launch R scripts silently in a batch way, and
in this case I get the error message:

"Error in winMenuAdd(menuname, NULL, NULL):
 Menu functions can only be used in the GUI"

Do you know about about a way to selectively read the .First()
function just for Rgui.exe, but not for call to R.exe?

Thanks and best regards,
Javier
---

__
R-help@r-project.org 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.


Re: [R] Problem with writeBin and importing into gfortran compiled programs

2010-01-07 Thread jgarcia
Solved!!
Berend's suggestion to use ACCESS='STREAM' is perfect. I've checked that
it's even acepted by gfortran coming along with GCC 4.2.1 (the one I've
got), and solves the problem.

I was working around this through seek() and truncate(), but this is
clearly the star option!

Thanks Berend and Duncan,
Javier
---

>
> jgarcia-2 wrote:
>>
>> f90 part
>> 
>> PROGRAM foo
>> INTEGER, PARAMETER :: DP = KIND(1.0D0)
>> INTEGER :: status
>> REAL(DP), DIMENSION(10,100) :: whini
>> OPEN(UNIT=5, FILE='fwhini.dat', STATUS='OLD', ACTION='READ', &
>>  FORM='UNFORMATTED', IOSTAT=status)
>> READ(5) whini
>> CLOSE(5)
>> WRITE(*,*) whini
>> END PROGRAM
>>
>
> I am browsing in the Gfortran 4.3.0 manual.
> On page 13 there is a mention of a record marker in unformatted files.
> It could be that the fortran read is expecting a record marker every so
> many
> bytes.
> writeBin most likely has not written  any record marker.
>
> In Fortran 2003  there is a new specifier ACCESS='STREAM'  (similar to
> Lahey
> Fortran ACCESS='TRANSPARENT')(see page 23 of said manual) which will allow
> reading files with no record structure.
>
> Berend
> --
> View this message in context:
> http://n4.nabble.com/Problem-with-writeBin-and-importing-into-gfortran-compiled-programs-tp1009121p1009211.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org 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-help@r-project.org 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] Problem with writeBin and importing into gfortran compiled programs

2010-01-07 Thread jgarcia
Hi all,
I'm having problems trying to export binary arrays from R and importing
them into fortran (linux openSUSE 10.3 (x86_64), gfortran compiler,
fortran 90/95 program).

Let's say the problem can be expressed as:

R part

>whini <- runif(1000)
>writeBin(whini,"fwhini.dat")

f90 part

PROGRAM foo
INTEGER, PARAMETER :: DP = KIND(1.0D0)
INTEGER :: status
REAL(DP), DIMENSION(10,100) :: whini
OPEN(UNIT=5, FILE='fwhini.dat', STATUS='OLD', ACTION='READ', &
 FORM='UNFORMATTED', IOSTAT=status)
READ(5) whini
CLOSE(5)
WRITE(*,*) whini
END PROGRAM

Now, if within the R session I check

>typeof(whini)
[1] "double"

and try

>whini.copy <- readBin("fwhini.dat",what=double(),n=1000)

the copy of whini is right. However, execution of the fortran program
gives the message:

Fortran runtime error: Unformatted file structure has been corrupted.

I've tried also to declare whini in the fortran part as SINGLE precision,
and to force writeBin using the "size" argument.
size=4 and size=8 give the same error (whini as double in the fortran
part), while size=16 gives the alternative error
"Fortran runtime error: I/O past end of record on unformatted file"

Please, could you help me with this problem?

Thanks,
Javier
---

__
R-help@r-project.org 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] hdf5 package

2009-12-14 Thread jgarcia
Hi all,
I'm testing the use of the hdf5 R library under Windows XP.

With some simple example (an R list with several subobjects as showed in
the examples in the library) the library exports and imports .hdf files
adequately. However, if I try to open the exported file with another
program (HDFView 2.5) I receive the message that the file is an
unsupported format. HDFView 2.5 does not seems to have any problem with
another hdf5 files.

Has anyone experienced a similar problem with R exporte hdf5 files and
could indicate if it is likely originated by either the R interface or the
hdf library in my computer?

Thanks and best regards,
Javier
--

__
R-help@r-project.org 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] pdf transparency not working with Latex documents. Solved

2009-05-09 Thread jgarcia
Hi,
I've found that after the call to pdf(), I had a posterior line:
par(bg="white")
that was creating this white background. Setting this to transparent works
fine.
Thanks,
Javier
...

> Hello,
> I' using the pdf() device with bg="transparent" to create plots to be used
> within a latex (beamer) presentation.
>
> Later on, I see that the background of my pdf() graphics is solid white in
> the  final presentation.
>
> I'm using R-2.6.0, and I have also tried to set the version argument in
> pdf() to "1.5" and "1.6". Later versions are not accepted.
>
> Has anyone used transparency successfully in this way?
>
> Thanks, and best regards,
> Javier
> ...
>
> __
> R-help@r-project.org 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-help@r-project.org 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] pdf transparency not working with Latex documents

2009-05-09 Thread jgarcia
Hello,
I' using the pdf() device with bg="transparent" to create plots to be used
within a latex (beamer) presentation.

Later on, I see that the background of my pdf() graphics is solid white in
the  final presentation.

I'm using R-2.6.0, and I have also tried to set the version argument in
pdf() to "1.5" and "1.6". Later versions are not accepted.

Has anyone used transparency successfully in this way?

Thanks, and best regards,
Javier
...

__
R-help@r-project.org 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] visualization of sub-parts in 3D arrays

2009-05-07 Thread jgarcia
Hello all;

Let's say we have a block of 3D data belonging to cubic cells,
 and increasing indexes are ordered
 x: from west to east
 y: from north to south
 z: from top to bottom

---
nx <- 25
ny <- 12
nz <- 4
my.array <- array(NA,dim=c(nx,ny,nz))

for(z in 1:nz){
 my.array[,,z] <- runif(nx*ny,z-1,z)
}
---
Is there a way to relatively easy plot sub-blocks of this 3d array in R?
This would include simultaneous plots of several layers one over the
other, and keeping the gaps between them if they are
non-contiguous. Also this would include transversal cuts of thickness 1 or
>1, and from a selected point of view.

I mean as a render in which lateral planes (xz and yz planes) are treated
similarly to xy planes.

Thanks and best regards,
Javier
---

__
R-help@r-project.org 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.


Re: [R] send command to other program

2009-04-29 Thread jgarcia
Hi,
Consider also that you may easily modify system names from inside your R
script as:

system("mv oldname newname")

Best Regards,
Javier
...

> thoeb wrote:
>> Hello,
>> does anybody know about how to "send" a command or a text line from R to
>> another program? I have written a script in which several calculations
>> are
>> made and outputfiles (csv) are generated. Afterwards I open another
>> program
>> (Fortran) via shell.exec. This program asks for the names if the output
>> files and it would be quite practically if it could just adopt the file
>> names from the r script.
>>
> Hi Tamara,
> If the succeeding program can read the name of the input file via the
> command line arguments, like:
>
> myfortranprogram -i myfile.csv
>
> you can include the arguments in the shell call. Alternatively, you
> could have R write a shell script that would execute the program with
> the appropriate arguments, then call the shell script from R. Of course
> if your program has to have keyboard input for the filename, you would
> have to resort to magic like writing the filename into the keystroke
> buffer.
>
> Jim
>
> __
> R-help@r-project.org 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-help@r-project.org 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.


Re: [R] how to split and handle a big R program into multiple files

2009-04-23 Thread jgarcia
source() and the use of functions
...
Javier
---

> I am working on a program totally written in R which is now getting bigger
> and bigger so that editling the only file that contains all the functions
> is becoming more and more unmanageable.
> I wonder whether it is possible to spread the R code, making up the same
> program, in a number of smaller files and then call them all, in the right
> order, through a list of something like the C language 
> directive.
>
> Any other suggestion how to organize, handle, and maintain a big R program
> is welcome.
>
> Thank you in advance,
> Maura
>
>
> tutti i telefonini TIM!
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org 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-help@r-project.org 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.


Re: [R] Mapping in R

2009-03-31 Thread jgarcia
It is relatively easy to do a small function for this in R:
a) select the desired width for your border
b) through a fix number or through the use of pretty(), establish the
number of rectangles you want along your border.
Then e.g., you can use rect() you build the sequence of black-white
rectangles along your border.

Hope this helps.

Javier García-Pintado
...




> Kelsey Scheitlin  fsu.edu> writes:
>
>>
>> Hi, I am looking for a specific mapping capability in R that I can't
>> seem to
> find, but think exists. I would
>> like to make a border of a map have alternating black and white squares
> instead of the common latitude and
>> longitude grid.  (example:
>> http://www.cccturtle.org/sat_maps/map0bw8.gif). If
> anyone knows if
>> there is or is not a function capable if doing this could you please let
>> me
> know? Thanks!
>>
>> Kelsey
>
>   It's not QUITE what you're looking for, but
>
> plot(0:1,0:1,bty="n",axes=FALSE)
> box(bty="o",lwd=6,lty="FF")
>
> (See ?box, ?par under "bty" and "Line Type Specification")
>
> Otherwise you can do this by using par("usr") to find the
> edges of the map, seq() to construct appropriate x and y
> sequences, and segments() to draw the lines.
>
>   Ben Bolker
>
> __
> R-help@r-project.org 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-help@r-project.org 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] snow Error.

2009-03-27 Thread jgarcia
Hello,

I have a program that used to run well in October, it uses library snow.
Since then, one change has ocurred (snow library has been updated) and
another could have ocurred (I've unadvertently modified something).

Anyway, now when I make the call:

parallel.model.results <- clusterApply(cl,processors.struct,MCexe)

 exactly as I used to do, where MCexe is my function and processors.struct
is a list containing everything required by MCexe, I obtain the following
error:

Error in checkForRemoteErrors(val) :
  2 nodes produced errors; first error: incorrect number of dimensions

Please, do you have any clue about what could be the error?

Best regards,

Javier García-Pintado

__
R-help@r-project.org 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.


Re: [R] R: Fortran-90 and R

2009-03-26 Thread jgarcia
Perhaps you should consider also the possibility  of simply export the
data from the R workspace to the system and make your fortran code to read
these system files.

> On Thu, 2009-03-26 at 11:01 +0100, mau...@alice.it wrote:
>> I do hope the chapte about "Interfacing R and Fortran" is sufficient.
>> I have a heavy load of work from two projects and no previous experience
>> in either cases (analysis packages,
>> algorithms, and so on ...). I am a postdoc.
>
> Ranjan Maitra
>
> Posted this link
>
> http://www.stat.umn.edu/~charlie/rc/
>
> last week. I found this quite simple to follow, so it might be a useful
> companion to the Writing R Extensions manual already suggested. The link
> above doesn't specifically address fortran 90, but if special handling
> of f90 code is required, the Writing R Extensions manual will tell you
> what needs to be done differently.
>
> HTH
>
> G
>
>> Thank you.
>> Maura
>>
>> -Messaggio originale-
>> Da: Peter Dalgaard [mailto:p.dalga...@biostat.ku.dk]
>> Inviato: gio 26/03/2009 8.57
>> A: mau...@alice.it
>> Cc: r-help@r-project.org
>> Oggetto: Re: [R] Fortran-90 and R
>>
>> mau...@alice.it wrote:
>> > I have some code in Fortran-90 that outperforms my R implementation of
>> the same algorithm (in terms of speed).
>> > I wonder whether it is possible to interface R with Fortran-90. that
>> is would like to call a Fortran routine from my R
>> > script, passing to the Fortran routine some real numbers array, some
>> scalar real numbers, and an integer number .
>> > I have no idea how to do that because Fortran is a compiled language
>> whereas R s an interpreted language ..
>> > therefore I do not know whetehr it makes any sense to build a make
>> file for the linker ... Is the linker necessary ?
>> >
>> > Thank you very much.
>> > Maura
>>
>> You need to read this:
>>
>> http://cran.r-project.org/doc/manuals/R-exts.pdf
>>
>>  -p
>>
>>
>> __
>> R-help@r-project.org 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.
> --
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>  Dr. Gavin Simpson [t] +44 (0)20 7679 0522
>  ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
>  Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
>  Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
>  UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
> __
> R-help@r-project.org 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-help@r-project.org 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.


Re: [R] sink() within a loop. Solved

2008-11-05 Thread jgarcia
Uwe;
sorry for my last mail. In effect, as you say ,I just needed to explicitly
print() the object to be sinked within the loops.

Thanks you,

Javier



>
>
> [EMAIL PROTECTED] wrote:
>> Hello;
>> It seems to me that this could even by a FAQ, but I cannot find an
>> answer:
>>
>> Why a piece of code that uses sink() does not sinks anything if it is
>> executed within a for loop?
>
> Without sink(), does it print anything in the console? If not: use
> print() in order to print it (i.e. sink it to another connection).
>
> Uwe Ligges
>
>
>>
>>
>> Thanks,
>> Javier
>>
>> __
>> R-help@r-project.org 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-help@r-project.org 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.


Re: [R] sink() within a loop

2008-11-05 Thread jgarcia
Well, I'll put a foo example of my problem:

I'got a list:

>a <- list()
>a$sublist.1 <- list()
>a$sublist.1$subsublist.1 <- list()

this code works:

>zz <- file("foo.txt","w")
>sink(zz)
>a
>sink()
>close(zz)

and generates a correct "foo.txt" file containing the structure of the list

but this code doesn't:

>for(i in 1){
 zz <- file("foo.txt","w")
 sink(zz)
 a
 sink()
 close(zz)
}

as the resulting "foo.txt" file is empty

I don't understand why.

Javier
-

















>
>
> [EMAIL PROTECTED] wrote:
>> Hello;
>> It seems to me that this could even by a FAQ, but I cannot find an
>> answer:
>>
>> Why a piece of code that uses sink() does not sinks anything if it is
>> executed within a for loop?
>
> Without sink(), does it print anything in the console? If not: use
> print() in order to print it (i.e. sink it to another connection).
>
> Uwe Ligges
>
>
>>
>>
>> Thanks,
>> Javier
>>
>> __
>> R-help@r-project.org 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-help@r-project.org 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] sink() within a loop

2008-11-05 Thread jgarcia
Hello;
It seems to me that this could even by a FAQ, but I cannot find an answer:

Why a piece of code that uses sink() does not sinks anything if it is
executed within a for loop?


Thanks,
Javier

__
R-help@r-project.org 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.


Re: [R] torque/psb & snow library

2008-10-22 Thread jgarcia
Thanks you! I'll look at this new list!
Well, I'm not the system administrator, and my installation of Rmpi and/or
pvm libraries for R crashes. As this is the first time I parallelize some
jobs, snow appealed as a first approach because 1) it compiled correctly
and 2) the use of the library is very easy.

As you tell me MPI is faster, I'll retry Rmpi installation.
B. Regards,
Javier
..

> Hi Javier,
>
> there is a new mailing list for R and HPC: [EMAIL PROTECTED]
> This is probably a better list for your question.
>
> I never tried torque with socket. We use torque and mpi or pvm (and R)
> and it is working very well.
> Why do you use socket as communication layer?
> MPI was especially developed for communication between nodes in a
> computer cluster. And there you can specify which nodes and the number
> of processors per node you want use. Therfore I would strongly recommend
> to use MPI. This will be faster in every condition!
>
> Best
> Markus
>
>
> [EMAIL PROTECTED] wrote:
>> Hello all;
>> I'm trying to execute parallel jobs trough library snow on a cluster
>> built
>> through torque/PSB. I'm succesfully obtaining the cluster with:
>>
>>
>>> system("cat $PBS_NODEFILE > cluster.txt")
>>> mycluster <- scan(file="cluster.txt",what="character")
>>> cl <- makeSOCKcluster(mycluster)
>>
>> The only problem, at the moment, is that if I use processors in nodes
>> other that the one in which I'm running R, the communication is
>> extremely
>> slow. If all processor are in the "master" computer there not seems ti
>> be
>> any problem.
>>
>> Has anyone got any experience with this and any advice? Perhaps snow() s
>> not adequate for this kind of clusters?
>>
>> Thanks and best regards,
>> Javier
>>
>> __
>> R-help@r-project.org 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.
>
>
> --
> Dipl.-Tech. Math. Markus Schmidberger
>
> Ludwig-Maximilians-Universität München
> IBE - Institut für medizinische Informationsverarbeitung,
> Biometrie und Epidemiologie
> Marchioninistr. 15, D-81377 Muenchen
> URL: http://www.ibe.med.uni-muenchen.de
> Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de
> Tel: +49 (089) 7095 - 4599
>

__
R-help@r-project.org 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] torque/psb & snow library

2008-10-22 Thread jgarcia
Hello all;
I'm trying to execute parallel jobs trough library snow on a cluster built
through torque/PSB. I'm succesfully obtaining the cluster with:


>system("cat $PBS_NODEFILE > cluster.txt")
>mycluster <- scan(file="cluster.txt",what="character")
>cl <- makeSOCKcluster(mycluster)

The only problem, at the moment, is that if I use processors in nodes
other that the one in which I'm running R, the communication is extremely
slow. If all processor are in the "master" computer there not seems ti be
any problem.

Has anyone got any experience with this and any advice? Perhaps snow() s
not adequate for this kind of clusters?

Thanks and best regards,
Javier

__
R-help@r-project.org 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.


Re: [R] runs of heads when flipping a coin

2008-10-09 Thread jgarcia
It seems to me that you are asking for:

> hhh <- 0.1
> sum(dbinom(x=0:50,size=500,prob=hhh))
[1] 0.5375688




> You can use 'sample' and 'rle':
>
>> x <- sample(c("H","T"), 500, replace=TRUE, prob=c(.95, .05))
>> as.data.frame(unclass(rle(x)))
>lengths values
> 1   12  H
> 21  T
> 3   10  H
> 41  T
> 55  H
> 62  T
> 7   26  H
> 81  T
> 9   17  H
> 10   1  T
> 11  54  H
> 12   1  T
> 13  23  H
> 14   1  T
> 15   7  H
> 16   1  T
> 17   2  H
>
>
> On Thu, Oct 9, 2008 at 1:16 PM, Harvey <[EMAIL PROTECTED]> wrote:
>> Can someone recommend a method to answer the following type of question:
>>
>> Suppose I have a coin with a probability hhh of coming up heads (and
>> 1-hhh
>> of coming up tails)
>> I plan on flipping the coin nnn times (for example, nnn = 500)
>> What is the expected probability or frequency of a run of rrr heads*
>> during
>> the nnn=500 coin flips?
>> Moreover, I would probably (excuse the pun) want the answer for a range
>> of
>> rrr values, for example rrr = 0:50
>>
>> Of course I am more interested in an analytical solution than a monte
>> carlo
>> simulation solution.
>>
>> Thanks in advance,
>>
>> Harvey
>>
>> * OR "a run of rrr heads or more ..."
>>
>>[[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org 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.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>
> __
> R-help@r-project.org 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-help@r-project.org 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] extracting a subset of sublists form a list; vectorized form

2008-10-08 Thread jgarcia
Hello;
I'll put my real problem through a simple example:
I've got a main list:

> main.lst <- lst()

With a number of sublists:

> for(i in 1:1000){
   main.lst[[i]] <- list()
   main.lst[[i]]$first  <- runif(1,0,1)
   main.lst[[i]]$second <- runif(2,3,4)
  }

If later on I need to split this list, how could I extract several
sublists in a vectorized form? For example, to extract the four first
sublists, to be passed to a function, sintaxis like this won't work:

> sublist <- main.lst[[1:4]]

Although I could do

> sublist <- list()
> for(i in 1:4){ sublist[[i]] <- main.lst[[i]] }

I would hope that a vectorized way could exist.

Thanks, and regards,
Javier
---

__
R-help@r-project.org 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.


Re: [R] R and Multi threading

2008-10-08 Thread jgarcia
Dear prof, and list!

I'm wondering which are the steps to exploit multiple processors/cores if
most of the processing time is due to C code dynamically loaded into R. I
mean; e.g., a Monte Carlo analysis calls the C part a huge number of
times, and it is this C part which takes most of the time.

Will snow be anyway useful for this, or multithreading must be made
explicit (I don't know how) within the C code, or there is nothing we can
do?

Javier G.P



> On Tue, 7 Oct 2008, pejpm wrote:
>
>>
>> I will preface this message by saying that I am not an R developer and
>> no
>> very little about R...but here is my situation:
>>
>> One of my users has developed a model for analysing commodity prices. At
>> the
>> moment when he runs this model on his daily data set it takes roughly 5
>> hours to complete. He is using a quad core PC with 2gb of RAM. The R
>> process
>> only uses 1 core..i.e. the overall CPU usage tops out at around 25%.
>> This
>> has been a managable situation for a while, but he would now like to run
>> this model on 5 years of historical data. He has a colleague who ran the
>> model on a 16 core Redhat Linux box, but it took even longer to run. He
>> has
>> asked me for assistance in speeding up this process. I have a couple of
>> questions:
>>
>> 1) Is is possible to run the Windows version of R across all four
>> processors?
>
> No.
>
>> 2) I was under the impression that R for Linux supported multi-threading
>> by
>> default. Am I correct in this assumption? If not, is it possible for
>> Linux R
>> to multi thread, and how do I go about configuring this?
>
> Your impression/assumption is wrong.
>
>> Apologies for the lack of detailed info in this post. I work in trade
>> floor
>> support and engineering and we dont really have much demand for this
>> kind of
>> heavy duty computational work so I am learning as I investigate this
>> issue.
>
> R runs as a single task.  It is possible that some of the the support
> functions (notably the BLAS) can be multithreaded, and this will often
> (but not always) help if the task is intensive numerical linear algebra.
> But even if a multithreaded BLAS is used (and it is not the default
> build), the effect on a typical R task is very small.
>
> If you want to exploit multiple processors/cores you need to split up your
> R job amongst multiple processes.  There are ways to help you do that
> (packages snow and Rmpi, amongst others), but they need recoding of the
> job to make use of them.
>
> --
> 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
>
> __
> R-help@r-project.org 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-help@r-project.org 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] Query about computational demand

2008-10-06 Thread jgarcia
Hi all;
I've programmed a couple of C libraries which are loaded dynamically into
R (Linux). With one of these, I'm conducting Monte Carlo analysis, but
every individual execution of my model is about 15'. So, I'm running 1000
executions in about 11 days.

This is not enough for my needings, as I need about 5 executions for a
sensible analisis of the parameter space. I'm not an expert programmer,
and so, I've got several doubts:

a) I leave R to manage all memory issues. Would a similar C code be faster
if it would be executed as an isolated code outside R?

b) I've been offered two options, to execute remotely the Monte Carlo runs.
Xeon x86_64:  with 8   processors
Itanium:  with 128 processors y 500Gb de RAM

With the common R programming (without any specific programming for
parallel computing), would my dynamically loaded C library and R benefit
of having several processors?

c) How could I report to the people who perhaps offer me the computational
resources the maximum amount of memory I need?

Thanks, and sorry if these are too basic questions.

Javier
--


> On 03/10/2008 7:19 PM, Tomas Lanczos wrote:
>> Thank You for Your answer, Duncan,
>>
>> Duncan Murdoch wrote:
>>> On 03/10/2008 4:33 AM, Tomas Lanczos wrote:
 hello,

 I wish to create some 3d scatter diagrams visualising different
 grouped data set by a given field in the database. I tried the
 scatterplot3d package, as well as the plot3d and scatter3d functions
 (both within the rgl resp. Rcmdr package). My first question is,
 whether is it possibe to group data in the scatterplot3d and plot3d,
 because I did not succeed to use the groups = ... function.
>>> There is no groups argument to plot3d, but you can set characteristics
>>> of each point separately.  So if you can calculate a colour for each
>>> point yourself, you can do something like
>>>
>>> plot3d(br_scatter[,c("cl", "br", "hco3")], col=colour)
>> I see, but it is something new for me. So, if I understood You well, You
>> advice to prepare another column containing colour codes (colour names?)
>> for each point?
>
> Yes, though it needn't be a column of br_scatter.  A vector of the right
> length will work.
>
> Duncan Murdoch
>>
>>> If you want different sizes for each point, you have to plot each
>>> group separately; the size= attribute can't be a vector.  You could
>>> also use text3d to plot character labels, e.g.
>>>
>>> plot3d(br_scatter[,c("cl", "br", "hco3")], type="n")
>>> text3d(br_scatter[,c("cl", "br", "hco3")],
>>> text=br_scatter$stratigraphy)
>> In some cases it should be nice, but I have hundreds of points, no space
>> left for labels, but I can use it later.
>>
>> Tomas
>>> Duncan Murdoch
>>>
 The scatter3d behaves a bit wierdly with the groups function: it
 works well with data imported from a CSV file, but when I tried to
 apply it to a data imported from a PostgreSQL database (using the
 Rdbi and RdbiPgSQL packages) it gives me this error message:

 ERROR:
groups variable must be a factor.

 To be more clear here is a command I used with the scatter3d (exactly
 the same for the both datasets):

 scatter3d(br_scatter$cl, br_scatter$br, br_scatter$hco3,
 fit="linear", residuals=TRUE, bg="white", axis.scales=TRUE,
 grid=TRUE, ellipsoid=FALSE, xlab="cl", ylab="br", zlab="hco3", groups
 = br_scatter$stratigraphy)

 the dataset I used is here (the same is the data imported from the
 CSV file and from a PostgreSQL table) looks like this (a part of it):

  stratigraphy   brhco3  cl
 1 sarmat 0.2327793352  507.006513  262.781114
 2 sarmat 0.3741990388 1021.788317  214.254486
 3  baden 0.3354024830 1268.847582  253.639356
 4 sarmat 0.0938626352   46.514244   38.995620
 5 sarmat 0.1163896676   18.300686   72.984568
 6 sarmat 0.2090008010   77.777917  131.989947
 7 sarmat 0.2815879055   53.802018  146.804052
 8  panon 0.0450540649   81.590560  274.980467
 9  baden 0.5619243092   61.752316  275.978980
 10karpat 0.4655586704   16.019351  179.537807
 11mezozoikum 0.6244993993  133.442504  152.986938
 12 panon 0.1539347217  132.679975   65.994974
 13sarmat 0.0375450541   19.825743   24.996686
 14sarmat 0.0375450541   20.588272   26.280086
 15 baden 0.0463055667   19.063215   26.494456
 16 baden 0.1864737685   40.414016   93.992841
 17sarmat 0.9236083300   90.740903  597.954458
 18 panon 0.8022126552   57.189645  499.961921
 19 panon 0.4830796956   68.627574  280.001241
 20 panon 0.1163896676   73.202745   53.995887

 So why the exactly same "stratigraphy" field is a factor in the
 dataset imported from a CSV file and why is not a factor in the
 dataset imported fro

Re: [R] effective matrix subset

2008-08-10 Thread jgarcia
Patrick, you have misundertood me, I mean that Dan's solution (which is
also your solution) are both:
a) more clear and elegant
b) more time efficient. I've checked it with my working 1*3000 element
matrixes. The improvement in speed with your solution is evident.

I do not advise at all to use my solution. At the contrary, you have
solved my problem.

Thanks, and regards.
Javier
--


> That may be a better solution, but I don't think
> it is clearly a better solution.
>
> I presume you mean that your computation is the
> most time efficient.  That seems believable to me.
> It is not the most human efficient -- it will take
> some one reading the code non-trivial effort to
> understand it.
>
> Whether time or code clarity are more important
> depends on the particular application.
>
> Patrick Burns
> [EMAIL PROTECTED]
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
>
> [EMAIL PROTECTED] wrote:
>> It seems that this solution provided by Dan (and also available in
>> SPoetry; I'm sorry I didn't notice it) is the fastest and simplest. I
>> was
>> using a more standard approach:
>>
>> V <- t(A)[(0:(nrow(A)-1))*ncol(A)+X],
>>
>> That wasn't bad, but I was confident that you, R gurus, could outperform
>> this. This is clearly a much better solution.
>>
>> Thanks all, and best wishes,
>> Javier
>> --
>>
>>
>>
>>
>>
>>> on 08/09/2008 06:52 AM Dan Davison wrote:
>>>
 On Sat, Aug 09, 2008 at 06:29:59AM -0500, Marc Schwartz wrote:

> on 08/09/2008 06:01 AM [EMAIL PROTECTED] wrote:
>
>> Hi;
>> If we have a matrix A, and a vector X, where length(X)=nrow(A), and
>> X
>> contains a wanted column for each row in A, in row ascending order.
>> How
>> would be the most effective way to extract the desired vector V
>> (with
>> length(V)=nrow(A))?
>>
> A <- matrix(1:20, 4, 5)
>
>
>> A
>>
>  [,1] [,2] [,3] [,4] [,5]
> [1,]159   13   17
> [2,]26   10   14   18
> [3,]37   11   15   19
> [4,]48   12   16   20
>
>
> # Create an arbitrary set of indices, one for each row in A
> X <- c(2, 5, 1, 4)
>
>
>> X
>>
> [1] 2 5 1 4
>
>
> Presumably you want:
>
> V <- c(A[1, 2], A[2, 5], A[3, 1], A[4, 4])
>
>
>> V
>>
> [1]  5 18  3 16
>
>
> If so, then:
>
>
>> sapply(seq(nrow(A)), function(i) A[i, X[i]])
>>
> [1]  5 18  3 16
>
 Or


> A[cbind(seq(nrow(A)), X)]
>
 [1]  5 18  3 16

 Dan

>>> Better (and faster) solution Dan.
>>>
>>> I can't blame the lack of coffee on missing that one this morning. I
>>> have had a full pot already over the past 6 hours, working on shifting
>>> my internal clock and getting ready to begin my journey to Dortmund
>>> later tonight...
>>>
>>> Safe travels to all who are going.
>>>
>>> Marc
>>>
>>>
>>>
>>
>> __
>> R-help@r-project.org 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-help@r-project.org 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.


Re: [R] effective matrix subset

2008-08-09 Thread jgarcia
It seems that this solution provided by Dan (and also available in
SPoetry; I'm sorry I didn't notice it) is the fastest and simplest. I was
using a more standard approach:

V <- t(A)[(0:(nrow(A)-1))*ncol(A)+X],

That wasn't bad, but I was confident that you, R gurus, could outperform
this. This is clearly a much better solution.

Thanks all, and best wishes,
Javier
--




> on 08/09/2008 06:52 AM Dan Davison wrote:
>> On Sat, Aug 09, 2008 at 06:29:59AM -0500, Marc Schwartz wrote:
>>> on 08/09/2008 06:01 AM [EMAIL PROTECTED] wrote:
 Hi;
 If we have a matrix A, and a vector X, where length(X)=nrow(A), and X
 contains a wanted column for each row in A, in row ascending order.
 How
 would be the most effective way to extract the desired vector V (with
 length(V)=nrow(A))?
>>>
>>> A <- matrix(1:20, 4, 5)
>>>
 A
>>>  [,1] [,2] [,3] [,4] [,5]
>>> [1,]159   13   17
>>> [2,]26   10   14   18
>>> [3,]37   11   15   19
>>> [4,]48   12   16   20
>>>
>>>
>>> # Create an arbitrary set of indices, one for each row in A
>>> X <- c(2, 5, 1, 4)
>>>
 X
>>> [1] 2 5 1 4
>>>
>>>
>>> Presumably you want:
>>>
>>> V <- c(A[1, 2], A[2, 5], A[3, 1], A[4, 4])
>>>
 V
>>> [1]  5 18  3 16
>>>
>>>
>>> If so, then:
>>>
 sapply(seq(nrow(A)), function(i) A[i, X[i]])
>>> [1]  5 18  3 16
>>
>> Or
>>
>>> A[cbind(seq(nrow(A)), X)]
>> [1]  5 18  3 16
>>
>> Dan
>
> Better (and faster) solution Dan.
>
> I can't blame the lack of coffee on missing that one this morning. I
> have had a full pot already over the past 6 hours, working on shifting
> my internal clock and getting ready to begin my journey to Dortmund
> later tonight...
>
> Safe travels to all who are going.
>
> Marc
>
>

__
R-help@r-project.org 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] effective matrix subset

2008-08-09 Thread jgarcia
Hi;
If we have a matrix A, and a vector X, where length(X)=nrow(A), and X
contains a wanted column for each row in A, in row ascending order. How
would be the most effective way to extract the desired vector V (with
length(V)=nrow(A))?

Wishes,
Javier

__
R-help@r-project.org 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] a little help for compiling R! <- DISREGARD!

2008-08-06 Thread jgarcia
Hi,
I'm sorry for the quick question, I've have just found the correct syntax
(in an old message of
Prof.Ripley to the list), compiled correclty the code, and checked
everything goes fine.

Best wishes,
Javier
---

> Hi; I'm trying to install R in a computer in which I have only non-root
> access, and I've got readline in a local own directory.
>
> I cannot find my way to compile with readline. I've tried:
>
> [sun2]/global/jgarcia/SRC/R/R-2.7.1: ./configure
> --prefix=/global/jgarcia/BIN/R
> --with-readline-includes=/global/jgarcia/BIN/readline/include
> --with-readline-libs=/global/jgarcia/readline/lib
>
> Pointing to my local readline directories, but this doesn't have any
> effect, as I obtain:
>
> configure: error: --with-readline=yes (default) and headers/libs are not
> available
>
> Please, could you help with this?
>
> Best regards,
> jgarcia
> ---
>
>

__
R-help@r-project.org 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] a little help for compiling R!

2008-08-06 Thread jgarcia
Hi; I'm trying to install R in a computer in which I have only non-root
access, and I've got readline in a local own directory.

I cannot find my way to compile with readline. I've tried:

[sun2]/global/jgarcia/SRC/R/R-2.7.1: ./configure
--prefix=/global/jgarcia/BIN/R
--with-readline-includes=/global/jgarcia/BIN/readline/include
--with-readline-libs=/global/jgarcia/readline/lib

Pointing to my local readline directories, but this doesn't have any
effect, as I obtain:

configure: error: --with-readline=yes (default) and headers/libs are not
available

Please, could you help with this?

Best regards,
jgarcia
---

__
R-help@r-project.org 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.


Re: [R] Turn any vector

2008-07-10 Thread jgarcia
> rev(1:10)
 [1] 10  9  8  7  6  5  4  3  2  1
>
Javier


> Dear R-users,
>
> I'd like to turn a vector so it starts with it's end. For better
> understanding, this set of commands will do what I need:
>
> i <- seq(1:10)
> i_turned <- i
> for (j in 1:length(i)) i_turned[j] <- i[length(i)-j+1]
>
> now, i_turned is what I call turned. Is there a function which would make
> a
> script lighter? Thank you upfront for any hint.
>
> Best regards,
> Zroutik
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org 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-help@r-project.org 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.


Re: [R] extracting elements from a list in vectorized form

2008-07-01 Thread jgarcia
Perfect!!
Thanks a lot!
Javier
---
> [EMAIL PROTECTED] wrote:
>> Hi;
>> It seems to me that has probably been asked in the past. But I cannot
>> find
>> the track.
>>
>> I usually need to extract elements from a list and contruct vector from
>> them; e.g., to create a table. Perhaps there is a way to directly
>> extract
>> them without looping?
>> Simple example:
>>
>>
>>> S.lst
>>>
>> $sublist.1
>> $sublist.1$age
>> [1] 24.58719
>>
>> $sublist.1$weight
>> [1] 60.82861
>>
>>
>> $sublist.2
>> $sublist.2$age
>> [1] 32.39551
>>
>> $sublist.2$weight
>> [1] 59.46347
>>
>> etc.
>>
>> I would like to extract, e.g.,  directly all weights element from each
>> sublist without looping. I  know it is possible to do this as:
>>
>> unlist(S.lst)[paste("sublist.",1:length(S.lst),".weight",sep="")]
>>
>> but there is not some short-cut? something like
>>
>> S.lst[[1:length(S.lst)]]$weight ?
>>
>>
> I think this should do it:
>
> sapply(S.lst, "[[", "weight")
>
> --
>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
>
>

__
R-help@r-project.org 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] extracting elements from a list in vectorized form

2008-07-01 Thread jgarcia
Hi;
It seems to me that has probably been asked in the past. But I cannot find
the track.

I usually need to extract elements from a list and contruct vector from
them; e.g., to create a table. Perhaps there is a way to directly extract
them without looping?
Simple example:

> S.lst
$sublist.1
$sublist.1$age
[1] 24.58719

$sublist.1$weight
[1] 60.82861


$sublist.2
$sublist.2$age
[1] 32.39551

$sublist.2$weight
[1] 59.46347

etc.

I would like to extract, e.g.,  directly all weights element from each
sublist without looping. I  know it is possible to do this as:

unlist(S.lst)[paste("sublist.",1:length(S.lst),".weight",sep="")]

but there is not some short-cut? something like

S.lst[[1:length(S.lst)]]$weight ?


Thanks and B.regards

Javier
--

__
R-help@r-project.org 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.


Re: [R] Recoding

2008-06-28 Thread jgarcia
Agustín;

also you can do:

> v <- c(1,1,1,2,3,4,1,10,3)
> dict <- cbind(c(1,2,3),c(1001,1002,1003))
> v <- ifelse(!is.na(match(v,dict)),dict[match(v,dict),2],v)
> v
[1] 1001 1001 1001 1002 10034 1001   10 1003

Javier
-

> Dear Agustin,
>
> Perhaps
>
> v1 <- c(1,1,1,2,3,4,1,10,3)
> dput(as.numeric(ifelse(v1%in%c(1,2,3),paste(100,v1,sep=""),v1)))
>
> HTH,
>
> Jorge
>
>
> On Fri, Jun 27, 2008 at 2:41 PM, Agustin Lobo <[EMAIL PROTECTED]> wrote:
>
>> Hi!
>>
>> Given a vector (or a factor within a df),i.e. v1 <-
>> c(1,1,1,2,3,4,1,10,3)
>> and a dictionary
>> cbind(c(1,2,3),c(1001,1002,1003))
>>
>> is there a function (on the same line than recode() in car)
>> to get v2 as c(1001,1001,1001,1002,1003,4,1001,10,1003) ?
>>
>> I'm using myself a function based on match() since
>> long ago (I think that thanks to advice by Prof. B. Ripley),
>> but would like to know if there is an standard function (i.e., like
>> recode()). What I'm using is:
>>
>> "reclas" <- function(v, origen, imagen, directo = T, resto=1)
>> {
>>if(directo == F) {
>>aux <- origen
>>origen <- imagen
>>imagen <- aux
>>}
>>m <- match(v, origen, 0)
>>#print("match finished")
>>if(resto==0) v <- v*0
>>v[m > 0] <- imagen[m]
>>v
>> }
>>
>> Agus
>>
>> --
>> Dr. Agustin Lobo
>> Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
>> LLuis Sole Sabaris s/n
>> 08028 Barcelona
>> Spain
>> Tel. 34 934095410
>> Fax. 34 934110012
>> email: [EMAIL PROTECTED]
>> http://www.ija.csic.es/gt/obster
>>
>> __
>> R-help@r-project.org 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.
>>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org 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.
>
Javier García-Pintado
Department of Water and Soil Conservation
CEBAS-CSIC
Campus de Espinardo
PO BOX 164
30100 Espinardo (Murcia)
Spain
Tel: +34 630 20 77 58
Fax: +34 968 39 62 13

__
R-help@r-project.org 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.


Re: [R] subset with multiple criteria

2008-06-23 Thread jgarcia
Thanks for your answers.
I'm sorry. I'm afraid I didn't pose correctly the question , and the use
os "subset" was misleading. What I need is to obtain the index of the
corresponding rows in E.coor, to subtitute the corresponding values by new
updated values.

The closest answer to what I really need is that of Jim Holtman, but it
does not seem to work correctly as it does not check that the two
conditions (equal East, and equal North) apply simultaneously for each
individual row. e.g, let's suposse E.coor and subset.coor are exactly:

> E.coor
 east   north   dat
1  582650 4248850 0.8316848
2  582750 4248850 0.7230272
3  582850 4248850 0.3250818
4  582950 4248850 0.6144006
5  583050 4248850 0.8706312
6  583150 4248850 0.2149651
7  583250 4248850 0.1659519
8  583350 4248850 0.2145174
9  583450 4248850 0.1615151
10 582950 4248850 0.9370766
> subset.coor
east   north newdat
1 582650 42488501.2
4 582950 42488502.5
6 583150 42488500.6
> E.coor[E.coor$east %in% subset.coor$east & E.coor$north %in%
subset.coor$north,]
 east   north   dat
1  582650 4248850 0.8316848
4  582950 4248850 0.6144006
6  583150 4248850 0.2149651
10 582950 4248850 0.9370766

while I didn't intent to get the row 10

So, I can not use this syntax to substitute E.coor[c(1,4,6),"dat"] by the
new corresponding values subset.coor[,"newdat"].

I'm Sorry for my previously badly posed problem.

Any suggestion about this?

Javier
-










> You can also do this:
>
>> E[(E$east %in% sub$east) & (E$north %in% sub$north),]
> east   north   dat
> 1 582650 4248850 0.8316848
> 7 583250 4248850 0.1659519
>>
>
>
> On Mon, Jun 23, 2008 at 12:32 PM,  <[EMAIL PROTECTED]> wrote:
>> This should be theoretically very simple, but I dont get the elegant
>> answer (without looping).
>>
>> I've got a long (thousands of rows) data frame:
>>
>>> E.coor[1:10,]
>> east   north   dat
>> 1  582650 4248850 0.8316848
>> 2  582750 4248850 0.7230272
>> 3  582850 4248850 0.3250818
>> 4  582950 4248850 0.6144006
>> 5  583050 4248850 0.8706312
>> 6  583150 4248850 0.2149651
>> 7  583250 4248850 0.1659519
>> 8  583350 4248850 0.2145174
>> 9  583450 4248850 0.1615151
>> 10 583550 4248850 0.9370766
>>
>> and need to extract those with the coordinates coinciding with those in
>> a
>> smaller data frame (about one hundred rows):
>>
>>> subset.coor
>> east   north
>> 20 584550 4248850
>> 21 584650 4248850
>> 22 584750 4248850
>> 23 584850 4248850
>> 24 584950 4248850
>> 25 585050 4248850
>>
>> i.e, I need the ~ one hundred E.coor rows that appear in subset.coor
>>
>> Could you help with this.
>>
>>
>> Best regards,
>> Javier
>> -
>>
>> __
>> R-help@r-project.org 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.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem you are trying to solve?
>

__
R-help@r-project.org 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] subset with multiple criteria

2008-06-23 Thread jgarcia
This should be theoretically very simple, but I dont get the elegant
answer (without looping).

I've got a long (thousands of rows) data frame:

> E.coor[1:10,]
 east   north   dat
1  582650 4248850 0.8316848
2  582750 4248850 0.7230272
3  582850 4248850 0.3250818
4  582950 4248850 0.6144006
5  583050 4248850 0.8706312
6  583150 4248850 0.2149651
7  583250 4248850 0.1659519
8  583350 4248850 0.2145174
9  583450 4248850 0.1615151
10 583550 4248850 0.9370766

and need to extract those with the coordinates coinciding with those in a
smaller data frame (about one hundred rows):

> subset.coor
 east   north
20 584550 4248850
21 584650 4248850
22 584750 4248850
23 584850 4248850
24 584950 4248850
25 585050 4248850

i.e, I need the ~ one hundred E.coor rows that appear in subset.coor

Could you help with this.


Best regards,
Javier
-

__
R-help@r-project.org 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] uncertainty bounds for a weighted moving average

2008-06-13 Thread jgarcia
Hi,
well; this is not a R-specific question. But perhaps you can help.
If I've got an irregularly sampled time series, and conduct a moving
average filter (e.g., with a triangular kernel), how could the uncertainty
bounds be calculated?

Thanks and best regards

J.
---

__
R-help@r-project.org 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.


Re: [R] library(Matrix) and image() colors?

2008-05-29 Thread jgarcia
Yes ,this work! Uhmm... Strange!
Thanks,
Javier
--
> On 5/28/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> Hi,
>>  I'm trying to produce a plot of an image of a Matrix, but I don't get
>>  other colors than the default grey scale:
>>
>>  > image(Matrix(topo.matrix.2),col.regions=topo.colors(100),colorkey=FALSE)
>>
>>  this still is plotted in grey.
>>
>>  Is there any mistake in my syntax?
>
> Not sure what the problem is, but although the first call does not
> work, the second one does:
>
> image(Matrix(volcano), col.regions = topo.colors(100), colorkey = TRUE)
>
> image(as(Matrix(volcano), "sparseMatrix"),
>   col.regions = topo.colors(100), colorkey = TRUE)
>
> -Deepayan
>

__
R-help@r-project.org 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] library(Matrix) and image() colors?

2008-05-28 Thread jgarcia
Hi,
I'm trying to produce a plot of an image of a Matrix, but I don't get
other colors than the default grey scale:

> image(Matrix(topo.matrix.2),col.regions=topo.colors(100),colorkey=FALSE)

this still is plotted in grey.

Is there any mistake in my syntax?

Thanks and regards,
Javier
--

__
R-help@r-project.org 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] spatial cross-correlation

2008-04-01 Thread jgarcia
Hi;
I cannot find in the R html documentation a way to evaluate
cross-correlation in 2D data sets.

I would like to evaluate cross-correlation in a series of moving windows
between two maps.

i,e, specify several windows inside the complete 2D spatial matrixes and
for each one ofthese windows evaluate the 2D cross-correlation (commonly
conducted in the spectral domain).

Thanks in advance and best wishes,

Javier GP
-

__
R-help@r-project.org 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.


Re: [R] how to plot a map on a non-rectilinear grid

2008-03-18 Thread jgarcia
There is another solution, which depending on the resolution and amount of
your data may be useful. You can find through interpolation the corners of
four coordinates around any data point that define a four sides polygon.
This grid so created does not need to be regular. Then, you can simple
call polygon() to draw each polygon whose color corresponds to the value
in related data set. This has worked perfectly for me.
regards,
Javier


> Costas Douvis  geol.uoa.gr> writes:
>
>>
>> Hi everyone
>>
>> I have a matrix (let's say that it contains the values of elevation) and
>> want to plot its values on a map using a function such as image.plot or
>> filled.contour. The problem is that my grid is not rectilinear, it is
>> bended. Here is an example
>>
> (example removed)
>>
>> All 3 matrices have dimensions 20x25. How can I plot elev values in the
>> grid points defined by lat and lon?
>
> You can flatten all three to triplets of (x, y, z) values, and colour-code
> the points, which, as you say, do not form a grid. image() and friends
> require either a matrix treated as a grid, or a list with the x and y
> margins and z as a matrix.
>
> Since these are not in a regular grid, the usual approach is to
> interpolate,
> perhaps using interp() in the akima package, or using other methods of
> your
> choice, so that you can plot the interpolated values on a regular grid.
>
> If you are considering plotting a grid with data based on geographical
> coordinates on a map in projected coordinates, the input rectangular
> cells can be projected, using object classes defined in the sp package,
> and functions provided in the same package, with projection using
> spTransform() methods in the rgdal package.
>
> Perhaps the R-sig-geo list would be more suited to your question?
>
> Roger Bivand
>
>>
>
> __
> R-help@r-project.org 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-help@r-project.org 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.


Re: [R] Help with 'memory not mapped'

2008-03-07 Thread jgarcia
Dear Ramon,
I'm afraid I'm the author of the C function. Although I'm not a 'real'
programmer I need to do some programming in my research work.
As you say, I've used MAKEFLAGS="CFLAGS=-O1", and valgrind, with the
expression you've said.

The content of the log file contains three blocks of the type:
-
==6464== Invalid read of size 8
==6464==at 0x401433E: (within /lib64/ld-2.6.1.so)
==6464==by 0x4009631: (within /lib64/ld-2.6.1.so)
==6464==by 0x5CAA804: (within /lib64/libc-2.6.1.so)
==6464==by 0x59B0143: (within /lib64/libdl-2.6.1.so)
==6464==by 0x400C8E5: (within /lib64/ld-2.6.1.so)
==6464==by 0x59B036C: (within /lib64/libdl-2.6.1.so)
==6464==by 0x59B00F9: dlsym (in /lib64/libdl-2.6.1.so)
==6464==by 0x54F60C: R_local_dlsym (dynload.c:214)
==6464==by 0x4172F8: AddDLL (Rdynload.c:565)
==6464==by 0x4179F3: do_dynload (Rdynload.c:895)
==6464==by 0x4C3A44: do_internal (names.c:1120)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==  Address 0x64A7608 is 24 bytes inside a block of size 27 alloc'd
==6464==at 0x4C21D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==6464==by 0x4172CC: AddDLL (Rdynload.c:557)
==6464==by 0x4179F3: do_dynload (Rdynload.c:895)
==6464==by 0x4C3A44: do_internal (names.c:1120)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
==6464==by 0x495C87: Rf_eval (eval.c:507)
==6464==by 0x4B4C04: Rf_ReplIteration (main.c:263)
==6464==by 0x4B4EB7: R_ReplConsole (main.c:312)
==6464==by 0x4B518F: run_Rmainloop (main.c:975)
==6464==by 0x414AF7: main (Rmain.c:35)
--

and after a lot of block of the type 'uninitialised value', it finishes
like this:

-
==6464== Conditional jump or move depends on uninitialised value(s)
==6464==at 0x5BF324C: (within /lib64/libc-2.6.1.so)
==6464==by 0x5BFB8FA: __printf_fp (in /lib64/libc-2.6.1.so)
==6464==by 0x5BF5587: vfprintf (in /lib64/libc-2.6.1.so)
==6464==by 0x5BFE509: printf (in /lib64/libc-2.6.1.so)
==6464==by 0x88ACE24: rainfallrunoffmodel (rain_runoff_modelv1_2.c:517)
==6464==by 0x4750D1: do_dotcall (dotcode.c:1136)
==6464==by 0x495F36: Rf_eval (eval.c:489)
==6464==by 0x49698F: do_begin (eval.c:1159)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
==6464==by 0x495C87: Rf_eval (eval.c:507)
==6464==by 0x499B6E: do_set (eval.c:1407)
==6464==
==6464== Invalid write of size 8
==6464==at 0x88AD228: rainfallrunoffmodel (rain_runoff_modelv1_2.c:595)
==6464==by 0x4750D1: do_dotcall (dotcode.c:1136)
==6464==by 0x495F36: Rf_eval (eval.c:489)
==6464==by 0x49698F: do_begin (eval.c:1159)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
==6464==by 0x495C87: Rf_eval (eval.c:507)
==6464==by 0x499B6E: do_set (eval.c:1407)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x49698F: do_begin (eval.c:1159)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x49938D: do_for (eval.c:1058)
==6464==  Address 0x26C7E9E0 is not stack'd, malloc'd or (recently) free'd
==6464==
==6464== Syscall param write(buf) points to uninitialised byte(s)
==6464==at 0x5C6AC40: write (in /lib64/libc-2.6.1.so)
==6464==  Address 0x402A3DB is not stack'd, malloc'd or (recently) free'd
==6464==
==6464== ERROR SUMMARY: 35923 errors from 210 contexts (suppressed: 244
from 3)
==6464== malloc/free: in use at exit: 284,245,283 bytes in 14,390 blocks.
==6464== malloc/free: 89,306 allocs, 74,916 frees, 1,051,054,834 bytes
allocated.
==6464== For counts of detected errors, rerun with: -v
==6464== searching for pointers to 14,390 not-freed blocks.
==6464== checked 141,122,600 bytes.
==6464==
==6464==
==6464== 64 bytes in 16 blocks are definitely lost in loss record 12 of 54
==6464==at 0x4C21D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==6464==by 0x4C21D80: realloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==6464==by 0x51BE04: parse_expression (regex.c:5205)
==6464==by 0x51BFF3: parse_branch (regex.c:4715)
==6464==by 0x51C07F: parse_reg_exp (regex.c:4667)
==6464==by 0x51C9A6: Rf_regcomp (regex.c:4636)
==6464==by 0x43BD06: do_gsub (character.c:1222)
==6464==by 0x4C3A44: do_internal (names.c:1120)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x49698F: do_begin (eval.c:1159)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
==6464==
==6464==
==6464== 87 bytes in 2 blocks are definitely lost in loss record 13 of 54
==6464==at 0x4C21D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==6464==by 0x8AD7DBE: G_strdup (strings.c:195)
==6464==by 0x8AD5A78: G_site_get_head (sites.c:818)
==6464==by 0x8AD6808: sitesget (sitesget.c:66)
==6464==by 0x47757D: do_dotcall (dotcode.c:868)
==6464==by 0x4

[R] Help with 'memory not mapped'

2008-03-07 Thread jgarcia
Hi,
I'm no expert programmer at all;
I'm running an R script ("mariam1_2.R"). This scripts calls another
script, which contains an R function, which .Call some C code.
It runs several times without any problem, but sometimes I get the error:
---
 *** caught segfault ***
address 0x1c404ec8, cause 'memory not mapped'

Traceback:
 1: .Call("rrfunc", as.double(dx), as.integer(nrows), as.integer(ncols),
as.double(deltadt), as.character(binmaps), as.integer(ldd),
as.double(downst),as.integer(outl), as.double(maxinte), as.double(nmn))
 2: rrfuncR(dx, nrows, ncols, delta.t,binmaps.pathed,ldd,downst,
out.index,interc,n.man)
 3: eval.with.vis(expr, envir, enclos)
 4: eval.with.vis(ei, envir)
 5: source("rrprogv1_2.R")
 6: eval.with.vis(expr, envir, enclos)
 7: eval.with.vis(ei, envir)
 8: source("mariam1_2.R")

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
---
I've seen something related in the documentation, but it is not easy to
understand it for me. I'm trying to perform a Monte Carlo analysis that
calls the function iteratively. My question is why sometimes I can call
forty or fifty times the function without any problem, and other times it
crashes at the first, second or 6th time. Can you give me any advice?

Thanks and best regards,
Javier

__
R-help@r-project.org 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] Error with stop()

2008-02-15 Thread jgarcia
Hello;
I've used stop() previously without any problem.
Now, I'm using a condition and getting an error when stop() is called.

Mi condition is:

if(dim(r.temp)[1] != (length(jul.names)+6)) stop("buffered data not
available")


An the R' response is:

> source("my_program.R")
Error in eval.with.vis(expr, envir, enclos) :
  buffered data not available
>

Can you help me with this?

Best regards,
Javier

__
R-help@r-project.org 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] basic spatial query

2008-01-28 Thread jgarcia
Hello;
Please coud you advise me of a simple way to select points (x,y
coordinates) that fall within a polygon.
I've got a set of polygons, each one defined by an arbitrary number of
points, and several points inside each polygon.
I know this is simple with a GIS, but I'd rather do it inside R.
Thanks and best regards,
Javier
-

__
R-help@r-project.org 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] geometric transformation

2008-01-22 Thread jgarcia
Hi everyone,

I've got a set of thousands points (2D) located on a pixel image, and I
know that four points in this pixels image correspond to four points in a
real space on which I need to locate the mapping of all the thousand
source points from the pixel set.
For this I've got four reference points (corners.px), and the
corresponding four destination points (corners.r):

> corners.px
  [,1]  [,2]
[1,] 212.5 275.5
[2,] 562.5 275.5
[3,] 212.5 625.5
[4,] 562.5 625.5

> corners.r
   [,1]  [,2]
[1,] 139463  8386
[2,] 139579 -1294
[3,] 131921  8180
[4,] 132002 -1256

I think I must find a transformation matrix and apply this transformation
matrix to all the set in the pixel space, but cannot find the way to
contruct this transformation matrix.
I guess this is not a question just pertaining to R, but perhaps you can
help me with this.

Thank you and best regards!

Javier
-

__
R-help@r-project.org 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] manual parallel processing

2007-11-22 Thread jgarcia
Hi;
I have a R script that includes a call to genoud(); genoud process lasts
about 4 seconds, what would be OK if I hadn't have to call it about 2000
times. This yields about 2 hours of processing.
And I would like to use this script operationally; so that it should be
run twice a day. It seems to me that the parallel processing option
included in genoud() divides the task inside the function among the
computers included in the cluster. On the other hand, my consecutive calls
to genoud() are independent of each other, but all depend on objects
stored in the R workspace. I think that communication time among computer
for a 4 second task, repeated 2000 times should be slower that to divide
the calls to genoud among the number of available computers. So, perhaps a
viable option to speed up the process could be something as:

1) Somehow make a copy from the workspace on the fly (I mean put some
command, before the loop that call genoud(), to export the workspace in
its actual state to other computers)
2) divide the task in the number of available computers in the
network;e.g, if I've got my "localhost" and 3 computers more:
n.comp  <- 4
nsteps  <- 1987
steps.c <- trunc(nsteps/n.comp)
steps.c <- (1:n.comp)*steps.c
steps.c <-  c(steps.c[1:(n.comp-1)],nsteps)
steps.i <- c(1,steps.c[-n.comp]+1)
for(ic in 1:n.comp){
 Somehow start remotely R, read the copied workspace and execute in
computer ic for(i in
steps.i[ic]:steps.c[ic]){something[i];genoud(f(i));somethin.else[i]}
 and somehow get back results from ic
}
3) concacenate results in my "localhost" workspace

You can see I'm rather lost with this. Could you help with this?

Regards,
Javier

__
R-help@r-project.org 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.