Re: [R] How can we ring a bell in Windows?

2005-03-08 Thread Martin Maechler
 Duncan == Duncan Murdoch [EMAIL PROTECTED]
 on Mon, 07 Mar 2005 19:32:17 + writes:

Duncan On Mon, 7 Mar 2005 18:18:37 + (GMT), Prof Brian
Duncan Ripley [EMAIL PROTECTED] wrote :

 On Mon, 7 Mar 2005, Duncan Murdoch wrote:
 
 On Tue, 8 Mar 2005 00:31:07 +0800 (CST), Lu Joseph
 [EMAIL PROTECTED] wrote :
 
 Hello useRs,
 
 Is there a way to write code in R to ring a bell in
 Windows?
  If you load the tcltk package, then
 
 tkbell()
 
 will get you a bell on more platforms than just Windows.
 If you don't want to use tcltk, then you could call the
 Windows API function MessageBeep from some C code, but I
 don't think we have a bell or beep function in the
 standard R packages.
  But there is the ANSI \a: cat(\n) works as expected,
 on all platforms.

{and of course,   cat(\a)   was meant above}

Duncan Perhaps we should have a beep() or bell() function,
Duncan to remind those of us who never knew all the C
Duncan escapes and wouldn't have guessed that the ancient
Duncan ASCII control codes still function.

Duncan I'll put it on my list...
Duncan Duncan Murdoch

good.  Yes that would be a very sensible encapsulation of
functionality.

Note that ASCII control codes don't work on all
kinds of terminals, e.g., they don't work in ESS  --- but ESS
could be made to react smartly to a beep() function call.

Martin





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

__
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] 3D plot not working as desired!

2005-03-08 Thread Duncan Murdoch
On Tue, 8 Mar 2005 01:50:04 -0600, [EMAIL PROTECTED] wrote :

Hello R-users!

I am trying to plot 3 vectors (x,y,z) of observations
generated by mvrnorm in library(MASS).

I tried plot3d in library(djmrgl) and scatterplot3d.
But these program gives x,y,z axis which do not 
intersect at the origin (0,0,0). 

The default in R is to create axes outside the range of your data, and
that's what djmrgl and scatterplot3d do.  In djmrgl you can control
the placement of the axes if you really want them in the middle of
your data, but why would you want that?? 

See the example in ?axis3d for details.

I searched through all the graphics related packages
for R like xgobi, ggobi, grid and more. Quite
confusing which one to choose.

Would anyone recommend any way to plot the 3-dimensional
randomly generated numbers? It would be very nice if it
can create 95% confidence region ellisoid around the
observations, just like the 95% confidence ellipse around
the bivariate normal random numbers.

I don't know a package that does that, but there probably is one.

Duncan Murdoch

__
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] a==0 vs as.integer(a)==0 vs all.equal(a,0)

2005-03-08 Thread Robin Hankin
hi
?integer says:
 Note that on almost all implementations of R the range of
 representable integers is restricted to about +/-2*10^9: 'double's
 can hold much larger integers exactly.
I am getting very confused as to when to use integers and when not to.  
In my line
I need exact comparisons of large integer-valued arrays, so I often use 
as.integer(),
but the above seems to tell me that doubles might  be better.

Consider the following R idiom of Euclid's algorithm for the highest 
common factor
of two positive integers:

  gcd - function(a, b){
if (b == 0){ return(a)}
return(Recall(b, a%%b))
  }
If I call this with gcd(10,12), for example, then  a%%b is not an 
integer, so the first
line of the function, testing b for being zero, isn't legitimate.

OK, so I have some options:
(1) stick in a - as.integer(a),  b - as.integer(b) into the 
function:  then a%%b *will* be an
   integer and the == test is appropriate
(2) use some test like abs(b)  TOL for some suitable TOL (0.5?)
(3) use identical(all.equal(b,0),TRUE) like it says in identical.Rd
(4) use identical(all.equal(b,as.integer(0)),TRUE)

How does the List deal with this kind of problem?
Also, gcd() as written returns a non-integer.  Would the List recommend 
rewriting the last
line as

return(as.integer(Recall(b,a%%b)))
or not?
--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
 tel  023-8059-7743
__
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] a==0 vs as.integer(a)==0 vs all.equal(a,0)

2005-03-08 Thread Peter Dalgaard
Robin Hankin [EMAIL PROTECTED] writes:

 hi
 
 
 ?integer says:
 
   Note that on almost all implementations of R the range of
   representable integers is restricted to about +/-2*10^9: 'double's
   can hold much larger integers exactly.
 
 
 I am getting very confused as to when to use integers and when not to.
 In my line
 I need exact comparisons of large integer-valued arrays, so I often
 use as.integer(),
 but the above seems to tell me that doubles might  be better.
 
 Consider the following R idiom of Euclid's algorithm for the highest
 common factor
 of two positive integers:
 
gcd - function(a, b){
  if (b == 0){ return(a)}
  return(Recall(b, a%%b))
}
 
 If I call this with gcd(10,12), for example, then  a%%b is not an
 integer, so the first
 line of the function, testing b for being zero, isn't legitimate.
 
 OK, so I have some options:
 
 (1) stick in a - as.integer(a),  b - as.integer(b) into the
 function:  then a%%b *will* be an
 integer and the == test is appropriate
 (2) use some test like abs(b)  TOL for some suitable TOL (0.5?)
 (3) use identical(all.equal(b,0),TRUE) like it says in identical.Rd
 (4) use identical(all.equal(b,as.integer(0)),TRUE)
 
 How does the List deal with this kind of problem?
 
 Also, gcd() as written returns a non-integer.  Would the List
 recommend rewriting the last
 line as
 
 return(as.integer(Recall(b,a%%b)))
 
 or not?

Not if you want things to work in the large-integer domain...

You're in somewhat murky waters here because it all has to do with
whether you can rely on the floating point aritmetic being exact for
integers up to 2^53. *If* that works, then there's really no reason to
distrust == in this context and the gcd() works as originally
written. You might consider wrapping it in a function that checks
whether a and b are both (1) in range and (2) that they are integers
in the sense that round(x)==x. (Failing 2, you likely get an infinite
recursion). 

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
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] a==0 vs as.integer(a)==0 vs all.equal(a,0)

2005-03-08 Thread Duncan Murdoch
On Tue, 8 Mar 2005 09:03:43 +, Robin Hankin
[EMAIL PROTECTED] wrote :

hi


?integer says:

  Note that on almost all implementations of R the range of
  representable integers is restricted to about +/-2*10^9: 'double's
  can hold much larger integers exactly.


I am getting very confused as to when to use integers and when not to.  
In my line
I need exact comparisons of large integer-valued arrays, so I often use 
as.integer(),
but the above seems to tell me that doubles might  be better.

Consider the following R idiom of Euclid's algorithm for the highest 
common factor
of two positive integers:

   gcd - function(a, b){
 if (b == 0){ return(a)}
 return(Recall(b, a%%b))
   }

If I call this with gcd(10,12), for example, then  a%%b is not an 
integer, so the first
line of the function, testing b for being zero, isn't legitimate.

When you say it isn't legitimate, you mean that it violates the advice
never to use exact comparison on floating point values?

I think that's just advice, it's not a hard and fast rule.  If you
happen to know that the values being compared have been calculated and
stored exactly, then == is valid.  In your function, when a and b
are integers that are within some range (I'm not sure what it is, but
it approaches +/- 2^53), the %% operator should return exact results.
(Does it do so on all platforms?  I'm not sure, but I'd call it a bug
if it didn't unless a and/or b were very close to the upper limit of
exactly representable integers.)

Do you know of examples where a and b are integers stored in floating
point, and a %% b returns a value that is different from as.integer(a)
%% as.integer(b)?



OK, so I have some options:

(1) stick in a - as.integer(a),  b - as.integer(b) into the 
function:  then a%%b *will* be an
integer and the == test is appropriate
(2) use some test like abs(b)  TOL for some suitable TOL (0.5?)
(3) use identical(all.equal(b,0),TRUE) like it says in identical.Rd
(4) use identical(all.equal(b,as.integer(0)),TRUE)

I'd suggest

(5) Use your gcd function almost as above, but modified to work on
vectors:

   gcd - function(a, b){
 result - a
 nonzero - b != 0
 if (any(nonzero))
   result[nonzero] - Recall(b[nonzero], a[nonzero] %% b[nonzero])
 return(result)
   }

How does the List deal with this kind of problem?

Also, gcd() as written returns a non-integer.  Would the List recommend 
rewriting the last
line as

return(as.integer(Recall(b,a%%b)))

or not?

I'd say not.  Your original function returns integer when both a and b
are stored as integers, and double when at least one of them is not.
That seems like reasonable behaviour to me.

Duncan Murdoch

__
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] a==0 vs as.integer(a)==0 vs all.equal(a,0)

2005-03-08 Thread Prof Brian Ripley
On Tue, 8 Mar 2005, Duncan Murdoch wrote:
On Tue, 8 Mar 2005 09:03:43 +, Robin Hankin
[EMAIL PROTECTED] wrote :
hi
?integer says:
 Note that on almost all implementations of R the range of
 representable integers is restricted to about +/-2*10^9: 'double's
 can hold much larger integers exactly.
I am getting very confused as to when to use integers and when not to.
In my line
I need exact comparisons of large integer-valued arrays, so I often use
as.integer(),
but the above seems to tell me that doubles might  be better.
Consider the following R idiom of Euclid's algorithm for the highest
common factor
of two positive integers:
  gcd - function(a, b){
if (b == 0){ return(a)}
return(Recall(b, a%%b))
  }
If I call this with gcd(10,12), for example, then  a%%b is not an
integer, so the first
line of the function, testing b for being zero, isn't legitimate.
When you say it isn't legitimate, you mean that it violates the advice
never to use exact comparison on floating point values?
I think that's just advice, it's not a hard and fast rule.  If you
happen to know that the values being compared have been calculated and
stored exactly, then == is valid.  In your function, when a and b
are integers that are within some range (I'm not sure what it is, but
it approaches +/- 2^53), the %% operator should return exact results.
(Does it do so on all platforms?  I'm not sure, but I'd call it a bug
if it didn't unless a and/or b were very close to the upper limit of
exactly representable integers.)
It is supposed to do so up to (but not including)
.Machine$double.base ^ .Machine$double.digits,
normally 2^53, irrespective of sign.  (These are computed at run-time, 
so one can be pretty confident about them, at least if your FPU is 
bug-free.)

Do you know of examples where a and b are integers stored in floating
point, and a %% b returns a value that is different from as.integer(a)
%% as.integer(b)?
Yes (see the NEWS for R-devel), but only for large integers where the 
second is NA.

--
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@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] Mascotanet

2005-03-08 Thread mascotanet_responde
Estimado visitante,

Por el momento no nos es posible responder a su correo, estamos trabajando para 
que en fecha próxima podamos resolver sus dudas y/o comentarios.

Atentamente.

Mascotanet.com

__
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] To convert an adjacency list model into a nested set model

2005-03-08 Thread Gesmann, Markus
Dear R-help

I am wondering if somebody wrote some code to convert an adjacency list
model into a nested set model.
In principal I want to do the same as John Celko mentioned it here with
SQL:
http://groups.google.co.uk/groups?hl=enlr=lang_enselm=8j0n05%24n31%241
%40nnrp1.deja.com

Assume you have a tree structure like this
Albert 
 /   \
   /   \
 BertChuck 
   /|   \
 /  | \
   /|   \
 /  | \
DonnaEddie   Fred

in an adjacency list model:

 emp=c(Albert, Bert, Chuck, Donna, Eddie, Fred)
 boss=c(NA, Albert, Albert, Chuck, Chuck, Chuck)
 print(Personnel-data.frame(emp, boss))
 emp   boss
1 Albert   NA
2   Bert Albert
3  Chuck Albert
4  Donna  Chuck
5  Eddie  Chuck
6   Fred  Chuck

Then it is quite hard to find the all the supervisors of one employee.
John's suggestion is to convert the adjacency list model into a nested
set model.
The organizational chart would look like this as a directed graph:

Albert (1,12)
/\
  /\
Bert (2,3)Chuck (4,11)
   /|   \
 /  | \
   /|   \
 /  | \
Donna (5,6)  Eddie (7,8)  Fred (9,10)

The data is than stored in the following form:

 lft=c(1,2,4,5,7,9)
 rgt=c(12,3,11,6,8,10)
 print(Per-data.frame(emp, lft, rgt))
  emp lft rgt
1 Albert   1  12
2   Bert   2   3
3  Chuck   4  11
4  Donna   5   6
5  Eddie   7   8
6   Fred   9  10

To find now the supervisor of an employee all you have to do is to look
where the employees lft figure is between lft and rgt. The supervisors
of Eddie are therefore
 subset(Per, lft  7  rgt  7)
 emp lft rgt
1 Albert   1  12
3  Chuck   4  11

In the site mentioned above John provides also some code to transform a
adjacency list model into a nested set model. 
Does somebody know if there is already a package for this in R? 

Kind Regards

Markus Gesmann



LNSCNTMCS01***
The information in this E-Mail and in any attachments is CONFIDENTIAL and may 
be privileged.  If you are NOT the intended recipient, please destroy this 
message and notify the sender immediately.  You should NOT retain, copy or use 
this E-mail for any purpose, nor disclose all or any part of its contents to 
any other person or persons.

Any views expressed in this message are those of the individual sender, EXCEPT 
where the sender specifically states them to be the views of Lloyd's.

Lloyd's may monitor the content of E-mails sent and received via its
network for viruses or unauthorised use and for other lawful
business purposes.

Lloyd's is authorised under the Financial Services and Markets Act 2000

__
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] How can we ring a bell in Windows?

2005-03-08 Thread Prof Brian Ripley
On Tue, 8 Mar 2005, Martin Maechler wrote:
Duncan == Duncan Murdoch [EMAIL PROTECTED]
on Mon, 07 Mar 2005 19:32:17 + writes:
   Duncan On Mon, 7 Mar 2005 18:18:37 + (GMT), Prof Brian
   Duncan Ripley [EMAIL PROTECTED] wrote :
On Mon, 7 Mar 2005, Duncan Murdoch wrote:
   
On Tue, 8 Mar 2005 00:31:07 +0800 (CST), Lu Joseph
[EMAIL PROTECTED] wrote :
   
Hello useRs,
   
Is there a way to write code in R to ring a bell in
Windows?
 If you load the tcltk package, then
   
tkbell()
   
will get you a bell on more platforms than just Windows.
If you don't want to use tcltk, then you could call the
Windows API function MessageBeep from some C code, but I
don't think we have a bell or beep function in the
standard R packages.
 But there is the ANSI \a: cat(\n) works as expected,
on all platforms.
{and of course,   cat(\a)   was meant above}
   Duncan Perhaps we should have a beep() or bell() function,
   Duncan to remind those of us who never knew all the C
   Duncan escapes and wouldn't have guessed that the ancient
   Duncan ASCII control codes still function.
Well, they are in the current C99 standard, section 5.2.2.
   Duncan I'll put it on my list...
   Duncan Duncan Murdoch
good.  Yes that would be a very sensible encapsulation of
functionality.
Note that ASCII control codes don't work on all
kinds of terminals, e.g., they don't work in ESS  --- but ESS
could be made to react smartly to a beep() function call.
Why does ESS implement only some of the ANSI/C control codes? That looks 
like an ESS deficiency.  I have never come across any other terminal that 
did not.  These are in the ISO C standard, although the a is for 
alarm, and that need not be a sound (it says audible or visible).
So alarm() would be better than beep().

Would it not be better to correct the problem in ESS: there are lots of 
other ways that \a might be sent to stdout?

--
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@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] Quantian

2005-03-08 Thread Frank E Harrell Jr
Congratulations Dirk on the article in linuxtoday.com today about Quantian.
--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University
__
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] Non-linear minimization

2005-03-08 Thread Sébastien Ballesteros
hello, I have got some trouble with R functions nlm(),
nls() or optim() : I would like to fit 3 parameters
which must stay in a precise interval. For exemple
with nlm() :

fn-function(p) sum((dN-estdata(p[1],p[2],p[3]))^2)
out-nlm(fn, p=c(4, 17, 5),
hessian=TRUE,print.level=2)

with estdata() a function which returns value to fit
with dN (observed data vactor)

My problem is that only optim() allows me to set
parameters interval with L-BFGS-B method but this
one doesn't work in my case.

I have heard about nls2 package (www.inra.fr/bia) but
it doesn't work on Windows.

Do you know any solutions

Thank's a lot for reading my post

Best regards

Sebastien
INA P-G ecology dpt

__
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] Non-linear minimization

2005-03-08 Thread Uwe Ligges
Sébastien Ballesteros wrote:
hello, I have got some trouble with R functions nlm(),
nls() or optim() : I would like to fit 3 parameters
which must stay in a precise interval. For exemple
with nlm() :
fn-function(p) sum((dN-estdata(p[1],p[2],p[3]))^2)
out-nlm(fn, p=c(4, 17, 5),
hessian=TRUE,print.level=2)
with estdata() a function which returns value to fit
with dN (observed data vactor)
My problem is that only optim() allows me to set
parameters interval with L-BFGS-B method but this
one doesn't work in my case.
I have heard about nls2 package (www.inra.fr/bia) but
it doesn't work on Windows.

it doesn't work on Windows is a very gentle description in this 
particular case...


Do you know any solutions
A typical trick is to redefine the function so that for points outside 
the boundaries increasing penalties are added (if you know enough about 
your function).

Uwe Ligges

Thank's a lot for reading my post
Best regards
Sebastien
INA P-G ecology dpt
__
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-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] Non-linear minimization

2005-03-08 Thread Wiener, Matthew
I have had my best luck by re-parametrizing so that I no longer needed
restrictions.  For example, if parameters must be positive, then I optimize
over parameters in log space, taking the exponential within my function.
This requires small changes to the function I'm optimizing (and the
gradient, if supplied), but, for me at least, has worked better than trying
to enforce box constraints as in L-BFGS-B.

Hope this helps,

Matt Wiener

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sébastien Ballesteros
Sent: Tuesday, March 08, 2005 8:24 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Non-linear minimization


hello, I have got some trouble with R functions nlm(),
nls() or optim() : I would like to fit 3 parameters
which must stay in a precise interval. For exemple
with nlm() :

fn-function(p) sum((dN-estdata(p[1],p[2],p[3]))^2)
out-nlm(fn, p=c(4, 17, 5),
hessian=TRUE,print.level=2)

with estdata() a function which returns value to fit
with dN (observed data vactor)

My problem is that only optim() allows me to set
parameters interval with L-BFGS-B method but this
one doesn't work in my case.

I have heard about nls2 package (www.inra.fr/bia) but
it doesn't work on Windows.

Do you know any solutions

Thank's a lot for reading my post

Best regards

Sebastien
INA P-G ecology dpt

__
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-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] Non-linear minimization

2005-03-08 Thread Dimitris Rizopoulos
maybe you could re-parameterize the problem, e.g.,
p \in (a, b)
p^* = (p - a) / (b - a) \in (0, 1)
x = qlogis(p^*) \in \Re
I hope it helps.
Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm

- Original Message - 
From: Sébastien Ballesteros [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Tuesday, March 08, 2005 2:23 PM
Subject: [R] Non-linear minimization


hello, I have got some trouble with R functions nlm(),
nls() or optim() : I would like to fit 3 parameters
which must stay in a precise interval. For exemple
with nlm() :
fn-function(p) sum((dN-estdata(p[1],p[2],p[3]))^2)
out-nlm(fn, p=c(4, 17, 5),
hessian=TRUE,print.level=2)
with estdata() a function which returns value to fit
with dN (observed data vactor)
My problem is that only optim() allows me to set
parameters interval with L-BFGS-B method but this
one doesn't work in my case.
I have heard about nls2 package (www.inra.fr/bia) but
it doesn't work on Windows.
Do you know any solutions
Thank's a lot for reading my post
Best regards
Sebastien
INA P-G ecology dpt
__
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-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] Dataframe modification

2005-03-08 Thread Ramzi Feghali
Hello,
I have a problem and wish if anybody have a quick
solution or function or if this question was asked
before and you could give me the date to look in the
archives for the response.
My problem is that I have a dataframe D[663,40] with
only  one column with repeated values lines and a
factor with 4 levels.
I want to reorganize my dataframe, create a dataframe
D1[x,40*4] and put the repeated values in one line so
that all the factors will be in columns. For the
values with a missing level factor I want to keep
empty the concerning place.
For example if i a have this dataframe:

A   B   C   
32  a   14  
32  b   22  
55  a   44  
55  b   77  
55  c   55  
55  d   44  
83  c   77  
83  d   55  
83  e   44  
I want to transform it to have this one: 

32  a   14  b   22  
55  a   44  b   77  c   55  
83  c   77  d   55  e   
44


Thanks  best regards

__
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] ESS

2005-03-08 Thread Mahdi Osman
Hi all,

I have got a dataframe in coma delimted text format. My ESS and R processes
are working well and active. I can read R help files and documentations from
inside ESS.

Can I perform anayltical operations such as (glm, plot ect) on elements of
my dataframe (variables) from within ESS? I could do these tasks directly in
Rconsole and would like to them in ESS directly.

How can I sumbit commandlines relevant to my datafrom to R?

Thanks for your help


Cheers

Mahdi

-- 
---
Mahdi Osman (PhD)
E-mail: [EMAIL PROTECTED]
---

DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION Kein Einrichtungspreis nutzen: http://www.gmx.net/de/go/dsl

__
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] Dataframe modification

2005-03-08 Thread Gabor Grothendieck
Ramzi Feghali ramzi_feg at yahoo.fr writes:

: 
: Hello,
: I have a problem and wish if anybody have a quick
: solution or function or if this question was asked
: before and you could give me the date to look in the
: archives for the response.
: My problem is that I have a dataframe D[663,40] with
: only  one column with repeated values lines and a
: factor with 4 levels.
: I want to reorganize my dataframe, create a dataframe
: D1[x,40*4] and put the repeated values in one line so
: that all the factors will be in columns. For the
: values with a missing level factor I want to keep
: empty the concerning place.
: For example if i a have this dataframe:
: 
: A B   C   

: 32a   14  

: 32b   22  

: 55a   44  

: 55b   77  

: 55c   55  

: 55d   44  

: 83c   77  

: 83d   55  

: 83e   44  
: I want to transform it to have this one: 
: 
: 32a   14  b   22  

: 55a   44  b   77  c   55  

: 83c   77  d   55  e
44
: 



Is this good enough?

R # first solution
R reshape(D, idvar=A, timevar=B, direction = wide)
   A C.a C.b C.c C.d C.e
1 32  14  22  NA  NA  NA
3 55  44  77  55  44  NA
7 83  NA  NA  77  55  44

R # second solution
R xtabs(C ~ A + B, D)
B
A a  b  c  d  e
  32 14 22  0  0  0
  55 44 77 55 44  0
  83  0  0 77 55 44

__
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] ESS

2005-03-08 Thread Jean Eid
try and read the ess manual a bit and look at the folowing reference card

http://stat.ethz.ch/ESS/refcard.pdf

On Tue, 8 Mar 2005, Mahdi Osman wrote:

 Hi all,

 I have got a dataframe in coma delimted text format. My ESS and R processes
 are working well and active. I can read R help files and documentations from
 inside ESS.

 Can I perform anayltical operations such as (glm, plot ect) on elements of
 my dataframe (variables) from within ESS? I could do these tasks directly in
 Rconsole and would like to them in ESS directly.

 How can I sumbit commandlines relevant to my datafrom to R?

 Thanks for your help


 Cheers

 Mahdi

 --
 ---
 Mahdi Osman (PhD)
 E-mail: [EMAIL PROTECTED]
 ---

 DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
 AKTION Kein Einrichtungspreis nutzen: http://www.gmx.net/de/go/dsl

 __
 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-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] Job: Life Sciences Statistical Computing, Insightful Corp. Seattle

2005-03-08 Thread Jill Goldschneider
Insightful is searching for a candidate to fill a technology position whose
primary function is to develop commercial software for statistical analysis
of large experimental bioinformatics/genomics data sets.  Tools include
supervised and unsupervised machine learning techniques, with applications to
assist the practicing scientist or clinician in understanding the underlying
biology.


Utilize your background in statistical algorithms, data analysis,
computational mathematics, and commercial software development to create
state-of-the-art analytical software solutions for data analysis. Insightful
is an environment where you can make a difference through innovation, drive,
and passion.

Full details at:
http://www.insightful.com/company/jobdescription.asp?JobID=58

Please, email contact only to [EMAIL PROTECTED]

Jill Goldschneider, Ph.D.
Director of Research
Insightful Corporation
1700 Westlake Ave N., Suite 500
Seattle, WA 98109-3044

[[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


[R] Pattern recognition

2005-03-08 Thread S Peri
Dear group, 
 
A data matrix when plotted as a line plot, I see
several 
patterns. For example, how my students performed for
different courses they took this academic year. I need
to find out a pattern divided into three categories...
say excellent, mediocral and worst.  How can I be able
to fix a threshold and seperate the patterns into
these 3 categories. The question being asked is:
I want to pick those students who are exceptionally
good in a course and exceptionally bad in a course
(here 2 bins) and third category being, for a given
course i did not see any students who performed either
good or bad (pretty much a straight line or all
students behave the same way).

my question is Can I do this in R. If so, would you
please suggest some good tutorials, considering the
fact that i am not a statistician.

The arbitarary matrix is:
a,b,c,d - On X-axis
Stu. 1 - 5 : on Y-axis,


Stu1   stu2stu3   stu4 stu5
a   1   2   7   3   2
b   2   2   3   2   3
c   2   1   2   3   2
d   1   2   6   2   1


Thanks
P.

__
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] Pattern recognition

2005-03-08 Thread S Peri
A small correction:

 a,b,c,d - On X-axis
 course points : on Y-axis for all students. 


2. I do not know if this can be called pattern
recognition. What i mean is the line patterns in the
line graph. 

P



--- S Peri [EMAIL PROTECTED] wrote:
 Dear group, 
  
 A data matrix when plotted as a line plot, I see
 several 
 patterns. For example, how my students performed for
 different courses they took this academic year. I
 need
 to find out a pattern divided into three
 categories...
 say excellent, mediocral and worst.  How can I be
 able
 to fix a threshold and seperate the patterns into
 these 3 categories. The question being asked is:
 I want to pick those students who are exceptionally
 good in a course and exceptionally bad in a course
 (here 2 bins) and third category being, for a given
 course i did not see any students who performed
 either
 good or bad (pretty much a straight line or all
 students behave the same way).
 
 my question is Can I do this in R. If so, would you
 please suggest some good tutorials, considering the
 fact that i am not a statistician.
 
 The arbitarary matrix is:
 a,b,c,d - On X-axis
 Stu. 1 - 5 : on Y-axis,
 
 
   Stu1   stu2stu3   stu4 stu5
 a 1   2   7   3   2
 b 2   2   3   2   3
 c 2   1   2   3   2
 d 1   2   6   2   1
 
 
 Thanks
 P.
 
 __
 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-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] To convert an adjacency list model into a nested set model

2005-03-08 Thread Gabor Grothendieck
Gesmann, Markus Markus.Gesmann at lloyds.com writes:

: 
: Dear R-help
: 
: I am wondering if somebody wrote some code to convert an adjacency list
: model into a nested set model.
: In principal I want to do the same as John Celko mentioned it here with
: SQL:
: http://groups.google.co.uk/groups?hl=enlr=lang_enselm=8j0n05%24n31%241
: %40nnrp1.deja.com
: 
: Assume you have a tree structure like this
:   Albert 
:  /   \
:/   \
:  BertChuck 
:/|   \
:  /  | \
:/|   \
:  /  | \
: DonnaEddie   Fred
: 
: in an adjacency list model:
: 
:  emp=c(Albert, Bert, Chuck, Donna, Eddie, Fred)
:  boss=c(NA, Albert, Albert, Chuck, Chuck, Chuck)
:  print(Personnel-data.frame(emp, boss))
:  emp   boss
: 1 Albert   NA
: 2   Bert Albert
: 3  Chuck Albert
: 4  Donna  Chuck
: 5  Eddie  Chuck
: 6   Fred  Chuck
: 
: Then it is quite hard to find the all the supervisors of one employee.
: John's suggestion is to convert the adjacency list model into a nested
: set model.
: The organizational chart would look like this as a directed graph:
: 
: Albert (1,12)
: /\
:   /\
: Bert (2,3)Chuck (4,11)
:/|   \
:  /  | \
:/|   \
:  /  | \
: Donna (5,6)  Eddie (7,8)  Fred (9,10)
: 
: The data is than stored in the following form:
: 
:  lft=c(1,2,4,5,7,9)
:  rgt=c(12,3,11,6,8,10)
:  print(Per-data.frame(emp, lft, rgt))
:   emp lft rgt
: 1 Albert   1  12
: 2   Bert   2   3
: 3  Chuck   4  11
: 4  Donna   5   6
: 5  Eddie   7   8
: 6   Fred   9  10
: 
: To find now the supervisor of an employee all you have to do is to look
: where the employees lft figure is between lft and rgt. The supervisors
: of Eddie are therefore
:  subset(Per, lft  7  rgt  7)
:  emp lft rgt
: 1 Albert   1  12
: 3  Chuck   4  11
: 
: In the site mentioned above John provides also some code to transform a
: adjacency list model into a nested set model. 
: Does somebody know if there is already a package for this in R? 
: 
: Kind Regards
: 
: Markus Gesmann
: 

This is not a direct answer to getting a nesting from an adjacency
but the following is easy to do and gives all the same info.


Note that if A is the adjacency matrix of children (rows) and ]
parents (columns) then A^n is the matrix defining ancestors n 
generations away and exp(A) is a weighted version of that with
A^i weighted by i! (These expressions are mathematics, not R.)  
Thus:

empf - factor(emp, level = union(emp, boss))  # emp as factor
bossf - factor(boss, level = union(emp, boss)) # ditto for boss

adj - table(empf, bossf)  # i,j is 1 if j is boss of i

library(rmutil)  # http://popgen.unimaas.nl/~jlindsey/rcode.html
mexp(adj, type = series) - diag(length(empf))

giving a matrix whose i,j-th entry is 1/n! if j is n-generations above i.
From that you can get the info you need.

__
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] Multidimensional Scaling (MDS) in R

2005-03-08 Thread Isaac Waisberg
Hi;

I am working with the similarity matrix below and I would like to plot
a two-dimensional MDS solution such as each point in the plot has a
label.

This is what I did:

data - read.table('c:/multivariate/mds/colour.txt',header=FALSE)
similarity - as.dist(data)
distance - 1-similarity
result.nmds - nmds(distance)
plot(result.nmds)

(nmds and plot.nmds as defined at
labdsv.nr.usu.edu/splus_R/lab8/lab8.html; nmds simply calls isoMDS)

Colour.txt, containing the similaity matrix, reads as follows:

 1.0 .86 .42 .42 .18 .06 .07 .04 .02 .07 .09 .12 .13 .16
 .86 1.0 .50 .44 .22 .09 .07 .07 .02 .04 .07 .11 .13 .14
 .42 .50 1.0 .81 .47 .17 .10 .08 .02 .01 .02 .01 .05 .03
 .42 .44 .81 1.0 .54 .25 .10 .09 .02 .01 .01 .01 .02 .04
 .18 .22 .47 .54 1.0 .61 .31 .26 .07 .02 .02 .01 .02 .01
 .06 .09 .17 .25 .61 1.0 .62 .45 .14 .08 .02 .02 .02 .01
 .07 .07 .10 .10 .31 .62 1.0 .73 .22 .14 .05 .02 .02 .01
 .04 .07 .08 .09 .26 .45 .73 1.0 .33 .19 .04 .03 .02 .02
 .02 .02 .02 .02 .07 .14 .22 .33 1.0 .58 .37 .27 .20 .23
 .07 .04 .01 .01 .02 .08 .14 .19 .58 1.0 .74 .50 .41 .28
 .09 .07 .02 .01 .02 .02 .05 .04 .37 .74 1.0 .76 .62 .55
 .12 .11 .01 .01 .01 .02 .02 .03 .27 .50 .76 1.0 .85 .68
 .13 .13 .05 .02 .02 .02 .02 .02 .20 .41 .62 .85 1.0 .76
 .16 .14 .03 .04 .01 .01 .01 .02 .23 .28 .55 .68 .76 1.0
 
The first row corresponds to colour 1 (C1), the second to colour 2
(C2), and so on.

First, I'm not sure if this is correct or not. Second, obviously the
points in the plot are not labeled. I suppose I must add a labels
column and then print the labels together with the results. But, how
should I do it?

Many thanks,

Isaac

__
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] The null hypothesis in kpss test (kpss.test())

2005-03-08 Thread Weiguang Shi
is that 'x' is level or trend stationary. I did this
 
   s-rnorm(1000)
   kpss.test(s)
 
KPSS Test for Level Stationarity
 
  data:  s
  KPSS Level = 0.0429, Truncation lag parameter = 7,
p-value = 0.1
 
  Warning message:
  p-value greater than printed p-value in:
kpss.test(s)

My question is whether p=0.1 is a good number to
reject 
N0? On the other hand, I have a series r and did the 
following:
   plot.ts(r)
   kpss.test(r)
 
KPSS Test for Level Stationarity
 
  data:  r
  KPSS Level = 3.1955, Truncation lag parameter = 7,
p-value = 0.01
 
  Warning message:
  p-value smaller than printed p-value in:
kpss.test(r)

So this says we can have more confidence in saying r
is _not_ stationary? Should I worry about the
warnings?

Thanks very much.
Weiguang

__
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] The null hypothesis in kpss test (kpss.test())

2005-03-08 Thread Achim Zeileis
As help(kpss.test) tells you: kpss.test() approximates the p values by
interpolation from a simulated table of critical values. As p values
larger than 0.1 are typically regarded to be non-significant and p
values smaller than 0.01 are typically regarded to be highly
significant, the corresponding critical values are only stored for the
range 0.1 to 0.01.

Hence...

On Tue, 8 Mar 2005 12:51:37 -0500 (EST) Weiguang Shi wrote:

 is that 'x' is level or trend stationary. I did this
  
s-rnorm(1000)
kpss.test(s)
  
 KPSS Test for Level Stationarity
  
   data:  s
   KPSS Level = 0.0429, Truncation lag parameter = 7,
 p-value = 0.1
  
   Warning message:
   p-value greater than printed p-value in:
 kpss.test(s)
 
 My question is whether p=0.1 is a good number to
 reject N0? 

...stationarity cannot be rejected here (which is not surprising) and...

 On the other hand, I have a series r and did the 
 following:
plot.ts(r)
kpss.test(r)
  
 KPSS Test for Level Stationarity
  
   data:  r
   KPSS Level = 3.1955, Truncation lag parameter = 7,
 p-value = 0.01
  
   Warning message:
   p-value smaller than printed p-value in:
 kpss.test(r)

...stationarity is clearly rejected here.

 So this says we can have more confidence in saying r
 is _not_ stationary?

Yes (I guess. I'm not sure about `more confidence'...`more' than what?)
Z

 Should I worry about the warnings?
 
 Thanks very much.
 Weiguang
 
 __
 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-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] The null hypothesis in kpss test (kpss.test())

2005-03-08 Thread Weiguang Shi
Understood!
And thanks!

Weiguang

 --- Achim Zeileis [EMAIL PROTECTED]
wrote: 
 As help(kpss.test) tells you: kpss.test()
 approximates the p values by
 interpolation from a simulated table of critical
 values. As p values
 larger than 0.1 are typically regarded to be
 non-significant and p
 values smaller than 0.01 are typically regarded to
 be highly
 significant, the corresponding critical values are
 only stored for the
 range 0.1 to 0.01.
 
 Hence...

__
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] removing message: [Previously saved workspace restored]

2005-03-08 Thread Federico Calboli
Dear All, 

I saved by mistake the environment I was working in after typing q(),
and now I get the annoying message:

[Previously saved workspace restored]

I have already deleted all the objects in the environment, saving it as
an empty environment, so it's just a matter of nitpicking I suppose. The
message does not appear if I start R from any other place in the
directory tree.

I am reading ?Startup and related docs, but I am utterly failing to
understand how to remove [Previously saved workspace restored] when I
call R from the offending dir...

I am using R on Debian Sarge x86

Cheers,

Federico Calboli
-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

__
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] removing message: [Previously saved workspace restored]

2005-03-08 Thread Roger D. Peng
R saves the workspace in a file called '.RData'.  Simply remove this 
file from your working directory.  Or if you startup R and get the 
message, try

unlink(.RData)
-roger
Federico Calboli wrote:
Dear All, 

I saved by mistake the environment I was working in after typing q(),
and now I get the annoying message:
[Previously saved workspace restored]
I have already deleted all the objects in the environment, saving it as
an empty environment, so it's just a matter of nitpicking I suppose. The
message does not appear if I start R from any other place in the
directory tree.
I am reading ?Startup and related docs, but I am utterly failing to
understand how to remove [Previously saved workspace restored] when I
call R from the offending dir...
I am using R on Debian Sarge x86
Cheers,
Federico Calboli
--
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/
__
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] removing message: [Previously saved workspace restored]

2005-03-08 Thread Federico Calboli
On Tue, 2005-03-08 at 15:57 -0500, Wiener, Matthew wrote:
 Remove the (now empty, because you deleted all objects) file .RData from
 the directory.
 
 Hope this helps,


Thanks, it did fix the problem.

Cheers,

Federico Calboli
-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

__
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] removing message: [Previously saved workspace restored]

2005-03-08 Thread Liaw, Andy
Either remove .RData in the directory, or start R with --no-restore option.

Andy

 From: Federico Calboli
 
 Dear All, 
 
 I saved by mistake the environment I was working in after typing q(),
 and now I get the annoying message:
 
 [Previously saved workspace restored]
 
 I have already deleted all the objects in the environment, 
 saving it as
 an empty environment, so it's just a matter of nitpicking I 
 suppose. The
 message does not appear if I start R from any other place in the
 directory tree.
 
 I am reading ?Startup and related docs, but I am utterly failing to
 understand how to remove [Previously saved workspace restored] when I
 call R from the offending dir...
 
 I am using R on Debian Sarge x86
 
 Cheers,
 
 Federico Calboli
 -- 
 Federico C. F. Calboli
 Department of Epidemiology and Public Health
 Imperial College, St Mary's Campus
 Norfolk Place, London W2 1PG
 
 Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193
 
 f.calboli [.a.t] imperial.ac.uk
 f.calboli [.a.t] gmail.com
 
 __
 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-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] removing message: [Previously saved workspace restored]

2005-03-08 Thread Jan T. Kim
On Tue, Mar 08, 2005 at 08:51:44PM +, Federico Calboli wrote:

 I saved by mistake the environment I was working in after typing q(),
 and now I get the annoying message:
 
 [Previously saved workspace restored]
 
 I have already deleted all the objects in the environment, saving it as
 an empty environment, so it's just a matter of nitpicking I suppose. The
 message does not appear if I start R from any other place in the
 directory tree.
 
 I am reading ?Startup and related docs, but I am utterly failing to
 understand how to remove [Previously saved workspace restored] when I
 call R from the offending dir...
 
 I am using R on Debian Sarge x86

There is a file called .Rdata, containing the saved workspace, in the
offending directory. Following Unix convention, the file is not normally
displayed by ls and other programs because its name begins with a dot.
See Data permanency and removing objects in the R-intro.

If you don't want the saved stuff anymore, simply delete that file.

Best regards, Jan
-- 
 +- Jan T. Kim ---+
 |*NEW*email: [EMAIL PROTECTED]   |
 |*NEW*WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=  hierarchical systems are for files, not for humans  =-*

__
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] removing message: [Previously saved workspace restored]

2005-03-08 Thread Achim Zeileis
On Tue, 08 Mar 2005 20:51:44 + Federico Calboli wrote:

 Dear All, 
 
 I saved by mistake the environment I was working in after typing q(),
 and now I get the annoying message:
 
 [Previously saved workspace restored]
 
 I have already deleted all the objects in the environment, saving it
 as an empty environment, so it's just a matter of nitpicking I
 suppose. The message does not appear if I start R from any other place
 in the directory tree.

The saved workspace is stored in the .RData in that particular
directory. It is loaded when you start R in that directory. If you
remove the file, it cannot be loaded anymore.
Z

 I am reading ?Startup and related docs, but I am utterly failing to
 understand how to remove [Previously saved workspace restored] when I
 call R from the offending dir...
 
 I am using R on Debian Sarge x86
 
 Cheers,
 
 Federico Calboli
 -- 
 Federico C. F. Calboli
 Department of Epidemiology and Public Health
 Imperial College, St Mary's Campus
 Norfolk Place, London W2 1PG
 
 Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193
 
 f.calboli [.a.t] imperial.ac.uk
 f.calboli [.a.t] gmail.com
 
 __
 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-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] generically setting attributes of a function

2005-03-08 Thread shang stud

Hello all:

I wonder if there is a generic way to assign the name of a function as an
attribute of the function. For example,

w = function(x) x^2;
attr(w, name) =  w;

This assigns the name attribute of function w to be w.

Would it be possible to put the second line of the code inside the
function definition? I would like to avoid typing specifically the
name, w, when assigning the attribute.

Many thanks in advance.

Fang

__
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] generically setting attributes of a function

2005-03-08 Thread Gabor Grothendieck
shang stud facS93 at mors.hampshire.edu writes:

: 
: Hello all:
: 
: I wonder if there is a generic way to assign the name of a function as an
: attribute of the function. For example,
: 
: w = function(x) x^2;
: attr(w, name) =  w;
: 
: This assigns the name attribute of function w to be w.
: 
: Would it be possible to put the second line of the code inside the
: function definition? I would like to avoid typing specifically the
: name, w, when assigning the attribute.
: 

structure(function(x) x^2, name = w)

__
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] how modify object in parent.env

2005-03-08 Thread McGehee, Robert
This isn't an environment problem. Assigning something to a get call
doesn't make any sense. Use assign.

 a - 5
 get(a) - 10
Error: couldn't find function get-

And from the ?assign help page, you can pick what environment you want
to make the assignment. Just pick the parent environment.


-Original Message-
From: Vadim Ogranovich [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 08, 2005 6:36 PM
To: r-help@stat.math.ethz.ch
Subject: [R] how modify object in parent.env


Hi,
 
Is it possible to modify an object in the parent.env (as opposed to
re-bind)? Here is what I tried:
 
 x = 1:3
# try to modify the first element of x from within a new environment
 local(get(x, parent.env(environment()))[1] - NA)
Error in eval(expr, envir, enclos) : Target of assignment expands to
non-language object

# On the other hand retrieval works just fine
 local(get(x, parent.env(environment()))[1])
[1] 1

Thanks,
Vadim

__
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-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] how modify object in parent.env

2005-03-08 Thread Vadim Ogranovich
Assign() re-binds the value, not modifies it (the latter is what I
needed) 

 -Original Message-
 From: McGehee, Robert [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, March 08, 2005 3:48 PM
 To: Vadim Ogranovich; r-help@stat.math.ethz.ch
 Subject: RE: [R] how modify object in parent.env
 
 This isn't an environment problem. Assigning something to a 
 get call doesn't make any sense. Use assign.
 
  a - 5
  get(a) - 10
 Error: couldn't find function get-
 
 And from the ?assign help page, you can pick what environment 
 you want to make the assignment. Just pick the parent environment.
 
 
 -Original Message-
 From: Vadim Ogranovich [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 08, 2005 6:36 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] how modify object in parent.env
 
 
 Hi,
  
 Is it possible to modify an object in the parent.env (as opposed to
 re-bind)? Here is what I tried:
  
  x = 1:3
 # try to modify the first element of x from within a new environment
  local(get(x, parent.env(environment()))[1] - NA)
 Error in eval(expr, envir, enclos) : Target of assignment expands to
 non-language object
 
 # On the other hand retrieval works just fine
  local(get(x, parent.env(environment()))[1])
 [1] 1
 
 Thanks,
 Vadim
 
 __
 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-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] how modify object in parent.env

2005-03-08 Thread Marc Schwartz
On Tue, 2005-03-08 at 15:36 -0800, Vadim Ogranovich wrote:
 Hi,
  
 Is it possible to modify an object in the parent.env (as opposed to
 re-bind)? Here is what I tried:
  
  x = 1:3
 # try to modify the first element of x from within a new environment
  local(get(x, parent.env(environment()))[1] - NA)
 Error in eval(expr, envir, enclos) : Target of assignment expands to
 non-language object
 
 # On the other hand retrieval works just fine
  local(get(x, parent.env(environment()))[1])
 [1] 1


You could try this:

 x - 1:3

mod.x - function(x)
{
  eval.parent(substitute(x[1] - NA))
}

 x
[1] 1 2 3

 mod.x(x)

 x
[1] NA  2  3


See ?eval.parent for more information and variations on this.

HTH,

Marc Schwartz

__
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] how modify object in parent.env

2005-03-08 Thread Gabor Grothendieck

You can use - like this:

x - 1:3
local(x[1] - x[1]+1)

Vadim Ogranovich vograno at evafunds.com writes:

: 
: Assign() re-binds the value, not modifies it (the latter is what I
: needed) 
: 
:  -Original Message-
:  From: McGehee, Robert [mailto:Robert.McGehee at geodecapital.com] 
:  Sent: Tuesday, March 08, 2005 3:48 PM
:  To: Vadim Ogranovich; r-help at stat.math.ethz.ch
:  Subject: RE: [R] how modify object in parent.env
:  
:  This isn't an environment problem. Assigning something to a 
:  get call doesn't make any sense. Use assign.
:  
:   a - 5
:   get(a) - 10
:  Error: couldn't find function get-
:  
:  And from the ?assign help page, you can pick what environment 
:  you want to make the assignment. Just pick the parent environment.
:  
:  
:  -Original Message-
:  From: Vadim Ogranovich [mailto:vograno at evafunds.com]
:  Sent: Tuesday, March 08, 2005 6:36 PM
:  To: r-help at stat.math.ethz.ch
:  Subject: [R] how modify object in parent.env
:  
:  
:  Hi,
:   
:  Is it possible to modify an object in the parent.env (as opposed to
:  re-bind)? Here is what I tried:
:   
:   x = 1:3
:  # try to modify the first element of x from within a new environment
:   local(get(x, parent.env(environment()))[1] - NA)
:  Error in eval(expr, envir, enclos) : Target of assignment expands to
:  non-language object
:  
:  # On the other hand retrieval works just fine
:   local(get(x, parent.env(environment()))[1])
:  [1] 1
:  
:  Thanks,
:  Vadim
:  
:  __
:  R-help at 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-help at 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-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] Non-linear minimization

2005-03-08 Thread christopher . m . turner

After some experimentation, I have had very good luck with the rgenoud
package. It handles box constraints well and for small problems its slow
speed has not been much of a problem. It has worked for me on Windows,
Macintosh, and Linux.

Chris
JPMorgan Asset Management



|-+
| |   Sébastien Ballesteros|
| |   sebastien_ballestero|
| |   [EMAIL PROTECTED]  |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   03/08/2005 08:23 AM  |
| ||
|-+
  
-|
  | 
|
  |   To:   r-help@stat.math.ethz.ch
|
  |   cc:   
|
  |   Subject:  [R] Non-linear minimization 
|
  
-|




hello, I have got some trouble with R functions nlm(),
nls() or optim() : I would like to fit 3 parameters
which must stay in a precise interval. For exemple
with nlm() :

fn-function(p) sum((dN-estdata(p[1],p[2],p[3]))^2)
out-nlm(fn, p=c(4, 17, 5),
hessian=TRUE,print.level=2)

with estdata() a function which returns value to fit
with dN (observed data vactor)

My problem is that only optim() allows me to set
parameters interval with L-BFGS-B method but this
one doesn't work in my case.

I have heard about nls2 package (www.inra.fr/bia) but
it doesn't work on Windows.

Do you know any solutions

Thank's a lot for reading my post

Best regards

Sebastien
INA P-G ecology dpt

__
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




This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein 
do not necessarily reflect those of JPMorgan Chase  Co., its subsidiaries 
and affiliates

__
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] from long/lat to UTM

2005-03-08 Thread yyan liu
Hi:
  Is there any function in R which can convert the
long/lat to UTM(Universal Transverse Mercator)?
  There are quite a few converters on Internet.
However, the interface is designed as input-output
which I can not convert lots of locations at the same
time.
  Another question is whether there is a function in R
which can tell the time zone from the location's
lat/long?
  Thank you!

liu

__
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] Fairouz Makhlouf (2nd request)

2005-03-08 Thread FairouzMakhlouf
Fairouz Makhlouf is still waiting to hear from you to join Fairouz's mobile 
friends community.

Simply click the link below to confirm your relationship with Fairouz.
http://www.sms.ac/registration/Intro.aspx?InviteId=eb8mm1u02100uw-c06r=7

Don't want to be invited by your friends?
Click on the link above to block future invitations from family and friends.
SMS.ac, Inc., 7770 Regents Road, Suite 113-405, San Diego, CA 92122 USA

__
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