[R] Cross build Makefile

2004-06-20 Thread Iago Mosqueira
Hello,

I am trying to use Yan and Rossini's Makefile for cross building Windows
versions of R packages in Linux with R 1.9.0. When compiling R with the
mingw tools I get an error about expm1 being undeclared when first found
at src/main/arithmetic.c:1019

If I fiddle a bit with it later on I also get errors about log1p bein
undeclared.

Any idea what should I look for?

I am using R 1.9.0 in Debian, with R-mathlib avaliable, and gcc 3.3.

Thanks,


iago

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


RE: [R] hidden markov models in R?

2004-06-20 Thread Ingmar Visser
Hi Cezar, 

Download and install the repeated package by Jim Lindsey and type ?hidden

bye, ingmar

 

Hi, friends!

Has R estimation (library, for example) to do estimation in HMM?

Thanks in advance,


Cezar Freitas
Estatistico - Comissao Permanente para os Vestibulares / UNICAMP
Probabilidade e Estatistica Aplicadas - IME / USP | IMECC / UNICAMP
Campinas | Sao Paulo, SP - Brasil

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

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


Re: [R] Greater than 1 or less than 1?

2004-06-20 Thread Ray Brownrigg
> Date: Sun, 20 Jun 2004 18:32:46 -0400
> From: "Zhen Chen" <[EMAIL PROTECTED]>
> 
> I have problem evaluating the expression h = exp(x)/(exp(exp(x))-1) for 
> large negative x. This expression is actually the probability
> that y = 1 when y is a Poisson random variable truncated at 0, hence 
> must satisfy 0 <= h <= 1. However, when
> x < -18, I may get an h value that is  larger than 1 while the true 
> value should be a quantity that is smaller than but very close to 1.
> For example when x = -19, h = 1.031174. I tried to use 
> different form of h and none of
> them give me an h value that is less than or equal to 1. I also tried 
> to find patterns, but discovered none: for some x < -18, h is below 1; 
> for others
> h is greater than 1. Is there any trick that enables me to obtain 
> theoretically correct results from this expression?
> 
exp(x)/(exp(exp(x)) - 1) is less than 1 for me for x = -18 with R-1.9.0
on a Solaris 9 system, a NetBSD 2.0C system and a Windows XP system.

You could try exp(x)/expm1(exp(x)), but if the longer expression doesn't
work, then this may not either, though it does give slightly different
results on my systems.

E.g.:
> x = -19
> exp(x)/(exp(exp(x)) - 1) - 1
[1] -2.047911e-09
> exp(x)/(expm1(exp(x))) - 1
[1] -2.801398e-09

log(1 + x) and exp(x) - 1 are often treated specially in math libraries
for when x << 0.

Ray Brownrigg

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


Re: [R] Greater than 1 or less than 1?

2004-06-20 Thread Thomas Lumley
On Sun, 20 Jun 2004, Zhen Chen wrote:

> I have problem evaluating the expression h = exp(x)/(exp(exp(x))-1) for
> large negative x. This expression is actually the probability
> that y = 1 when y is a Poisson random variable truncated at 0, hence
> must satisfy 0 <= h <= 1. However, when


You would be better off using the functions provided for the Poisson
distribution.

Either
dpois(1,exp(x))/ppois(0.5,exp(x),lower.tail=FALSE)
or to get 1-h
ppois(1.5,exp(x),lower.tail=FALSE)/ppois(0.5,exp(x),lower.tail=FALSE)

-thomas

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


Re: [R] Greater than 1 or less than 1?

2004-06-20 Thread Peter Dalgaard
"Zhen Chen" <[EMAIL PROTECTED]> writes:

> I have problem evaluating the expression h = exp(x)/(exp(exp(x))-1)
> for large negative x. This expression is actually the probability
> that y = 1 when y is a Poisson random variable truncated at 0, hence
> must satisfy 0 <= h <= 1. However, when
> x < -18, I may get an h value that is  larger than 1 while the true
> value should be a quantity that is smaller than but very close to 1.
> For example when x = -19, h = 1.031174. I tried to use
> different form of h and none of
> them give me an h value that is less than or equal to 1. I also tried
> to find patterns, but discovered none: for some x < -18, h is below 1;
> for others
> h is greater than 1. Is there any trick that enables me to obtain
> theoretically correct results from this expression?

expm1() should help...

What platform is this? I don't see it until x=-30:

> exp(-30)
[1] 9.357623e-14
> exp(exp(-30))-1
[1] 9.348078e-14

which is of course "wrong" since exp(x) > x + 1 mathematically.
However, notice that in double precision calculations the latter value
is only accurate up to 1e-15 or so. 

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

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


Re: [R] Fw: Evaluating strings as variables

2004-06-20 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

> > sapply(colors, get)
> >
> 
> or?
> unlist(mget(colors, envir = as.environment(-1), inherits = TRUE))

Ah, yes, forgot about mget. Doesn't seem to make things much cleaner
though... (although get() also needs a bit more care about
environments). 

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

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


[R] Greater than 1 or less than 1?

2004-06-20 Thread Zhen Chen
I have problem evaluating the expression h = exp(x)/(exp(exp(x))-1) for 
large negative x. This expression is actually the probability
that y = 1 when y is a Poisson random variable truncated at 0, hence 
must satisfy 0 <= h <= 1. However, when
x < -18, I may get an h value that is  larger than 1 while the true 
value should be a quantity that is smaller than but very close to 1.
For example when x = -19, h = 1.031174. I tried to use 
different form of h and none of
them give me an h value that is less than or equal to 1. I also tried 
to find patterns, but discovered none: for some x < -18, h is below 1; 
for others
h is greater than 1. Is there any trick that enables me to obtain 
theoretically correct results from this expression?

Thanks.
Zhen Chen, Ph.D.
Assistant Professor of Biostatistics
Department of Biostatistics & Epidemiology
University of Pennsylvania School of Medicine
423 Guardian Drive -- 625 Blockley Hall
Philadelphia, PA  19104-6021
voice:  215-573-8545
fax:    215-573-4865
email:  [EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Another NEWBIE

2004-06-20 Thread John Fox
Dear Frank,

First, thank you for your kind remarks about the Rcmdr package.

Please note that the Rcmdr package is meant to be a basic statistics GUI for
R, to be used, for example, in an introductory statistics course. It covers
only a very small fraction of what's available in R.

Almost all of the statistical capabilities of the Rcmdr package are from
other packages. In particular, since you mention it, the factor-analysis
dialog simply calls the factanal() function in the stats package, which is
part of the standard R distribution. See ?factanal (or press the Help button
in the Rcmdr factor-analysis dialog) for details. As well, you can take a
look at the R commands that the Rcmdr generates.

Regards,
 John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of F.Kalder
> Sent: Sunday, June 20, 2004 4:06 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [R] Another NEWBIE
> 
> Hello,
> 
> And thanks again for your answers, perspectives and more...
> 
> So, as I understood, R can (nearly) do anything. So, also 
> because it's free, it is worth a try ;-).
> 
> I then next will start with reading some introductory texts. 
> And, wow, I'm quite 'overloaded', because there is so much 
> stuff available, I don?t know where to start and get a foot 
> in the door. I think I take one of the advices and will begin 
> with the "Notes on the use of R for psychology experiments 
> and questionnaires" text. 
> 
> The hint to the Rcmdr package was nice :-). That was nearly 
> like SPSS base system. When at last to know, which package to 
> use and for what kind of problem is another thing of course ...
> 
> Still I have had problems with importing SPSS files. But I 
> will read on it too.
> 
> The factor analysis tool of Rcmdr I didn?t fully understand. 
> So, there also will be much work to do.
> 
> I also noticed that my stats abilities aren?t very profound. 
> I?m so 'drilled' in doing 'standard stuff' and using more the 
> SPSS output than knowing exactly what I have to do, that I 
> will have to have a much closer look into a good book on 
> stats ... well, the Hair et al. is a good book of course, but 
> any recommendations are welcome :-).
> 
> You all wrote about the graphics in R and those in Rcmdr I 
> saw are to me mostly the same as in SPSS. Nevertheless, I 
> even don?t know when and for what to use that whole bunch of 
> graphics anyway ... still looking sometimes a bit envy on 
> huge 3D-graphics of multivariate bell curves and stuff on 
> book covers but can?t do anything with it.
> 
> The data entries by ASCII files are strange to me, because 
> I?m so used to work with a (the SPSS) spread sheet (mostly 
> the good old typing in from paper & pencil questionnaires), 
> that I don?t know how to handle that yet.
> Maybe using a SPSS- or at least Excel-like tool would be 
> helpful for that.
> 
> So, my next move will be reading the mentioned text on 
> questionnaires and then some basic introduction on R, knowing 
> then, how it principally works, what?s with the packages, how 
> to manage the data and so on ... I also think, I have to do 
> some homework on stats either ...
> 
> Thanks again ...
> 
> Frank
>

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


Re: [R] Sweave and echoing R comments

2004-06-20 Thread Frank E Harrell Jr
Charles H. Franklin wrote:
Is there any way to echo comments from an R source file into an 
SWeave->LaTeX document?

Example:
# Npop is population total
# Npoph0..Npoph2 are stratum totals
# Npoph is vector of stratum totals
Npop<-sum(to2000)
Npoph0<-sum(to2000[bg==0])
Npoph1<-sum(to2000[bg==1])
Npoph2<-sum(to2000[bg==2])
Npoph<-c(Npoph0,Npoph1,Npoph2)

In the final LaTeX document, I'd like the comments to be echoed so 
readers other than me have guidance about variable names etc.

I suppose advocates of literate programming might argue that if the 
comment is important it should be in the body of the .snw file, not 
merely as R comments. Still... it seems easier to use brief comments in 
the code itself and more explanatory text in the body of the document.

Searches of "Sweave" and "comment" in the list and documentation didn't 
turn up anything about echoing comments in either R or Sweave.

Thanks.
Charles

I agree that it would be nice to see comments in the output.  I hope 
that Fritz Leisch will consider adding a hook that is a user-provided R 
function that take vectors of character strings representing a chunk of 
code and generating any desired LaTeX markup for pretty printing of the 
code.  The function would return character vectors in LaTeX format.  I 
like comments to appear in a smaller font, and for certain character 
translations, such as <- being replaced with a left arrow.

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Fw: Evaluating strings as variables

2004-06-20 Thread Matthias . Kohl
> "Robin Gruna" <[EMAIL PROTECTED]> writes:
>
>> I have the following problem: I have a list as follows,
>>
>> > values <- list(red = 1, yellow = 2, blue = 3)
>>
>> > values
>> $red
>> [1] 1
>>
>> $yellow
>> [1] 2
>>
>> $blue
>> [1] 3
>>
>> There is also a vector containing the diffrent "colors" as character
>> strings:
>>
>> > colors <- c("red", "red", "blue", "yellow", "red", "blue")
>> > colors
>> [1] "red""red""blue"   "yellow" "red""blue"
>>
>> Now i can attach the list values to R:
>>
>> > attach(values)
>> > red
>> [1] 1
>>
>> etc...
>>
>> Now to my problem: How can I make R in a simple way to evaluate the
>> strings "red", "blue" etc. as variables, returning their numeric
>> values ? As result I want to get a vector containing the values of the
>> colors like this one:
>>
>> > values.colors
>> [1] 1 1 3 2 1 3
>
> Forget about the attach() business, and do
>
> values <- unlist(values) # or values <- c(red = 1, yellow = 2, blue = 3)
> values.colors <- values[colors]
>
> If you insist on going via variables, try
>
> sapply(colors, get)
>

or?
unlist(mget(colors, envir = as.environment(-1), inherits = TRUE))

Matthias

> --
>O__   Peter Dalgaard Blegdamsvej 3
>   c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
>  (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
> ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
>
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

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


Re: [R] Another NEWBIE

2004-06-20 Thread F.Kalder
Hello,

And thanks again for your answers, perspectives and more...

So, as I understood, R can (nearly) do anything. So, also because it's free,
it is worth a try ;-).

I then next will start with reading some introductory texts. And, wow, I'm
quite 'overloaded', because there is so much stuff available, I don?t know
where to start and get a foot in the door. I think I take one of the advices
and will begin with the "Notes on the use of R for psychology experiments
and questionnaires" text. 

The hint to the Rcmdr package was nice :-). That was nearly like SPSS base
system. When at last to know, which package to use and for what kind of
problem is another thing of course ...

Still I have had problems with importing SPSS files. But I will read on it
too.

The factor analysis tool of Rcmdr I didn?t fully understand. So, there also
will be much work to do.

I also noticed that my stats abilities aren?t very profound. I?m so
'drilled' in doing 'standard stuff' and using more the SPSS output than
knowing exactly what I have to do, that I will have to have a much closer
look into a good book on stats ... well, the Hair et al. is a good book of
course, but any recommendations are welcome :-).

You all wrote about the graphics in R and those in Rcmdr I saw are to me
mostly the same as in SPSS. Nevertheless, I even don?t know when and for
what to use that whole bunch of graphics anyway ... still looking sometimes
a bit envy on huge 3D-graphics of multivariate bell curves and stuff on book
covers but can?t do anything with it.

The data entries by ASCII files are strange to me, because I?m so used to
work with a (the SPSS) spread sheet (mostly the good old typing in from
paper & pencil questionnaires), that I don?t know how to handle that yet.
Maybe using a SPSS- or at least Excel-like tool would be helpful for that.

So, my next move will be reading the mentioned text on questionnaires and
then some basic introduction on R, knowing then, how it principally works,
what?s with the packages, how to manage the data and so on ... I also think,
I have to do some homework on stats either ...

Thanks again ...

Frank


-- 
+++ Jetzt WLAN-Router für alle DSL-Einsteiger und Wechsler +++
GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl

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


Re: [R] regarding saving R graphis images directly to directory

2004-06-20 Thread Deepayan Sarkar
On Sunday 20 June 2004 15:15, SAURIN wrote:
> Dear R,
>
> I am student at University of new haven, CT.I am trying to run my R
> scripts where I don't have X11() authentication to my account. I run
> those R scripts and when I generate any graphics I get error and it
> comes out from system.
>
> if possible , please let me know how can i run R scripts ...so, that
> I just SAVE BOX PLOT or HISTOGRAM jpeg or png files to current
> directory without poping up on screen or without using any devices or
> make them silent..or something.

You could output to postscript (see ?postscript for details). This 
sounds like a UNIX/Linux system, so you could probably use 'convert' 
afterwards to get jpeg/png if you want.

You can start R with 'R -g none' to make postscript the default device.

Hope that helps,

Deepayan

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


Re: [R] Fw: Evaluating strings as variables

2004-06-20 Thread Peter Dalgaard
"Robin Gruna" <[EMAIL PROTECTED]> writes:

> I have the following problem: I have a list as follows,
> 
> > values <- list(red = 1, yellow = 2, blue = 3)
> 
> > values
> $red
> [1] 1
> 
> $yellow
> [1] 2
> 
> $blue
> [1] 3
> 
> There is also a vector containing the diffrent "colors" as character strings:
> 
> > colors <- c("red", "red", "blue", "yellow", "red", "blue")
> > colors
> [1] "red""red""blue"   "yellow" "red""blue"  
> 
> Now i can attach the list values to R:
> 
> > attach(values)
> > red
> [1] 1
> 
> etc...
> 
> Now to my problem: How can I make R in a simple way to evaluate the strings "red", 
> "blue" etc. as variables, returning their numeric values ?
> As result I want to get a vector containing the values of the colors like this one:
> 
> > values.colors
> [1] 1 1 3 2 1 3

Forget about the attach() business, and do

values <- unlist(values) # or values <- c(red = 1, yellow = 2, blue = 3)
values.colors <- values[colors]

If you insist on going via variables, try

sapply(colors, get)

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

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


[R] Fw: Evaluating strings as variables

2004-06-20 Thread Robin Gruna

- Original Message - 
From: Robin Gruna 
To: [EMAIL PROTECTED] 
Sent: Sunday, June 20, 2004 5:42 PM
Subject: Evaluating strings as variables


Hello,
I have the following problem: I have a list as follows,

> values <- list(red = 1, yellow = 2, blue = 3)

> values
$red
[1] 1

$yellow
[1] 2

$blue
[1] 3

There is also a vector containing the diffrent "colors" as character strings:

> colors <- c("red", "red", "blue", "yellow", "red", "blue")
> colors
[1] "red""red""blue"   "yellow" "red""blue"  

Now i can attach the list values to R:

> attach(values)
> red
[1] 1

etc...

Now to my problem: How can I make R in a simple way to evaluate the strings "red", 
"blue" etc. as variables, returning their numeric values ?
As result I want to get a vector containing the values of the colors like this one:

> values.colors
[1] 1 1 3 2 1 3

Thanks a lot,
greetings Robin











[[alternative HTML version deleted]]

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


[R] regarding saving R graphis images directly to directory

2004-06-20 Thread SAURIN
Dear R,

I am student at University of new haven, CT.I am trying to run my R scripts where I 
don't have
X11() authentication to my account. I run those R scripts and when I generate any 
graphics I get
error and it comes out from system. 

if possible , please let me know how can i run R scripts ...so, that I just SAVE BOX 
PLOT or
HISTOGRAM jpeg or png files to current directory without poping up on screen or 
without using any
devices or make them silent..or something.


Thakn you,
Saurin Jnai

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


Re: [R] Html help does not work in Mac OSX 10.3.4

2004-06-20 Thread Ulises Mora Alvarez
Hello:

You are damn right! I haven't noticed because I rarely use the html help. 
I will be working on. I'll let you know.

Regards.




On Fri, 18 Jun 2004, Emilio A. Laca wrote:

> I recently upgraded from R 1.8 to 1.9. I removed 1.8 following the
> instructions. Html help has not worked since. When htmlhelp="TRUE" the
> help.start() command results in the "patience" message and nothing else
> happens. I am using mac osx 10.3.4. Help worked fine when I was using R 1.8.
> 
> I need help help ;-] Thanks!
> 

-- 
Ulises M. Alvarez
LAB. DE ONDAS DE CHOQUE
FISICA APLICADA Y TECNOLOGIA AVANZADA
UNAM
[EMAIL PROTECTED]

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


[R] problem locfit

2004-06-20 Thread fatima bouharaoui
I have a problem with the use of locfit with censured data, when I carry out locfit 
by: 
fitbmt<-locfit(~recur,data=BMTAGE11,cens=df.status,family="hazard",alpha=0.5)
 it does not give me any message, but if I want to obtain the graph or even if I ask 
for (fitbmt) made it gives me the following message: 
 
> fitbmt31
Problem: Object "fitbmt31" not found, while calling subroutine slocfit 
Use traceback() to see the call stack
I have this problem with several dataset ,but I don't know what is the problem
thank you for your help




-



Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
[[alternative HTML version deleted]]

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


[R] Sweave and echoing R comments

2004-06-20 Thread Charles H. Franklin
Is there any way to echo comments from an R source file into an 
SWeave->LaTeX document?

Example:
# Npop is population total
# Npoph0..Npoph2 are stratum totals
# Npoph is vector of stratum totals
Npop<-sum(to2000)
Npoph0<-sum(to2000[bg==0])
Npoph1<-sum(to2000[bg==1])
Npoph2<-sum(to2000[bg==2])
Npoph<-c(Npoph0,Npoph1,Npoph2)

In the final LaTeX document, I'd like the comments to be echoed so 
readers other than me have guidance about variable names etc.

I suppose advocates of literate programming might argue that if the 
comment is important it should be in the body of the .snw file, not 
merely as R comments. Still... it seems easier to use brief comments in 
the code itself and more explanatory text in the body of the document.

Searches of "Sweave" and "comment" in the list and documentation didn't 
turn up anything about echoing comments in either R or Sweave.

Thanks.
Charles
--
Charles H. Franklin
Professor, Political Science
University of Wisconsin, Madison
608-263-2022
[EMAIL PROTECTED]
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-06-20 Thread Gabor Grothendieck


Here they are again modified to remove that bug:

ls.funs <- 
function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if(is.function(get(x,env=env)))x))

ls.var <- 
function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if(!is.function(get(x,env=env)))x))





Date:   Sun, 20 Jun 2004 17:02:40 +0100 (BST) 
From:   Prof Brian Ripley <[EMAIL PROTECTED]>
To:   Shin, Daehyok <[EMAIL PROTECTED]> 
Cc:   <[EMAIL PROTECTED]> 
Subject:   RE: [R] A way to list only variables or functions? 

 
On Sun, 20 Jun 2004, Shin, Daehyok wrote:

> Neat! Thanks.

Note that these are not correct, as the get is not done from the 
correct environment. The function ls.str I pointed you to is correct.

> How about incorporating this support into standard commands, ls() or
> objects()?

Well, there already is ls[f].str.

> 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] A way to list only variables or functions?
> >
> >
> >
> >
> > These two functions will list the functions and variables
> > respectively:
> >
> > ls.funs <-
> > function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if
> > (is.function(get(x)))x))
> >
> > ls.vars <-
> > function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if
> > (!is.function(get(x)))x))
> >
> >
> > To use:
> >
> > ls.funs()
> > ls.vars()
> >
> >
> > Date: Sat, 19 Jun 2004 22:59:57 -0400
> > From: Shin <[EMAIL PROTECTED]>
> > To: R Help <[EMAIL PROTECTED]>
> > Subject: [R] A way to list only variables or functions?
> >
> >
> > I am curious if there is any way to list only variables or functions in
> > current environment, rather than listing all objects? Thanks.
> >
> > --
> > Daehyok Shin (Peter)
> > Geography Department
> > Univ. of North Carolina-Chapel Hill
> >
> >
> >
> > ___
> > No banners. No pop-ups. No kidding.
> 
> >
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 

-- 
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, UK Fax: +44 1865 272595

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


Re: [R] Another NEWBIE

2004-06-20 Thread Frank E Harrell Jr
Charles and Kimberly Maner wrote:
Hi Frank.  I am (somewhat) new to R as well, but almost a 10 yr SAS veteran.
I work for a very large US Bank and have spent a considerable part of my
career in Corp Mktg leveraging data for, arguably, data mining, next
purchase, attrition, balance diminishment and the like.  I am now managing
an Operations Research group in their Customer Service and Support (aka
Telephone/Call Center Support) within the forecasting and analytics group.
What I have found, broadly and personally, regarding R vs. sAS is the
following:
1.  You simply can't beat the price of R vs. Insightful Corp.'s S-Splus, not
to mention SAS.
2.  The support folks for R are among the very best, (e.g., most helpful,
energetic and enthusiastic to help)
3.  R is far, far leaner from what I have seen thus far for modeling,
binning/discretizing, graphing, etc. vs. SAS.
Thanks for your note.  I assume you meant to say 'more capable' rather 
than 'leaner'.

4.  SAS is, per a previous post, (quite debatably) superior for manipulation
and handling of fantastically large datasets.  I have found that R's
strength is not really in merging datasets and dataset manipulation.
Although, major caveat here, it greatly depends on what you need done to the
data.  For lagging, diffing, binning, R is superior.  For match merging, at
this stage, I vote for SAS.  (Again, I stress I've only 6-8 mos of moderate
R experience.)
You are right, for huge datasets.  For others, R is great, even for 
merging.  Many examples are provided in the Alzola and Harrell text on 
http://biostat.mc.vanderbilt.edu

5.  The challenge with R is, perhaps, it's very strength--language density.
Once I learn how to do something in R vs. SAS, R's code is fractionally as
large as SAS.  Literally, it may take 10 lines of code in SAS vs. a one
liner in R.  That's powerful.  However, due to my SAS experience, I've
banged out the SAS code and am still looking/hunting for the R equivalent.
However, once doing so, it's, borrowing from a popular vegetable drink
slogan, "Wow, I could have done that in R."
Yes I agree.
6.  And, lastly, while R is well documented, I seem to find one of the areas
of documentation somewhat lacking is a great big R "recipe" book.
(Suggestions, BTW, are welcome here.)  Documentation of the R language is in
place with more being published, (alongside S-Plus), annually.  However,
there does not appear to be, for example, an "R Transition Recipes for
Experienced SAS Users" book.  That, ultimately, is what would help me, (I
think.)  Again, the issue really is simply learning and using the language.
Experienced R users, I'm convinced, could do everything R I'm doing in SAS,
(with money left over for a few coffees at Starbuck's).
I agree.  What I really think is needed is a compendium of examples, 
especially for data manipulation.  I gave a talk about this last week; 
abstract is at 
http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/FrankHarrellrmanip 
with links to other places.  A meager attempt at navigating some of the 
more commonly used R functions is at 
http://biostat.mc.vanderbilt.edu/s/finder/finder.html

In conclusion, I still think that, given one's budget and projects, there's
a place for SAS and R to co-exist.  But, that paradigm diminishes as (1) the
size of the datasets become smaller and, (2) your problems are more
academic/researchy/specific in nature.  For graphing, esp. w/the Lattice
package, R is simply superior (IMHO), period, to SAS.  (For some reason, SAS
has just not felt the need to improve their graphics, at least the SAS/Graph
part of their offering.)  And, for the SAS lovers out there, this opinion is
mine only as I continue to be primarily a SAS client attempting to
transition to R.
Frank, while I've probably been too wordy, I've attempted to provide another
perspective for you.  Good luck.
No, well said,
Thanks,
Frank

Thanks,
Charles
--
Message: 7
Date: Sat, 19 Jun 2004 18:15:19 +0200 (MEST)
From: "F.Kalder" <[EMAIL PROTECTED]>
Subject: Re: [R] Another NEWBIE
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"
Hi,
Thank you all who anwered me. 

I think, I mainly thought to understand the difference between SPSS /SAS and
R, but didn't really get the point (what explains the question, wich metods
R can't do). Maybe, because I don't have much experience with programming
(near to none). My background in stats goes also only back to indroductory
classes and an advanced course in multivariate statistics. To this, I'm
working with Hair, Anderson, Tatham & Blacks's "Multivariate Data Analysis"
(5th Ed.) as my ressource, mainly with questionnaire analysis (Reliability
Analysis and Factor Analysis, also MDS, Conjoint etc. plus sometimes
standard MANOVA, Multiplke Regression etc.). So, maybe my stats aren't
sophisticated enough to use R, I'm just a standard user of applied
statistical methods, not an academic researcher or even a statistician. It

Re: [R] if syntax

2004-06-20 Thread Dirk Eddelbuettel
On Sun, Jun 20, 2004 at 09:00:39AM -0700, [EMAIL PROTECTED] wrote:
> I wanted to look up the internal R documentation for if via "?if", but 
> this does not work.  making the latter work would be a good idea.

FYI, it also works inside of (X)Emacs where the (highly recommend) ESS mode
is kind enough to translate   ?if   into   ?"if"  so that the desired help
is in fact shown.

Hth, Dirk

-- 
FEATURE:  VW Beetle license plate in California

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


Re: [R] Another NEWBIE

2004-06-20 Thread Charles and Kimberly Maner

Hi Frank.  I am (somewhat) new to R as well, but almost a 10 yr SAS veteran.
I work for a very large US Bank and have spent a considerable part of my
career in Corp Mktg leveraging data for, arguably, data mining, next
purchase, attrition, balance diminishment and the like.  I am now managing
an Operations Research group in their Customer Service and Support (aka
Telephone/Call Center Support) within the forecasting and analytics group.
What I have found, broadly and personally, regarding R vs. sAS is the
following:

1.  You simply can't beat the price of R vs. Insightful Corp.'s S-Splus, not
to mention SAS.
2.  The support folks for R are among the very best, (e.g., most helpful,
energetic and enthusiastic to help)
3.  R is far, far leaner from what I have seen thus far for modeling,
binning/discretizing, graphing, etc. vs. SAS.
4.  SAS is, per a previous post, (quite debatably) superior for manipulation
and handling of fantastically large datasets.  I have found that R's
strength is not really in merging datasets and dataset manipulation.
Although, major caveat here, it greatly depends on what you need done to the
data.  For lagging, diffing, binning, R is superior.  For match merging, at
this stage, I vote for SAS.  (Again, I stress I've only 6-8 mos of moderate
R experience.)
5.  The challenge with R is, perhaps, it's very strength--language density.
Once I learn how to do something in R vs. SAS, R's code is fractionally as
large as SAS.  Literally, it may take 10 lines of code in SAS vs. a one
liner in R.  That's powerful.  However, due to my SAS experience, I've
banged out the SAS code and am still looking/hunting for the R equivalent.
However, once doing so, it's, borrowing from a popular vegetable drink
slogan, "Wow, I could have done that in R."
6.  And, lastly, while R is well documented, I seem to find one of the areas
of documentation somewhat lacking is a great big R "recipe" book.
(Suggestions, BTW, are welcome here.)  Documentation of the R language is in
place with more being published, (alongside S-Plus), annually.  However,
there does not appear to be, for example, an "R Transition Recipes for
Experienced SAS Users" book.  That, ultimately, is what would help me, (I
think.)  Again, the issue really is simply learning and using the language.
Experienced R users, I'm convinced, could do everything R I'm doing in SAS,
(with money left over for a few coffees at Starbuck's).

In conclusion, I still think that, given one's budget and projects, there's
a place for SAS and R to co-exist.  But, that paradigm diminishes as (1) the
size of the datasets become smaller and, (2) your problems are more
academic/researchy/specific in nature.  For graphing, esp. w/the Lattice
package, R is simply superior (IMHO), period, to SAS.  (For some reason, SAS
has just not felt the need to improve their graphics, at least the SAS/Graph
part of their offering.)  And, for the SAS lovers out there, this opinion is
mine only as I continue to be primarily a SAS client attempting to
transition to R.

Frank, while I've probably been too wordy, I've attempted to provide another
perspective for you.  Good luck.


Thanks,
Charles


--

Message: 7
Date: Sat, 19 Jun 2004 18:15:19 +0200 (MEST)
From: "F.Kalder" <[EMAIL PROTECTED]>
Subject: Re: [R] Another NEWBIE
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"

Hi,

Thank you all who anwered me. 

I think, I mainly thought to understand the difference between SPSS /SAS and
R, but didn't really get the point (what explains the question, wich metods
R can't do). Maybe, because I don't have much experience with programming
(near to none). My background in stats goes also only back to indroductory
classes and an advanced course in multivariate statistics. To this, I'm
working with Hair, Anderson, Tatham & Blacks's "Multivariate Data Analysis"
(5th Ed.) as my ressource, mainly with questionnaire analysis (Reliability
Analysis and Factor Analysis, also MDS, Conjoint etc. plus sometimes
standard MANOVA, Multiplke Regression etc.). So, maybe my stats aren't
sophisticated enough to use R, I'm just a standard user of applied
statistical methods, not an academic researcher or even a statistician. It
was mainly a descision by costs, because R is free software. 
With the concept, I completely mistook the R concept as a programming
environment more as a kind of advanced SPSS Syntax (because I also would
call it "programming" when using it), which I now know, is completely wrong.

So, I again thank for your help.


Cheers, Frank.

--

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


[R] hidden markov models in R?

2004-06-20 Thread Cezar Augusto de Freitas Anselmo
Hi, friends!

Has R estimation (library, for example) to do estimation in HMM?

Thanks in advance,


Cezar Freitas
Estatistico - Comissao Permanente para os Vestibulares / UNICAMP
Probabilidade e Estatistica Aplicadas - IME / USP | IMECC / UNICAMP
Campinas | Sao Paulo, SP - Brasil

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


Re: [R] if syntax

2004-06-20 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:
I ran into an interesting oddity of R,
   if (0) { print(1); }
   else  { print(2); }
In both cases the ";" is superflously .
If if(){}else{} is within an expression (e.g. a function's body), both 
ways work.
Do you really want to use it outside a function's body? If so, I suggest 
to write:

if(...){
...
} else{
...
}

is a syntax error, while
   if (0) { print(1); } else  { print(2); }
or
   if (0) { print(1);
   } else  { print(2); }
 is not.  I presume it has to do with the duality of the newline 
functioning as an end of command (;) character, though it still seems a 
bit odd, and it took me a while to figure out what was wrong.  I 
eventually figured out that to resolve this ambiguity, I would guess 
that ifelse() would be a preferred function.
No. ifelse() is for the vectorized conditions. if(){} else{} is more 
efficient for length 1 conditions. Please read help("if") and 
help("ifelse").


I wanted to look up the internal R documentation for if via "?if", but 
this does not work.  making the latter work would be a good idea.
?"if" or help("if") do work perfectly.
Uwe Ligges

regards,  /iaw
---
ivo welch
professor of finance and economics
brown / nber / yale
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] if syntax

2004-06-20 Thread Matthias Burger

try
?"if"
Best,
  Matthias
[EMAIL PROTECTED] wrote:
I ran into an interesting oddity of R,
   if (0) { print(1); }
   else  { print(2); }
is a syntax error, while
   if (0) { print(1); } else  { print(2); }
or
   if (0) { print(1);
   } else  { print(2); }
 is not.  I presume it has to do with the duality of the newline 
functioning as an end of command (;) character, though it still seems a 
bit odd, and it took me a while to figure out what was wrong.  I 
eventually figured out that to resolve this ambiguity, I would guess 
that ifelse() would be a preferred function.

I wanted to look up the internal R documentation for if via "?if", but 
this does not work.  making the latter work would be a good idea.

regards,  /iaw
---
ivo welch
professor of finance and economics
brown / nber / yale
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

--
Matthias Burger
Bioinformatics R&D
Epigenomics AG  www.epigenomics.com
Kleine Präsidentenstraße 1  fax:   +49-30-24345-555
10178 Berlin Germanyphone: +49-30-24345-0
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] if syntax

2004-06-20 Thread Adaikalavan Ramasamy
This has been discussed several times on this list. Note that line 2 of
paragraph 2 of help("if") says the following :

" In particular, you should not have a newline between '}' and 'else' to
avoid a syntax error in entering a 'if ... else' construct at the
keyboard or via 'source'. "


On Sun, 2004-06-20 at 17:00, [EMAIL PROTECTED] wrote:
> I ran into an interesting oddity of R,
> if (0) { print(1); }
> else  { print(2); }
>  is a syntax error, while
> if (0) { print(1); } else  { print(2); }
> or
> if (0) { print(1);
> } else  { print(2); }
>   is not.  I presume it has to do with the duality of the newline 
> functioning as an end of command (;) character, though it still seems a 
> bit odd, and it took me a while to figure out what was wrong.  I 
> eventually figured out that to resolve this ambiguity, I would guess 
> that ifelse() would be a preferred function.
> 
> I wanted to look up the internal R documentation for if via "?if", but 
> this does not work.  making the latter work would be a good idea.
> 
> regards,  /iaw
> ---
> ivo welch
> professor of finance and economics
> brown / nber / yale
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


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

2004-06-20 Thread Prof Brian Ripley
On Sun, 20 Jun 2004, Shin, Daehyok wrote:

> Neat! Thanks.

Note that these are not correct, as the get is not done from the 
correct environment.  The function ls.str I pointed you to is correct.

> How about incorporating this support into standard commands, ls() or
> objects()?

Well, there already is ls[f].str.

> 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] A way to list only variables or functions?
> >
> >
> >
> >
> > These two functions will list the functions and variables
> > respectively:
> >
> > ls.funs <-
> > function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if
> > (is.function(get(x)))x))
> >
> > ls.vars <-
> > function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if
> > (!is.function(get(x)))x))
> >
> >
> > To use:
> >
> > ls.funs()
> > ls.vars()
> >
> >
> > Date:   Sat, 19 Jun 2004 22:59:57 -0400
> > From:   Shin <[EMAIL PROTECTED]>
> > To:   R Help <[EMAIL PROTECTED]>
> > Subject:   [R] A way to list only variables or functions?
> >
> >
> > I am curious if there is any way to list only variables or functions in
> > current environment, rather than listing all objects? Thanks.
> >
> > --
> > Daehyok Shin (Peter)
> > Geography Department
> > Univ. of North Carolina-Chapel Hill
> >
> >
> >
> > ___
> > No banners. No pop-ups. No kidding.
> 
> >
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


[R] if syntax

2004-06-20 Thread ivo_welch-Rstat
I ran into an interesting oddity of R,
   if (0) { print(1); }
   else  { print(2); }
is a syntax error, while
   if (0) { print(1); } else  { print(2); }
or
   if (0) { print(1);
   } else  { print(2); }
 is not.  I presume it has to do with the duality of the newline 
functioning as an end of command (;) character, though it still seems a 
bit odd, and it took me a while to figure out what was wrong.  I 
eventually figured out that to resolve this ambiguity, I would guess 
that ifelse() would be a preferred function.

I wanted to look up the internal R documentation for if via "?if", but 
this does not work.  making the latter work would be a good idea.

regards,  /iaw
---
ivo welch
professor of finance and economics
brown / nber / yale
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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 to list only variables or functions?
> 
> 
> hi
> forgot who actualy wrote this code but it works nicely
> use:
> ls.objects(type='function')
> 
> regards soren
> 
>  ls.objects<-function (pos = 1, pattern, mode = "any", type = "any"){
> Object.Name <- ls(pos = pos, envir = as.environment(pos), pattern =
> pattern)
> Object.Mode <- rep("",length(Object.Name))
> Object.Type <- rep("",length(Object.Name))
> Variables <- rep("-",length(Object.Name))
> Observations <- rep("-",length(Object.Name))
> for (i in 1:length(Object.Name)){
> Object.Mode[[i]] <- mode(get(Object.Name[[i]]))
> if(is.list(get(Object.Name[[i]]))){
> if(is.null(class(get(Object.Name[[i]]
> Object.Type[[i]] <- c("unknown")
> else {
> Object.Attrib <- attributes(get(Object.Name[[i]]))
> if(length(Object.Attrib$class) == 1) {
> Object.Type[[i]] <- Object.Attrib$class
> if(Object.Type[[i]]=="data.frame"){
> Variables[[i]] <- as.character(length(Object.Attrib$names))
> Observations[[i]] <- as.character(length(Object.Attrib$row.names))
> }
> }
> else {
> if("data.frame" %in% Object.Attrib$class){
> Object.Type[[i]] <- "data.frame"
> Variables[[i]] <- as.character(length(Object.Attrib$names))
> Observations[[i]] <- as.character(length(Object.Attrib$row.names))
> }
> else {
> if("aov" %in% Object.Attrib$class) Object.Type[[i]] <- "aov"
> }
> }
> }
> }
> if(is.matrix(get(Object.Name[[i]]))){
> Object.Attrib <- dim(get(Object.Name[[i]]))
> Object.Type[[i]] <- c("matrix")
> Variables[[i]] <- as.character(Object.Attrib[2])
> Observations[[i]] <- as.character(Object.Attrib[1])
> }
> if(is.vector(get(Object.Name[[i]])) && (Object.Mode[[i]]=="character" ||
> Object.Mode[[i]]=="numeric")){
> Object.Type[[i]] <- c("vector")
> Variables[[i]] <- c("1")
> Observations[[i]] <- as.character(length(get(Object.Name[[i]])))
> }
> if(is.factor(get(Object.Name[[i]]))){
> Object.Type[[i]] <- c("factor")
> Variables[[i]] <- c("1")
> Observations[[i]] <- as.character(length(get(Object.Name[[i]])))
> }
> if(is.function(get(Object.Name[[i]]))) Object.Type[[i]] <- c("function")
> }
> objList <-
> data.frame(Object.Name,Object.Mode,Object.Type,Observations,Variables)
> if(mode != "any") objList <- objList[objList[["Object.Mode"]] 
> == mode,]
> if(type != "any") objList <- objList[objList[["Object.Type"]] 
> == type,]
> return(objList)
> }
> - Original Message - 
> From: "Shin" <[EMAIL PROTECTED]>
> To: "R Help" <[EMAIL PROTECTED]>
> Sent: Sunday, June 20, 2004 4:59 AM
> Subject: [R] A way to list only variables or functions?
> 
> 
> > I am curious if there is any way to list only variables or functions in
> > current environment, rather than listing all objects? Thanks.
> >
> > -- 
> > Daehyok Shin (Peter)
> > Geography Department
> > Univ. of North Carolina-Chapel Hill
> >
> > __
> > [EMAIL PROTECTED] mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> >
> 
> 
>

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


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] A way to list only variables or functions?
>
>
>
>
> These two functions will list the functions and variables
> respectively:
>
> ls.funs <-
> function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if
> (is.function(get(x)))x))
>
> ls.vars <-
> function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if
> (!is.function(get(x)))x))
>
>
> To use:
>
> ls.funs()
> ls.vars()
>
>
> Date:   Sat, 19 Jun 2004 22:59:57 -0400
> From:   Shin <[EMAIL PROTECTED]>
> To:   R Help <[EMAIL PROTECTED]>
> Subject:   [R] A way to list only variables or functions?
>
>
> I am curious if there is any way to list only variables or functions in
> current environment, rather than listing all objects? Thanks.
>
> --
> Daehyok Shin (Peter)
> Geography Department
> Univ. of North Carolina-Chapel Hill
>
>
>
> ___
> No banners. No pop-ups. No kidding.

>

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


[R] Anyone out there have the XLF Fortran compiler for OS X?

2004-06-20 Thread David L. Van Brunt, Ph.D.
I have code that will crash R every time on an OS X machine, but runs 
fine on other platforms. The developer I've been working with suspects 
it's a compiler issue, but I only have the same ones he does (g77).

Obviously, the way to test this would be to compile R using another 
compiler. XLF is the (by IBM, distributed by Absoft) is the only other 
one I know of. It's pretty expensive on its own, so if somebody has a 
license and would be willing to help out, please drop me a line.

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


[R] [MailServer Notification] To External Sender: a virus was found a nd action taken.

2004-06-20 Thread Systemaufsicht
ScanMail for Microsoft Exchange took action on the message.  The message
details were: 
Sender = [EMAIL PROTECTED]
Recipient(s) = [EMAIL PROTECTED];
Subject = i know your document!
Scanning time = 06/20/2004 16:35:42
Engine/Pattern = 7.000-1004/1.909.00

Action taken on message:
The attachment more.zip contained WORM_NETSKY.C virus. ScanMail took the
action: Deleted. 
ScanMail has detected a virus in an email you [EMAIL PROTECTED];

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


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

2004-06-20 Thread Gabor Grothendieck


These two functions will list the functions and variables
respectively:

ls.funs <- 
function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if(is.function(get(x)))x))

ls.vars <- 
function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if(!is.function(get(x)))x))


To use:

ls.funs()
ls.vars()


Date:   Sat, 19 Jun 2004 22:59:57 -0400 
From:   Shin <[EMAIL PROTECTED]>
To:   R Help <[EMAIL PROTECTED]> 
Subject:   [R] A way to list only variables or functions? 

 
I am curious if there is any way to list only variables or functions in
current environment, rather than listing all objects? Thanks.

-- 
Daehyok Shin (Peter)
Geography Department
Univ. of North Carolina-Chapel Hill

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


Re: [R] Constrained non-linear mixed models

2004-06-20 Thread Spencer Graves
WHY THIS FUNCTIONAL FORM? 

 If this were my problem, I would first want to know why we needed 
this particular functional form and why (b*var3+a) and (b*var4+a) had to 
be between 0 and 1.  When I see things like this, my first impulse is 
that these may only be approximations to something else, and then I 
would seek a different approximation that might plausibly be better and 
was not subject to the constraints. 

CREATIVE PLOTS? 

What kind(s) of random model(s) are you considering?  What 
kinds of plots have you made?  Before I did heavy modeling, I'd compute 
correlations and make plots designed to explore the chosen relationship 
from different perspectives, e.g., using lattice graphics, contour and 
perspective / wireframe plots, etc.  Such plots might suggest 
alternative functional forms. 

PENALIZING "nlme"? 

 If I still needed to fit the model you suggested, I might first 
rewrite it something like the following: 

 nlme(log(response)~z+y*log(var1)+x*log(var2)+log01(b*var3+a, 
xlim)-x*log01(b*var4+a, xlim), ...

 where log01 is something like the following [***UNTESTED***]: 

log01 <- function(zz, xlim){
# log(zz) if xlim[1]
# else something that goes balistic othis range
# with rate controlled by xlim[3]; 
# log01 must be continuous and monotonic. 
 zz.sm <- (zz
 zz.lg <- (zz>xlim[2])
 log.zz <- rep(NA, length(zz))
 log.zz[zz.sm] <- (log(xlim[1])-
 (exp(xlim[3]*(xlim[1]-zz[zz.sm]))-1))
 log.zz[zz.lg] <- (log(xlim[2])+
 (exp(xlim[3]*(zz[zz.lg]-xlim[2]))-1))
 zz.gd <- !(zz.sm | zz.lg)
 log.zz[zz.gd] <- log(zz[zz.gd])
 log.zz
}

 I would first run it with xlim something like c(0.1, 0.9, 0.01).  
I'd then look at the cases for which I got log01 outside xlim[1:2] and 
(gradually) adjust xlim to get something close to what I wanted, e.g., 
like c(0.01, 0.99, 100).  If this didn't work well, I might also try to 
modify log01 so it was also differentiable in zz. 

FITTING SUBSETS?  

 I might also try fitting the same model to different subsets of 
the data, perhaps suggested by the most plausible random effects models, 
then use the parameter estimates as data for a second stage analysis, 
following Box and Hunter, "A Useful Method for Model Building" paper;  
you should be able to find a complete citation on the web. 

MARKOV CHAIN MONTE CARLO (MCMC)? 

 I think the "gold standard" for this type of problem is MCMC.  
There is software available for that, but I haven't used it and 
therefore can't comment.  However, before I got to that point, I would 
make lots of plots and try to several alternative, simpler models to 
convince myself that this was both appropriate and necessary. 

 hope this helps.  spencer graves
Hwange Project wrote:
Dear r-helpers,
does anyone knows how to constrain the value of parameters in a non-linear
mixed model:
I've got something like that:
nlme(log(response)~z+y*log(var1)+x*log(var2)+log((b*var3+a)/(b*var4+a)^x)
where 0
and another one :
What means ?
Error in chol((value + t(value))/2) : the leading minor of order 1 is not
positive definite
(my statical books do not go far enough in the detail.
It must be about the Cholesky something if I remember well what I read
long-time ago).
I'm sorry to bother you with this kind of things, but I'm in a remote place
(~18°45'S,26°45'E)
(even if e-mails are working at the incredible speed of 4.8 kbits/sec...)
without a lot of statistical or computer ressources. Thanks,
simon
-
Simon Chamaillé
Hwange Project
CIRAD-CNRS
Hwange Main Camp Research
P. Bag 5776, Dete
(+00 263) 18-647
[EMAIL PROTECTED] 
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

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


[R] Constrained non-linear mixed models

2004-06-20 Thread Hwange Project
Dear r-helpers,
does anyone knows how to constrain the value of parameters in a non-linear
mixed model:
I've got something like that:
nlme(log(response)~z+y*log(var1)+x*log(var2)+log((b*var3+a)/(b*var4+a)^x)
where 0mailto:[EMAIL PROTECTED]>

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


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

2004-06-20 Thread Prof Brian Ripley
On Sat, 19 Jun 2004, Shin wrote:

> I am curious if there is any way to list only variables or functions in
> current environment, rather than listing all objects? Thanks.

Not really.  What you can do is list the objects and then get the objects 
and look at the modes, as ls.str does.  That could easily be modified to 
just list, but you may find what it gives helpful anyway.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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