[R] Files and classes in a package?

2004-07-22 Thread Shin, Daehyok
While installing my small package, I met a tricky problem. For clarity, let me explain it with the following simplified example. In ~/pkg/R/aclass.R, setClass(“aclass”, contains=”bclass”, representation(i=”numeric”)) In ~/pkg/R/bclass.R, setClass(“bclass”, representation(j=”numeric”)) Af

RE: [R] where does R search when source()?

2004-07-11 Thread Shin, Daehyok
> >Considering replies to my question, typical practices of R users seem: > >1. Creating a special function to source frequently used scripts. > > That's not right. The practice I was describing is to have frequently > used code in a function, not in a script. Here, I meant "scripts " is "script

RE: [R] where does R search when source()?

2004-07-11 Thread Shin, Daehyok
I agree that this is a good use for a script, but I don't think it's what Daehyok was talking about. He wants a library of frequently used scripts to be available in multiple projects. In R, the best way to do that isn't to use scripts at all, it's to put the code in functions. What I asked is t

RE: [R] where does R search when source()?

2004-07-10 Thread Shin, Daehyok
Considering replies to my question, typical practices of R users seem: 1. Creating a special function to source frequently used scripts. 2. Creating a personal package containing frequently used scripts. Both of them needs additional steps to edit the function or to create/install the package when

RE: [R] where does R search when source()?

2004-07-10 Thread Shin, Daehyok
ot really. The best I can come up with is something like: > > runScript <- function(script, dir="", ...) source(file.path(dir, script, > ...) > scriptdir <- "/path/to/scripts" > > runScript(scriptdir, "myScript.R") > > Andy > > >

RE: [R] where does R search when source()?

2004-07-10 Thread Shin, Daehyok
The reason I asked is to separate script files from data files. Usually, I am working in the directory containing data files, but some script files are in other shared directories. In the case, is there any way to access the script files conveniently without specifying its absolute path? In other w

[R] where does R search when source()?

2004-07-10 Thread Shin, Daehyok
Exactly where does R search for foo.R if I type source(“foo.R”)? Only from current working directory (same as getwd()), from all directories specified by e.g. $PATH? Thanks. Daehyok Shin __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/m

[R] Module for Recursive Instrumental Variable Method

2004-06-25 Thread Shin, Daehyok
I am looking for R programs implementing RIV(Recursive Instrumental Variable) method to identify and estimate constant parameter TF(Transfer Function) models. Help please, if you know it. Daehyok Shin (Peter) __ [EMAIL PROTECTED] mailing list https://ww

RE: [R] system shell emulation in R

2004-06-24 Thread Shin, Daehyok
Is it difficult in R to create a function calling system() with user's inputs iteratively? Daehyok Shin (Peter) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Prof Brian Ripley > Sent: Thursday, June 24, 2004 PM 2:28 > To: Shin, D

[R] system shell emulation in R

2004-06-24 Thread Shin, Daehyok
Rather than using system() to execute a shell command, is there a way to emulate the system shell itself in R? For instance, if the function is shell, > getwd() [1] "/home/a/b" > shell() # From R to system shell $cd .. # cd command in system shell $CTRL+D# Return to

RE: [R] A way to list only variables or functions?

2004-06-21 Thread Shin, Daehyok
doch; [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [R] A way to list only variables or functions? > > > > > On 21 Jun 2004 at 10:39, Duncan Murdoch wrote: > > > On Mon, 21 Jun 2004 09:53:35 -0400, "Shin, Daehyok" > > <[EMAIL PROTECTED]> wr

RE: [R] A way to list only variables or functions?

2004-06-21 Thread Shin, Daehyok
I am not familar with the unique terminology of R. What I mean with a variable is a sort of a reference which points to a function or a value. Daehyok Shin > -Original Message- > From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] > Sent: Monday, June 21, 2004 AM 10:26 > To: S

RE: [R] binary data

2004-06-21 Thread Shin, Daehyok
I use NetCDF file format using ncdf package for binary data handling. For more complex structure, HDF format will be better, which I do not try in R. Daehyok Shin > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > ethz.ch]On Behalf Of Moises Hassan > Sent: Tuesday,

RE: [R] A way to list only variables or functions?

2004-06-21 Thread Shin, Daehyok
practical value. Daehyok Shin > -Original Message- > From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 20, 2004 PM 12:03 > To: Shin, Daehyok > Cc: [EMAIL PROTECTED] > Subject: RE: [R] A way to list only variables or functions? > > > On Sun,

RE: [R] A way to list only variables or functions?

2004-06-20 Thread Shin, Daehyok
Interesting, but it seems too complex. In my opinion, just listing functions or non-functions meets my need. Anyway, thanks. Daehyok Shin (Peter) > -Original Message- > From: S?en Merser [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 20, 2004 AM 10:51 > To: Shin > Subject: Re: [R] A way t

RE: [R] A way to list only variables or functions?

2004-06-20 Thread Shin, Daehyok
Neat! Thanks. How about incorporating this support into standard commands, ls() or objects()? Daehyok Shin (Peter) > -Original Message- > From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 20, 2004 AM 10:06 > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: RE: [R]

RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
Thanks, Richard. This is what I was looking for. As you said, the chron package seems so useful that I will use it a lot. I don't think the performance gain (53:31) is not what we can neglect. Still, I am wondering why this kind of intuitive interface is not supported through the base package. Dae

RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
r Bivand [mailto:[EMAIL PROTECTED] > Sent: Monday, June 07, 2004 PM 1:02 > To: Shin, Daehyok > Cc: R, Help > Subject: RE: [R] Vectors of years, months, and days to dates? > > > On Mon, 7 Jun 2004, Shin, Daehyok wrote: > > > > > res <- as.POSIXlt(paste(years, mon

RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
___ > James Holtman"What is the problem you are trying to solve?" > Executive Technical Consultant -- Office of Technology, Convergys > [EMAIL PROTECTED] > +1 (513) 723-2929 > > > > >

RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
.POSIXlt(paste(years, months, days, sep="-")) > > str(res) > `POSIXlt', format: chr [1:2] "1991-01-01" "1992-10-02" > > res$year > [1] 91 92 > > > > > Daehyok > > > > --On Monday, June 07, 2004 4:44 PM +0100 Prof B

[R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
The interface for dates in R is a little confusing to me. I want to create a vector of Date objects from vectors of years, months, and days. One solution I found is: years <- c(1991, 1992) months <- c(1, 10) days <- c(1, 2) dates <- as.Date(ISOdate(years, months, days)) But, in this solution the

RE: [R] How to define a destructor of an object?

2004-05-18 Thread Shin, Daehyok
ey > Sent: Tuesday, May 18, 2004 AM 10:29 > To: Shin, Daehyok > Cc: R, Help > Subject: Re: [R] How to define a destructor of an object? > > > On Tue, 18 May 2004, Shin, Daehyok wrote: > > > Is there any way to define a destructor method of an object, > > which is called

[R] How to define a destructor of an object?

2004-05-18 Thread Shin, Daehyok
Is there any way to define a destructor method of an object, which is called automatically when garbage collector reclaims it? Daehyok Shin __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the postin

RE: [R] How to restore and edit saved graphics?

2004-05-16 Thread Shin, Daehyok
Thanks for the interesting solution. I am happy to find a way to save all graphic options into a file. There is a minor glitch. Is there is any way to replace title, not to overwrite it? And if I want to change the color of a line or the ranges of x or y axis, how can I do it with the restored plot

RE: [R] How to restore and edit saved graphics?

2004-05-15 Thread Shin, Daehyok
Is it so difficult to develop a function or an object to generate all the code automatically in R? Daehyok Shin (Peter) Terrestrial Hydrological Ecosystem Modellers Geography Department University of North Carolina-Chapel Hill [EMAIL PROTECTED] "We can do no great things, only small things with g

[R] Can't find memory.size()

2004-04-19 Thread Shin, Daehyok
I try memory.size function to find out available memory size, but surprisingly R complains it can't find the function. ?memory.size also failed. Is it not in the base library? If so, why can't my R find it? I am using the binary 1.9.0 version for Mandrake 9.1. Thanks in advance. Daehyok Shin Terr

RE: [R] Only referenc copy when calling C routine?

2004-04-11 Thread Shin, Daehyok
Thanks, Murdoch. The .Call is what I want. In R extension manual, " Neither .Call nor.External copy their arguments. You should treat arguments you receive through these interfaces as read-only. " Daehyok Shin > -Original Message- > From: Duncan Murdoch [mailto:[EMAIL PROTECTED] > Sent:

RE: [R] Only referenc copy when calling C routine?

2004-04-11 Thread Shin, Daehyok
Thanks, Andy. Let me ask a little more about the DUP argument. In the manual, I can see that only reference copy happens when passing an array, if DUP=FALSE. Then, what happens when returning it in a list, if DUP=FALSE? Another reference copy, or deep copy? I am trying to implement a dynamic model

[R] Only referenc copy when calling C routine?

2004-04-11 Thread Shin, Daehyok
What happens when I pass an array to a dynamically linked C routine? Is only its reference copied when an array is passed and returned? Or, is its whole content copied? In R extension manual, I found the following description. But, I can't know exactly which is true. "There can be up to 65 furthe

RE: [R] More user-friendly error message needed.

2004-04-08 Thread Shin, Daehyok
Hi, Bob. As I said, I just begin to learn R, so I am not in a proper position to compare the languages. But, two things of R immediately captured my attention. Pro. A lot of standard libraries including a powerful visualization, like MATLAB. As a scientific programmer, I really missed this kind of

[R] A package to read and write NetCDF?

2004-04-05 Thread Shin, Daehyok
I am looking for a package to read and write NetCDF files. NetCDF package says it can only read, not write. Another package for the standard binary file format? Daehyok Shin __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinf

RE: [R] Deep copy in R

2004-04-05 Thread Shin, Daehyok
Of Thomas Lumley > Sent: Monday, April 05, 2004 PM 5:18 > To: Shin, Daehyok > Cc: R, Help > Subject: Re: [R] Deep copy in R > > > On Mon, 5 Apr 2004, Shin, Daehyok wrote: > > > I am handling spatial data of huge volumes, > > so sensitive to the silent duplication of

[R] Deep copy in R

2004-04-05 Thread Shin, Daehyok
I am handling spatial data of huge volumes, so sensitive to the silent duplication of data in script programs. In the following R program, exactly when is the vector data deeply copied? Thanks in advance. 1 v <- 1:1 2 z <- f(v) - function f -- 3 f <- function(x) { 4 y = x