Re: [R] MySQL + R as a Replacement for SAS Proc SQL + Various Stat Procs

2008-01-18 Thread Wensui Liu
Hi, there,
it seems size of your data is very manageable in R.
i've been using proc sql in SAS a lot and found sqldf package is very
similar to proc sql. check it out.
one more thought. instead of using R as scripting lang. to process
data, it might be worthy to take a look at python.

On Jan 18, 2008 11:10 PM,  <[EMAIL PROTECTED]> wrote:
>
> For cost reasons, I'd like to replace SAS on my PC under Win XP Pro.
>
> Nearly all my work involves medium-size datasets (100k-10M) records which I
> cleanup, relate, fliter and get into shape for analysis using SAS/SQL
> followed by standard statistical procedures, e.g. regression using SAS proc
> reg.
>
> It seems to me that this type of analysis could be done in MySQL followed
> by R, but I'd like some advice about the best way to pass datasets from
> MySQL to R.  I understand there are various connectivity packages
> avaialble, RODBC and RMySQL, but I'd appreciate some advice about where to
> dig in first.
>
> I'd like to avoid additional syntax in my SQL code -- so it seems better
> not to coat SQL queries in R wrappers and pass them to MySQL -- probably
> better for my way of working to finish all the SQL work and pass a clean
> table ready to analyze to R.
>
> One of the great advantages for me using SAS is that I can beat the data
> into shape using proc SQL and then call proc STAT_OF_THE_DAY all in the
> same batch file with no plumbing, data conversion or additional
> machination.
>
> But if I could do this in MySQL + R, well in a few years I'd have the down
> payment for an Audi TT instead of having given it to SAS Institute.
>
> If someone found a practical way to make this work -- pls let me know.  And
> thanks in advance.
>
> Jack Williamson
> LECG
> 2049 Century Park East, Suite 2300
> Los Angeles CA 90067
> 323-683-5004
> [EMAIL PROTECTED]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
===
WenSui Liu
Statistical Project Manager
ChoicePoint Precision Marketing
(http://spaces.msn.com/statcompute/blog)

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


Re: [R] MySQL + R as a Replacement for SAS Proc SQL + Various Stat Procs

2008-01-18 Thread Prof Brian Ripley
On Fri, 18 Jan 2008, [EMAIL PROTECTED] wrote:

> For cost reasons, I'd like to replace SAS on my PC under Win XP Pro.
>
> Nearly all my work involves medium-size datasets (100k-10M) records which I
> cleanup, relate, fliter and get into shape for analysis using SAS/SQL
> followed by standard statistical procedures, e.g. regression using SAS proc
> reg.
>
> It seems to me that this type of analysis could be done in MySQL followed
> by R, but I'd like some advice about the best way to pass datasets from
> MySQL to R.  I understand there are various connectivity packages
> avaialble, RODBC and RMySQL, but I'd appreciate some advice about where to
> dig in first.
>
> I'd like to avoid additional syntax in my SQL code -- so it seems better
> not to coat SQL queries in R wrappers and pass them to MySQL -- probably
> better for my way of working to finish all the SQL work and pass a clean
> table ready to analyze to R.

The way these work (using RODBC is an example) is

- If necessary, send the data to MySQL via sqlSave().

- Use sqlQuery() to send SQL statements verbatim to the RDBMS (here MySQL)

- Retrieve a table via sqlFetch().

- Do the analysis on the fetched table.

If the table is very large, you can fetch in junks and use the facilities 
in the 'biglm' package to do a regression a block of data at a time.
However, I am not sure of the value of using more than 10,000 cases in a 
regression, as well before that non-sampling errors will dominate the 
error distribution: e.g. the systematic error from model misfit may be 
larger than the nominal standard errors.

I can see why experienced SAS users like to use it for data cleanup, but 
it seem generally true that the user is a more important variable than the 
tool: people work best with the tools they understand best (and personal 
preference comes into it).

> One of the great advantages for me using SAS is that I can beat the data
> into shape using proc SQL and then call proc STAT_OF_THE_DAY all in the
> same batch file with no plumbing, data conversion or additional
> machination.

The way I am sketching above is using R as the scripting language. It's a 
pretty powerful one, certainly powerful enuough to do the text processing 
needed to prepare SQL queries.

> But if I could do this in MySQL + R, well in a few years I'd have the down
> payment for an Audi TT instead of having given it to SAS Institute.
>
> If someone found a practical way to make this work -- pls let me know.  And
> thanks in advance.
>
> Jack Williamson
> LECG
> 2049 Century Park East, Suite 2300
> Los Angeles CA 90067
> 323-683-5004
> [EMAIL PROTECTED]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


Re: [R] How do we get two-tailed p-values for rlm?

2008-01-18 Thread Prof Brian Ripley
On Fri, 18 Jan 2008, Darren Weber wrote:

> How do we get 2-tailed p-values for the rlm summary?
>
> I'm using the following:
>
>>   fit <- rlm(oatRT ~ oatoacData$erp, psi=psi.bisquare, maxit=100,
> na.action='na.omit')
>>   fitsum <- summary(fit, cor=F)
>>   print(fitsum)
>
> Call: rlm(formula = oatRT ~ oatoacData$erp, psi = psi.bisquare, maxit = 100,
>
>   na.action = "na.omit")
> Residuals:
>Min   1Q   Median   3Q  Max
> -120.616  -50.637   -5.895   60.356  199.066
>
> Coefficients:
>  ValueStd. Error t value
> (Intercept)574.5204  25.858222.2181
> oatoacData$erp  11.5963   5.3525 2.1665
>
> Residual standard error: 83.29 on 36 degrees of freedom
> (2 observations deleted due to missingness)
>>   i <- length(fitsum$coefficients) - dim(fitsum$coefficients)[1] + 1
>>   j <- length(fitsum$coefficients)
>>   tvalues <- fitsum$coefficients[i:j]
>>   pvalues <- pt(tvalues, df=fitsum$df[2])
>>   print(rbind(tvalues, pvalues))
>   [,1]  [,2]
> tvalues 22.21815 2.1664977
> pvalues  1.0 0.9815145
>
>
> If I use the lower.tail=FALSE argument to pt, then I seem to get only the
> p-values for anything > my t value.  Do have to call pt twice, once with
> lower.tail=TRUE and once with lower.tail=FALSE to get 2-tailed p-values?

The t distribution is symmetric, so you just double the upper tail value.
(See the code of summary.lm for how it does this.)

BUT, what justifies the assumption of a t distribution here?
Even for lm, the calculations rely on a normal distribution of errors, and 
robust methods are used precisely to avoid that.
rlm() is support software for a book, and this issue and alternatives 
(e.g. bootstrapping) are discussed there.

>
> Thanks in advance, Darren
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


[R] MySQL + R as a Replacement for SAS Proc SQL + Various Stat Procs

2008-01-18 Thread JWilliamson

For cost reasons, I'd like to replace SAS on my PC under Win XP Pro.

Nearly all my work involves medium-size datasets (100k-10M) records which I
cleanup, relate, fliter and get into shape for analysis using SAS/SQL
followed by standard statistical procedures, e.g. regression using SAS proc
reg.

It seems to me that this type of analysis could be done in MySQL followed
by R, but I'd like some advice about the best way to pass datasets from
MySQL to R.  I understand there are various connectivity packages
avaialble, RODBC and RMySQL, but I'd appreciate some advice about where to
dig in first.

I'd like to avoid additional syntax in my SQL code -- so it seems better
not to coat SQL queries in R wrappers and pass them to MySQL -- probably
better for my way of working to finish all the SQL work and pass a clean
table ready to analyze to R.

One of the great advantages for me using SAS is that I can beat the data
into shape using proc SQL and then call proc STAT_OF_THE_DAY all in the
same batch file with no plumbing, data conversion or additional
machination.

But if I could do this in MySQL + R, well in a few years I'd have the down
payment for an Audi TT instead of having given it to SAS Institute.

If someone found a practical way to make this work -- pls let me know.  And
thanks in advance.

Jack Williamson
LECG
2049 Century Park East, Suite 2300
Los Angeles CA 90067
323-683-5004
[EMAIL PROTECTED]

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


Re: [R] how to use different variable to store values with different length in a loop

2008-01-18 Thread jim holtman
I would recommend that you use a "list" instead of creating the
variables.  Here is how you might do a list:

# preallocate the list
myList <- vector('list', 100)
for (i in 1:100){
.you calculations.
myList[[i]] <- result
}

If you really want to create 100 variables, then use 'assign':

for (i in 1:100){
 your calculations
assign(paste("A", i, sep=""), result)
}

But a 'list' is much easier to handle especially in that all the
related data is in one object.


On Jan 18, 2008 10:28 PM, Jack Luo <[EMAIL PROTECTED]> wrote:
> Hi, List
>
> I am trying to use variables named A1, A2, ..., A100 to store some values,
> each variable could store some values with different length, how can I
> achieve this?
>
> Thanks,
>
> Jack
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

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


[R] how to use different variable to store values with different length in a loop

2008-01-18 Thread Jack Luo
Hi, List

I am trying to use variables named A1, A2, ..., A100 to store some values,
each variable could store some values with different length, how can I
achieve this?

Thanks,

Jack

[[alternative HTML version deleted]]

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


[R] How do we get two-tailed p-values for rlm?

2008-01-18 Thread Darren Weber
How do we get 2-tailed p-values for the rlm summary?

I'm using the following:

>   fit <- rlm(oatRT ~ oatoacData$erp, psi=psi.bisquare, maxit=100,
na.action='na.omit')
>   fitsum <- summary(fit, cor=F)
>   print(fitsum)

Call: rlm(formula = oatRT ~ oatoacData$erp, psi = psi.bisquare, maxit = 100,

   na.action = "na.omit")
Residuals:
Min   1Q   Median   3Q  Max
-120.616  -50.637   -5.895   60.356  199.066

Coefficients:
  ValueStd. Error t value
(Intercept)574.5204  25.858222.2181
oatoacData$erp  11.5963   5.3525 2.1665

Residual standard error: 83.29 on 36 degrees of freedom
 (2 observations deleted due to missingness)
>   i <- length(fitsum$coefficients) - dim(fitsum$coefficients)[1] + 1
>   j <- length(fitsum$coefficients)
>   tvalues <- fitsum$coefficients[i:j]
>   pvalues <- pt(tvalues, df=fitsum$df[2])
>   print(rbind(tvalues, pvalues))
   [,1]  [,2]
tvalues 22.21815 2.1664977
pvalues  1.0 0.9815145


If I use the lower.tail=FALSE argument to pt, then I seem to get only the
p-values for anything > my t value.  Do have to call pt twice, once with
lower.tail=TRUE and once with lower.tail=FALSE to get 2-tailed p-values?

Thanks in advance, Darren

[[alternative HTML version deleted]]

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


[R] Serez -vous notre prochain gagnant?

2008-01-18 Thread Tentez votre chance



--
Pour vous d�sabonner � cette liste, visitez 
http://jbala.ws/lists/lt.php?id=MkxTBQYBCFVIAU8AVV1XAQ%3D%3D

Pour mettre vos pr�f�rences � jour, visitez 
http://jbala.ws/lists/lt.php?id=MkxTBQYBCFRIAU8AVV1XAQ%3D%3D
Faire suivre un message a quelqun 
http://jbala.ws/lists/lt.php?id=MkxTBQYBCFdIAU8AVV1XAQ%3D%3D


--
Powered by PHPlist, www.phplist.com --

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


Newsletter: Vielen dank f�r ihre Anmeldung!

2008-01-18 Thread steinfeuerfred
Hallo,

Ihre E-Mailadresse "[EMAIL PROTECTED]" wurde in den Newsletterverteiler 
hinzugefügt.

URL: http://www.fueralles.de/cgi-bin/nsl_pro/newsletter.cgi?id=steinfeuerfred

Mit freundlichen Grüssen Ihr Newsletter-Team

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


Re: [R] Adding a table to a plot

2008-01-18 Thread John Kane
Here is the brute force method.  It would probably not
be very difficult to turn in into a function. In fact
I am pretty sure that someone has but I cannot find
what package it is in.

x <- "Time   SD   Mean
   12.5   30
   2a.3   40"
xx <- read.table(textConnection(x), header=TRUE,
as.is=TRUE); xx

plot(1:10, type="n" )
text(c(1.2, 2, 3), 8, labels=names(xx), cex=.7)
arrows(.75,7.75, 3.5, 7.75, length=0)
text(c(1.2, 2, 3), 7.5, labels=xx[1,], cex=.7)
text(c(1.2, 2, 3), 7.0, labels=xx[2,], cex=.7)
arrows(.75, 6.75,3.5, 6.75, length=0)

--- Judith Flores <[EMAIL PROTECTED]> wrote:

> Hi R-experts,
>Is it possible to add a table (text and lines) to
> the plot area?
> I have a data frame that looks something like this:
> >mydata
>  Time   SD   Mean
>12.5   30
>2a.3   40
> I am using R 2.6.1, in Windows.
> 
> Thank you,
> 
> Judith Flores

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


Re: [R] Fortran level mismatch between package and R

2008-01-18 Thread Hesen Peng
Hi,

I recompiled R using gfortran in my personal laptop. But I think it
may help if you build an agent C program which calls the FORTRAN
program, and then call the C program from R.

I'm also curious on how to solve this problem without too much work.
Please let me know if you find a good solution.

On Jan 19, 2008 12:58 AM, Steve Simmons <[EMAIL PROTECTED]> wrote:
> We have a user here who is attempting to compile a package which
> requires f90 (gfortran will do). Our version of R was built with f77
> (g77). When the user attempts to build the package, f77 is always
> invoked and fails due to the presence of f90 features.
>
> Is there a simple method or some documentation on how to force a
> package build to use a different compiler than the one used in
> building R? If so, are opening ourselves up to any problems? In
> particular, we're concerned about API mismatches and fortran library
> mismatches, but there may be other problems we've not considered.
>
> We're using R 2.4.1, linux 2.6/x64, gcc/gfortran 4.0.
>
> To pre-answer some possible questions/suggestions -
>
> Doing a full conversion of our R installation is almost certainly not
> feasible; we also have legacy packages in place which don't build
> with f90/f95.
>
> Yes, we've thought of installing R built with gfortran and retaining
> the old with f77; that's probably our first fallback. Unfortunately
> that shuts legac package users from R improvements and will shut them
> out from packages which start require R2.6 and up features. We do
> *not* wish to run a f77 version of R2.6 and a f95 version of R2.6.
> That's probably our last fallback.
>
> Neither Suleman nor I are on the r-help mailing lists; please try to
> cc us on responses. We'll use the maillist archives to try and catch
> the responses which don't do that.
>
> Advance thanks,
>
> Steve Simmons
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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


[R] Newsletter - Aktivierungslink

2008-01-18 Thread steinfeuerfred
Sehr geehrte(r) Abonnent(in),

Ihre E-Mailadresse "[EMAIL PROTECTED]" wurde in unseren Newsletter eingetragen.
Um die Anmeldung abzuschliessen, folgen Sie dem Link unterhalb.

Dieses Verfahren schützt Sie vor ungewollten Mails von 
unserer Seite aus. Wir bitten Sie daher um Verständins.

Sollten Sie diesen Newsletter, nun doch nicht beziehen 
oder Sie sich nicht bei uns eingetragen haben, 
ignorieren bzw. löschen Sie dieses E-Mail.

Aktivierungslink: 
http://www.fueralles.de/cgi-bin/nsl_pro/newsletter.cgi?id=steinfeuerfred&[EMAIL 
PROTECTED]&key=zX.CFWryYXJts&action=aktiv

Mit freundlichen Grüssen
Ihr Newsletter-Team

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


[R] modifing barplot

2008-01-18 Thread Monica Pisica

Hi,
 
I would like to modify how barplot  plots. For reasons only my supervisor 
comprehends i need to do the crisscross lines in the bar thicker. If i use 
lwd=2 the y-axis is thicker, (i use the option beside = TRUE)  but nothing else 
is affected by this parameter - it seems. I looked at the barplot.r code but i 
am afraid i don't quite understand it so . i am at loss.
 
I am using windows xp and R 2.6.1.
 
I will really appreciate if anybody has any idea how to do it.
 
Thanks,
 
Monica 
_
Need to know the score, the latest news, or you need your Hotmail®-get your 
"fix".

[[alternative HTML version deleted]]

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


Re: [R] things that are difficult/impossible to do in SAS or SPSSbut simple in R

2008-01-18 Thread Tim Churches
hadley wickham wrote:
> On Jan 18, 2008 1:19 PM, Jeffrey J. Hallman <[EMAIL PROTECTED]> wrote:
>> Frank E Harrell Jr <[EMAIL PROTECTED]> writes:
>>
>>> Rob Robinson wrote:
 I wonder if those who complain about SAS as a programming environment have
 discovered SAS/IML which provides a programming environment akin to Matlab
 which is more than capable (at least for those problems which can be 
 treated
 with a matrix like approach). As someone who uses both SAS and R - 
 graphical
 output is so much easier in R, but for handling large 'messy' datasets SAS
 wins hands down...
 Cheers
 Rob
>>> My understanding is that PROC IML is disconnected from the rest of the
>>> SAS language, e.g., you can't have a loop in which PROC GENMOD is called
>>> or datasets are merged.  If that's the case, IML is not very competitive
>>> in my view.
>> I know about IML, but have never really used it.  Back when I was doing that
>> kind of stuff (before discovering S-Plus) I used GAUSS for compute-intensive
>> matrix simulations and the like.  I didn't have SAS for my PC, and there was
>> no way I could tie up the Sun boxes at work with simulations for my thesis.
>>
>> But while IML does some nice stuff, it just reinforces the point I made in
>> another post about the proliferation of "little languages" in SAS.  By my 
>> count,
>> that are now 5:
>>
>> 1.  data step programming
>> 2.  macros -- a 'language' grafted on top of data step programming
>> 3.  scl -- if you want to do any kind of user interface
>> 4.  af  -- object-oriented framework built on top of scl
>> 5.  iml -- matrix language like GAUSS, but doesn't play well with 1:4 above.
> 
> 6. the "proc" language

7. java - used to create SAS web applications via webAF etc
7a. JavaScript

8. C, FORTRAN, PL/I, or IBM assembler - if you want to create a new 
first-class function or procedure in SAS using SAS/TOOLKIT (otherwise 
you only have pseudo-functions via the SAS macro language and all its 
horrors).

Tim C

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


Re: [R] Regex magic anyone?

2008-01-18 Thread Johannes Graumann
Great!

Joh

On Friday 18 January 2008 15:22:29 Gabor Grothendieck wrote:
> strapply in the gsubfn package can split strings based on
> content rather than delimiters.
>
> > library(gsubfn)
> > strapply(s, ".[(].[)]|.")[[1]]
>
>  [1] "A""B""C""D""E""F""G""T(P)" "H""I"
> [11] "J""K"
>
> See home page at:
> http://gsubfn.googlecode.com
> and vignette:
> library(gsubfn); vignette("gsubfn")
>
> On Jan 18, 2008 9:09 AM, Johannes Graumann <[EMAIL PROTECTED]> wrote:
> > Hi again,
> >
> > how to elegantly split
> >
> > s <- "ABCDEFGT(P)HIJK"
> >
> > into
> >
> > "A" "B" "C" "D" "E" "F" "G" "T(P)" "H" "I" "J" "K"
> >
> > (independently of which letters 'T' or 'P' actually represent ...).
> >
> > Please jumstart my regexing,
> >
> > Joh
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html and provide commented,
> > minimal, self-contained, reproducible code.




signature.asc
Description: This is a digitally signed message part.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] html search not working

2008-01-18 Thread Duncan Murdoch
On 1/18/2008 3:07 PM, [EMAIL PROTECTED] wrote:
> Sorry the first email had no subject.
> I've searched around and havent had much luck trying to explain why my
> HTML search no longer works.  If I use
> ?cor.test
> it is unable to display the webpage.  Is this a java problem?  I am
> running windows xp, and use Internet explorer for my default browser.

Java is not used in ?cor.test, that simply constructs a URL and calls 
browseURL.  Does browseURL("http://www.r-project.org";) work?  If not, 
see the browseURL help page (using some method other than HTML help!) 
for ways to specify a browser that works.

Duncan Murdoch

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


[R] How to write a Greek letter in a graph?

2008-01-18 Thread cathelf

Hi,
Sorry for bothering you again. I have a small question about the graph and
the following is my code:

xyplot(power1+power2 ~ pi0, data=resultb, ylab="Average 
Power", type="l", pch=LETTERS[1:2], lty=c(1:2), main="(a)")

The name of the X-axis will be “pi0” in the graph. 


What should I do if I want the name of the X-axis is the 
Greek letter of “pi0”?


Thanks a lot!
Catherine

-- 
View this message in context: 
http://www.nabble.com/How-to-write-a-Greek-letter-in-a-graph--tp14957789p14957789.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] things that are difficult/impossible to do in SAS or SPSSbut simple in R

2008-01-18 Thread hadley wickham
On Jan 18, 2008 1:19 PM, Jeffrey J. Hallman <[EMAIL PROTECTED]> wrote:
> Frank E Harrell Jr <[EMAIL PROTECTED]> writes:
>
> > Rob Robinson wrote:
> >> I wonder if those who complain about SAS as a programming environment have
> >> discovered SAS/IML which provides a programming environment akin to Matlab
> >> which is more than capable (at least for those problems which can be 
> >> treated
> >> with a matrix like approach). As someone who uses both SAS and R - 
> >> graphical
> >> output is so much easier in R, but for handling large 'messy' datasets SAS
> >> wins hands down...
> >> Cheers
> >> Rob
> >
> > My understanding is that PROC IML is disconnected from the rest of the
> > SAS language, e.g., you can't have a loop in which PROC GENMOD is called
> > or datasets are merged.  If that's the case, IML is not very competitive
> > in my view.
>
> I know about IML, but have never really used it.  Back when I was doing that
> kind of stuff (before discovering S-Plus) I used GAUSS for compute-intensive
> matrix simulations and the like.  I didn't have SAS for my PC, and there was
> no way I could tie up the Sun boxes at work with simulations for my thesis.
>
> But while IML does some nice stuff, it just reinforces the point I made in
> another post about the proliferation of "little languages" in SAS.  By my 
> count,
> that are now 5:
>
> 1.  data step programming
> 2.  macros -- a 'language' grafted on top of data step programming
> 3.  scl -- if you want to do any kind of user interface
> 4.  af  -- object-oriented framework built on top of scl
> 5.  iml -- matrix language like GAUSS, but doesn't play well with 1:4 above.

6. the "proc" language

Hadley

-- 
http://had.co.nz/

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


[R] html search not working

2008-01-18 Thread dkowalske
Sorry the first email had no subject.
I've searched around and havent had much luck trying to explain why my
HTML search no longer works.  If I use
?cor.test
it is unable to display the webpage.  Is this a java problem?  I am
running windows xp, and use Internet explorer for my default browser.
Thanks



--
David Kowalske Jr
Graduate Research Assistant
School for Marine Science and Technology
UMASS-Dartmouth
838 S. Rodney French Blvd.
New Bedford, MA 02744
(508)-910-6368

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


Re: [R] things that are difficult/impossible to do in SAS or SPSS but simple in R

2008-01-18 Thread Marc Schwartz
Jeffrey J. Hallman wrote:
> Frank E Harrell Jr <[EMAIL PROTECTED]> writes:
> 
>> Rob Robinson wrote:
>>> I wonder if those who complain about SAS as a programming environment have
>>> discovered SAS/IML which provides a programming environment akin to Matlab
>>> which is more than capable (at least for those problems which can be treated
>>> with a matrix like approach). As someone who uses both SAS and R - graphical
>>> output is so much easier in R, but for handling large 'messy' datasets SAS
>>> wins hands down...
>>> Cheers
>>> Rob
>> My understanding is that PROC IML is disconnected from the rest of the 
>> SAS language, e.g., you can't have a loop in which PROC GENMOD is called 
>> or datasets are merged.  If that's the case, IML is not very competitive 
>> in my view.
> 
> I know about IML, but have never really used it.  Back when I was doing that
> kind of stuff (before discovering S-Plus) I used GAUSS for compute-intensive
> matrix simulations and the like.  I didn't have SAS for my PC, and there was
> no way I could tie up the Sun boxes at work with simulations for my thesis. 
> 
> But while IML does some nice stuff, it just reinforces the point I made in
> another post about the proliferation of "little languages" in SAS.  By my 
> count,
> that are now 5:
> 
> 1.  data step programming
> 2.  macros -- a 'language' grafted on top of data step programming
> 3.  scl -- if you want to do any kind of user interface
> 4.  af  -- object-oriented framework built on top of scl
> 5.  iml -- matrix language like GAUSS, but doesn't play well with 1:4 above.
> 
> To be a competent SAS programmer you need to keep 5 different languages
> with 5 different sets of rules in your head while you're coding.  I can't do
> this, and I've never met anyone who could.  The SAS programmers I've worked
> with all had to consult manuals or example code frequently to figure out how
> to do anything complicated.  With R, you just write it.
> 
> I've rewritten a number of ugly SAS programs in R.  Typically, the R code is a
> third or less the size of the SAS code, although I just did a program a couple
> of days ago in which 112 lines of R replaced two SAS programs totalling 1900
> lines of code, for an 18:1 reduction.  Now you could argue that those were
> poorly-written SAS programs, and I would agree.  But in my experience, most
> SAS programs are poorly written.  SAS provides such poor programming tools
> that most good programmers move on to something else as soon as they can.
> 
> Jeff

I think that the phrase "ugly SAS" is a redundancy...

BTW, you have likely heard the old joke about the international
obfuscated programming contest, which was open to all programming languages?

The winner?

A one line SAS macro...



If you want to see some nice examples of obfuscated Perl:

  http://www.perlmonks.org/?node=Obfuscated Code

Cheers,

Marc Schwartz

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


Re: [R] things that are difficult/impossible to do in SAS or SPSSbut simple in R

2008-01-18 Thread Jeffrey J. Hallman
Frank E Harrell Jr <[EMAIL PROTECTED]> writes:

> Rob Robinson wrote:
>> I wonder if those who complain about SAS as a programming environment have
>> discovered SAS/IML which provides a programming environment akin to Matlab
>> which is more than capable (at least for those problems which can be treated
>> with a matrix like approach). As someone who uses both SAS and R - graphical
>> output is so much easier in R, but for handling large 'messy' datasets SAS
>> wins hands down...
>> Cheers
>> Rob
>
> My understanding is that PROC IML is disconnected from the rest of the 
> SAS language, e.g., you can't have a loop in which PROC GENMOD is called 
> or datasets are merged.  If that's the case, IML is not very competitive 
> in my view.

I know about IML, but have never really used it.  Back when I was doing that
kind of stuff (before discovering S-Plus) I used GAUSS for compute-intensive
matrix simulations and the like.  I didn't have SAS for my PC, and there was
no way I could tie up the Sun boxes at work with simulations for my thesis. 

But while IML does some nice stuff, it just reinforces the point I made in
another post about the proliferation of "little languages" in SAS.  By my count,
that are now 5:

1.  data step programming
2.  macros -- a 'language' grafted on top of data step programming
3.  scl -- if you want to do any kind of user interface
4.  af  -- object-oriented framework built on top of scl
5.  iml -- matrix language like GAUSS, but doesn't play well with 1:4 above.

To be a competent SAS programmer you need to keep 5 different languages
with 5 different sets of rules in your head while you're coding.  I can't do
this, and I've never met anyone who could.  The SAS programmers I've worked
with all had to consult manuals or example code frequently to figure out how
to do anything complicated.  With R, you just write it.

I've rewritten a number of ugly SAS programs in R.  Typically, the R code is a
third or less the size of the SAS code, although I just did a program a couple
of days ago in which 112 lines of R replaced two SAS programs totalling 1900
lines of code, for an 18:1 reduction.  Now you could argue that those were
poorly-written SAS programs, and I would agree.  But in my experience, most
SAS programs are poorly written.  SAS provides such poor programming tools
that most good programmers move on to something else as soon as they can.

Jeff

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


Re: [R] Adding a table to a plot

2008-01-18 Thread Frank E Harrell Jr
Judith Flores wrote:
> Hi R-experts,
> 
>Is it possible to add a table (text and lines) to
> the plot area?
> 
> I have a data frame that looks something like this:
> 
>> mydata
> 
>  Time   SD   Mean
>12.5   30
>2a.3   40
> 
> 
> I am using R 2.6.1, in Windows.
> 
> Thank you,
> 
> Judith Flores

If you use LaTeX there is an elegant way to do that and to have full 
control over font, justification, etc.

Frank

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


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

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


Re: [R] re siduals from pcaiv

2008-01-18 Thread Mark Difford

Hi Nikolaos,

>> How can I extract the residuals from a pcaiv/rda in ade4?

>From what you can remember, you can get them as follows (ade4):

## If your call to pcaiv was as follows:
pcaiv(dudi$obj, df=FactorIV, scannf=F, nf=4)

## then get your residuals as follows:
ortho <- pcaivortho(dudi$obj, df=FactorIV, scannf=F, nf=4)
ortho$tab   ## (weighted) residuals == projected variables
with df removed == residuals
print(ortho)

You would do well to post your query on the ade4list, where the
authors/co-authors of the ade4 package are likely to reply.

HTH, Mark.


Nikolaos Fyllas wrote:
> 
> Dear R users,
> 
> How can I extract the residuals from a pcaiv/rda in ade4?
> 
> In Vegan there is the
> residuals()
> function, giving the approximation of the original data from the
> unconstrained ordination
> Is there something similar in ade4?
> 
> Nikos
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/residuals-from-pcaiv-tp14955627p14956791.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Selecting rows conditionally between 2 data.frames

2008-01-18 Thread Charles C. Berry

Looks like a job for

?merge

HTH,

Chuck


On Fri, 18 Jan 2008, jiho wrote:

> Hello everyone,
>
> I have two data.frames that look like
>
> calib:
> place zoomscale
> left  0.658
> left  0.805.6
> left  1.203
> right 0.658.4
> right 0.806
> right 1.202.9
>
> X:
> ...   place   zoom
> ...   left0.80
> ...   left1.20
> ...   right   0.65
> ...   NA  NA  
> ...   right   0.8 
> ...   left1.20
>
> and I want to get the corresponding values of 'scale' in a new column
> in X, i.e.:
> X:
> ...   place   zoomscale
> ...   left0.805.6
> ...   left1.203
> ...   right   0.658.4
> ...   NA  NA  NA
> ...   right   0.8 6
> ...   left1.203
>
> I tried various combination of `which` and `match` but could not make
> it work.
> I fell back on defining a custom function and applying it over the lines
>   get.scales <- function(x)
>   {
>   if (is.na(x$zoom)) {
>   scaleF = NA
>   } else {
>   scaleF = calib[calib$zoom==x$zoom & 
> calib$place==x$place, "scale"]
>   }
>   return(scaleF)
>   }
> and
>   apply(X, 1, get.scales)
> but:
> - this is not very practical since using apply apparently converts the
> data to an array and looses column titles (i.e. x$size does not work,
> I need to use column numbers, which I'd rather not)
> - I feel there is an easier, vector based way.
>
> I would welcome suggestions. Thank you in advance.
>
> JiHO
> ---
> http://jo.irisson.free.fr/
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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


[R] Adding a table to a plot

2008-01-18 Thread Judith Flores
Hi R-experts,

   Is it possible to add a table (text and lines) to
the plot area?

I have a data frame that looks something like this:

>mydata

 Time   SD   Mean
   12.5   30
   2a.3   40


I am using R 2.6.1, in Windows.

Thank you,

Judith Flores
 


  

Looking for last minute shopping deals?

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


[R] forming a linear discriminant function from the output of lda()

2008-01-18 Thread Pietrzykowski, Matthew (GE, Research)
Hello all-

I am a relatively new user of R and am working through a graduate course
in
Statistics that uses Minitab, SAS and some Matlab.  I like using R but
am 
having some trouble lining up the output from lda() to that of the other
programs'
results.  The dataset below is a modified set of wine data from the
Pinot Noir
data set as an illustration of the 2 group LDA scenario.

MoBa Region
1  0.058 0.225  3
2  0.071 0.105  3
3  0.147 0.301  2
4  0.116 0.166  3
5  0.166 0.132  3
6  0.261 0.078  3
7  0.191 0.085  3
8  0.009 0.072  3
9  0.027 0.094  3
10 0.030 0.349  2
11 0.268 0.099  3
12 0.245 0.071  3
13 0.161 0.181  2
14 0.146 0.328  2
15 0.155 0.081  3
16 0.126 0.299  2
17 0.211 0.206  2
18 0.129 0.281  2
19 0.166 0.292  2
20 0.199 0.292  2
21 0.208 0.087  3

There are various displays from SAS, Minitab and Matlab's Statistics
Toolbox, but
they all agree with the final linear discriminant function: 0 = -19.51 +
21.47*Mo + 84.08*Ba.

When I run the following code in R: 

> library(MASS)
> wine.lda <- lda(Region ~ Mo + Ba, data = wine, prior = c(1,1)/2)
> wine.lda
Call:
lda(Region ~ Mo + Ba, data = wine, prior = c(1, 1)/2)

Prior probabilities of groups:
  2   3 
0.5 0.5 

Group means:
 MoBa
2 0.146 0.281
3 0.1479167 0.1079167

Coefficients of linear discriminants:
  LD1
Mo  -5.636024
Ba -22.069187

I am having trouble going from the cofficients derived from the
spherical within group covariance to the
function I am able to obtain in the other programs.

The rest of the problem set up for all programs are: Region = group
assignment, prior = equal priors and 
I do not do any data pretreatment prior to analysis.

Any help would be great.

Thanks,

Matt

[[alternative HTML version deleted]]

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


[R] (no subject)

2008-01-18 Thread dkowalske
I've searched around and havent had much luck trying to explain why my
HTML search no longer works.  If I use
?cor.test
it is unable to display the webpage.  Is this a java problem?  I am
running windows xp.
Thanks


--
David Kowalske Jr
Graduate Research Assistant
School for Marine Science and Technology
UMASS-Dartmouth
838 S. Rodney French Blvd.
New Bedford, MA 02744
(508)-910-6368

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


Re: [R] plotting other axes for PCA

2008-01-18 Thread Mark Difford

Hi Silvia,

>> What I need is exactly what I get using biplot (pca.object) but for other
>> axes.

You need to look at ?biplot.prcomp (argument: choices=)

## Try
biplot(prcomp(USArrests), choices=c(1,2)) ## plots ax1 and ax2
biplot(prcomp(USArrests), choices=c(1,3)) ## plots ax1 and ax3

Also look at package ade4 (which in my view still sets the standard in R)

## Example
T.pca <- dudi.pca(USArrests, scannf=F, nf=4)
scatter(T.pca, clab.r=0.5, clab.c=.8)
scatter(T.pca, clab.r=0.5, clab.c=.8, xax=1, yax=3, posie="none")
add.scatter.eig(T.pca$eig, T.pca$nf, "bottomright", xax=1, yax=3)

## Exclude row labels
scatter(T.pca, clab.r=0, clab.c=.8)

HTH, Mark.





Silvia Lomascolo wrote:
> 
> Hi R-community,
> I am doing a PCA and I need plots for different combinations of axes
> (e.g., PC1 vs PC3, and PC2 vs PC3) with the arrows indicating the loadings
> of each variables.  What I need is exactly what I get using biplot
> (pca.object) but for other axes.
> 
> I have plotted PC2 and 3 using the scores of the cases, but I don't get
> the arrows proportional to the loadings of each variables on each axis.
> 
> Any hints on this?
> 
> Thanks, Silvia.
> 

-- 
View this message in context: 
http://www.nabble.com/plotting-other-axes-for-PCA-tp14952955p14955292.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] more help needed Re: communicate from Rterm

2008-01-18 Thread stephen bond
I think the message from Prof. Ripley refers to calling shell and 
system from R. There is no "system" call in Windows cmd or VBA and I am 
calling R from VBA.

Now I want to use tryCatch to output the error to a text file and exit 
gracefully. My expression will be source("file.r") and that will 
contain file I/O and db connect+query. to exemplify I am trying with

tryCatch(read.csv(nosuchfile.csv),error=function(e){print
(signalCondition(e)},finally=print("graceful exit"))

and not only it does not work but prints me a warning, so handling 
definitely fails.

Please, help or refer to tryCatch examples with real handlers. I could 
not get much out of the examples in the help file.

Thanks everybody

Original Message
From: [EMAIL PROTECTED]
Date: 01/11/2008 12:31 
To: "Duncan Murdoch"<[EMAIL PROTECTED]>
Cc: "stephen bond"<[EMAIL PROTECTED]>, 
Subj: Re: [R] communicate from Rterm

I think the confusion may be the assumption that Microsoft's use of 
'shell' has anything to do with 'shell' as used in the Unix/POSIX 
world.

For MinGW C executables (like Rterm.exe), redirection is expected to 
be 
handled by a shell, not by the executable.  (Other Windows runtimes 
may 
handle redirection themselves.)

Compare the R-for-Windows system() and shell() commands and you will 
see 
one way to do this.

On Fri, 11 Jan 2008, Duncan Murdoch wrote:

> On 1/11/2008 10:14 AM, stephen bond wrote:
>> I try with:
>>
>> ret = Shell(exestr)
>>
>> and it starts R, but the source file is not executed
>
> That's a VBA issue.  VBA isn't handling the input redirection "< m.
in.R
> > out.txt".  I don't know how to set that up:  you'll need to 
contact
> Microsoft tech support.
>
> Duncan Murdoch
>
>>
>> inside R
>>
>>> a=commandArgs()
>>> a
>> [1] "Rterm"  "--restore" "--save"  "--args" "2005-02-03" #correct 
date
>> passed
>> [6]  "<"  "m.in.R"  ">"  "out.txt"
>>>
>>
>> it restores the correct workspace, but then it fails to source the
>> script, which is located in the same dir as the workspace.
>>
>> inside R
>>
>>> source("m.in.R") # does the job, so it is not a finding problem
>>
>> BTW is it possible to get the error message from R somehow???
>>
>>
>> Original Message
>> From: [EMAIL PROTECTED]
>> Date: 01/11/2008 6:30
>> To: "stephen bond"<[EMAIL PROTECTED]>
>> Cc: 
>> Subj: Re: [R] communicate from Rterm
>>
>> On 1/11/2008 9:18 AM, stephen bond wrote:
>>> Please, help with announcing an error from Rterm:
>>>
>>> I am calling R from an Excel VBA and noticed that if there is an
>> error
>>> nothing conspicuous happens. I would like just a popup window when
>> R
>>> cannot finish cleanly. The "ret " value returned from Shell is
>> useless
>>> in determining what happened.
>>
>> This seems to be a VBA problem, not an R problem.  Rterm returns a 
0
>> return value when it exits cleanly, and a non-zero value when 
there's
>> an
>> error.  It looks as though you're losing that by wrapping the Rterm
>> call
>> in a batch file.  Can't VBA make the call to Rterm directly?
>>
>> Duncan Murdoch
>>
>>>
>>> Thank you all.
>>>
>>> *
>>> Public Sub Repo()
>>> ds = InputBox("Type in reporting date as -MM-DD", "reporting
>>> date")
>>>
>>> ''-   weird way to pass the date argument as Windows won't
>>> ''-   execute the command line directly, so I create a .bat
>>>
>>> exestr = "Rterm --restore --save --args " & ds & " < m.in.R > out.
>> txt"
>>> Set fs = CreateObject("Scripting.FileSystemObject")
>>> Set a = fs.CreateTextFile("rpcd.bat", True)
>>> a.writeline (exestr)
>>> a.Close
>>>
>>> ret = Shell("rpcd.bat")
>>> MsgBox ("wait for about 5 seconds as the script runs
>> asynchronously")
>>>
>>> End Sub
>>>
>>> **m.in.R
>>> ds=commandArgs(T)[1]
>>>
>>> ans=f.repo(ds)
>>>
>>> q("yes")
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-
>> guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-
guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

_

Re: [R] image/area plot

2008-01-18 Thread Marta Rufino
Yes, that is it, a square pie chart :-) I did not knew the name... sorry...

Does anyone knows about it?
Thank you very much,
Best wishes,
Marta

hadley wickham wrote:
> Do you have an example graphic that shows what you're trying to
> create?  I can't figure out if you want something like a square pie
> chart (aka waffle chart), a stacked barchart, a levelplot, or
> something else.
>
> Hadley
>
> On Jan 18, 2008 6:06 AM, Marta Rufino <[EMAIL PROTECTED]> wrote:
>   
>> Dear R users,
>>
>> I am trying to produce an image plot, that represents the proportions of
>> a factor (z variable), so that the number of squares of each colour
>> represents each factor level, with the respective label inside (sorry
>> for the crap English).
>>
>> # Something like this:
>>
>> kk=data.frame(fact=letters[1:10], freq=c(5,1,10,2,10,7,5,10,30,20)) #
>> factor and respective frequecies
>> res="a" # transform into a matrix (is there an easier way to do this?...
>> for the image plot
>> for(ii in 1:dim(kk)[1]){
>> res=c(res, rep(as.character(kk[ii,1]), l=kk[ii, 2]))
>> }
>> res=res[-1]
>> res
>> res=matrix(c(factor(res)), nc=10)
>>
>> image(x=1:10,y=1:10, res[,order(colSums(res))], col=rainbow(20))
>> abline(h=seq(0.5,10.5,1), col=8, lty=3); abline(v=seq(0.5,10.5,1),
>> col=8, lty=3)#add some gridlines
>>
>> #Problems:
>> #1. How to add the labels in each area
>> text(1,1,paste("Factor level",kk[1,1]), pos=4)
>>
>> #2. How to separate the areas of each factor level (for BW printing),
>> with lines (instead of colours as it is)
>> segments(.5,1.5,5.5,1.5, lwd=2);segments(5.5,.5,5.5,1.5, lwd=2) #
>> something like this, but automatically :-(
>>
>> #3. How to keep the areas together (contiguous) and not allow split over
>> to lines?
>>
>> #4. Could I replace the col. by a symbol, for example? I think I would
>> need to use plot instead of image.
>> Any help will be much apretiated,
>>
>> Thank you very much in advance,
>> Best wishes,
>> Marta
>> PS: This type of graphs are used in community ecology analysis, for
>> example-...
>>
>> --
>> ...
>> Marta M. Rufino (PhD)
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>> 
>
>
>
>   

-- 
...
Marta M. Rufino (PhD)

.
Instituto Nacional de Investigação Agrária e das Pescas (INIAP/IPIMAR),
Centro Regional de Investigação Pesqueira do Sul (CRIPSul)
Avenida 5 de Outubro s/n
P-8700-305 Olhão, Portugal
+351 289 700 541

. 
Institut de Ciències del Mar - CMIMA (CSIC)
Passeig Marítim de la Barceloneta, 37-49  
08003 BARCELONA - Catalunya
Spain 






[[alternative HTML version deleted]]

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


Re: [R] plotting other axes for PCA

2008-01-18 Thread Prof Brian Ripley
On Fri, 18 Jan 2008, Silvia Lomascolo wrote:

>
> Hi R-community,
> I am doing a PCA and I need plots for different combinations of axes (e.g.,
> PC1 vs PC3, and PC2 vs PC3) with the arrows indicating the loadings of each
> variables.  What I need is exactly what I get using biplot (pca.object) but
> for other axes.

The prcomp and princomp methods of biplot() have argument 'choices' that 
does exactly what you seem to be asking for.

> I have plotted PC2 and 3 using the scores of the cases, but I don't get the
> arrows proportional to the loadings of each variables on each axis.
>
> Any hints on this?
>
> Thanks, Silvia.

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

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


[R] Amusez vous et choisissez vos cadeaux!

2008-01-18 Thread Jouez et Gagnez

 


--
Pour vous d�sabonner � cette liste, visitez 
http://jbala.ws/lists/lt.php?id=MkxaBQUFAB0FTgEDXVVW

Pour mettre vos pr�f�rences � jour, visitez 
http://jbala.ws/lists/lt.php?id=MkxaBQUFAR0FTgEDXVVW
Faire suivre un message a quelqun 
http://jbala.ws/lists/lt.php?id=MkxaBQUFAh0FTgEDXVVW


--
Powered by PHPlist, www.phplist.com --

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


[R] Fortran level mismatch between package and R

2008-01-18 Thread Steve Simmons
We have a user here who is attempting to compile a package which  
requires f90 (gfortran will do). Our version of R was built with f77  
(g77). When the user attempts to build the package, f77 is always  
invoked and fails due to the presence of f90 features.

Is there a simple method or some documentation on how to force a  
package build to use a different compiler than the one used in  
building R? If so, are opening ourselves up to any problems? In  
particular, we're concerned about API mismatches and fortran library  
mismatches, but there may be other problems we've not considered.

We're using R 2.4.1, linux 2.6/x64, gcc/gfortran 4.0.

To pre-answer some possible questions/suggestions -

Doing a full conversion of our R installation is almost certainly not  
feasible; we also have legacy packages in place which don't build  
with f90/f95.

Yes, we've thought of installing R built with gfortran and retaining  
the old with f77; that's probably our first fallback. Unfortunately  
that shuts legac package users from R improvements and will shut them  
out from packages which start require R2.6 and up features. We do  
*not* wish to run a f77 version of R2.6 and a f95 version of R2.6.  
That's probably our last fallback.

Neither Suleman nor I are on the r-help mailing lists; please try to  
cc us on responses. We'll use the maillist archives to try and catch  
the responses which don't do that.

Advance thanks,

Steve Simmons

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


Re: [R] image/area plot

2008-01-18 Thread hadley wickham
Do you have an example graphic that shows what you're trying to
create?  I can't figure out if you want something like a square pie
chart (aka waffle chart), a stacked barchart, a levelplot, or
something else.

Hadley

On Jan 18, 2008 6:06 AM, Marta Rufino <[EMAIL PROTECTED]> wrote:
> Dear R users,
>
> I am trying to produce an image plot, that represents the proportions of
> a factor (z variable), so that the number of squares of each colour
> represents each factor level, with the respective label inside (sorry
> for the crap English).
>
> # Something like this:
>
> kk=data.frame(fact=letters[1:10], freq=c(5,1,10,2,10,7,5,10,30,20)) #
> factor and respective frequecies
> res="a" # transform into a matrix (is there an easier way to do this?...
> for the image plot
> for(ii in 1:dim(kk)[1]){
> res=c(res, rep(as.character(kk[ii,1]), l=kk[ii, 2]))
> }
> res=res[-1]
> res
> res=matrix(c(factor(res)), nc=10)
>
> image(x=1:10,y=1:10, res[,order(colSums(res))], col=rainbow(20))
> abline(h=seq(0.5,10.5,1), col=8, lty=3); abline(v=seq(0.5,10.5,1),
> col=8, lty=3)#add some gridlines
>
> #Problems:
> #1. How to add the labels in each area
> text(1,1,paste("Factor level",kk[1,1]), pos=4)
>
> #2. How to separate the areas of each factor level (for BW printing),
> with lines (instead of colours as it is)
> segments(.5,1.5,5.5,1.5, lwd=2);segments(5.5,.5,5.5,1.5, lwd=2) #
> something like this, but automatically :-(
>
> #3. How to keep the areas together (contiguous) and not allow split over
> to lines?
>
> #4. Could I replace the col. by a symbol, for example? I think I would
> need to use plot instead of image.
> Any help will be much apretiated,
>
> Thank you very much in advance,
> Best wishes,
> Marta
> PS: This type of graphs are used in community ecology analysis, for
> example-...
>
> --
> ...
> Marta M. Rufino (PhD)
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
http://had.co.nz/

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


Re: [R] histogram with NAs

2008-01-18 Thread hadley wickham
> "Typical plots with vertical bars are not histograms. Consider barplot
> or plot(*, type = "h") for such bar plots. ". But no worry, I've mixed
> them up myself a number of times.

Or you can use ggplot2, which will do the right thing regardless of
whether you have continuous or categorical data:

library(ggplot2)
qplot(sample.data, geom="histogram")
qplot(rnorm(100), geom="histogram")

Hadley

-- 
http://had.co.nz/

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


Re: [R] constrOptim with method SANN

2008-01-18 Thread Jonas Rumpf

Hi,

thanks again for the clarification.
However, then the documentation of constrOptim is
somehow misleading, because it says

"Any optim method that permits infinite values for the
objective function may be used (currently all but "L-BFGS-B")."

But I assume that this (documentation issues) is not something
that is supposed to be discussed on this particular mailing list (or is 
it, I'm new here?).


In addition, it appears strange to me that constrOptim doesn't issue any 
warning
or error when called with method="SANN", (except when the grad argument 
is missing) ?!


Thanks again,
Best regards,
Jonas

Thomas Lumley schrieb:

On Fri, 18 Jan 2008, Jonas Rumpf wrote:


Hi,

thank you for your help, Thomas,
(and my apologies to everyone for the double-post earlier),
however I'm not sure if I understand you correctly:

Are you basically saying that it doesn't really make sense
to use SANN with constrOptim and I should use another
algorithm (like CG etc.) ?



Well, you should use some other algorithm because constrOptim doesn't 
support SANN, as you already had found out.  One reason it doesn't 
support SANN is that it doesn't really make sense to.


  -thomas




Best regards,
Jonas


On Fri, 18 Jan 2008, Jonas Rumpf wrote:

 

Hi Everyone,

I'm trying to minimize a function using constrOptim with
the simulated annealing method SANN.

If I understand constrOptim well, it basically passes most
of its arguments to optim while somehow enforcing the constraints.

My problem is, that since SANN does not need gradients,
when using optim with SANN, the gr argument of optim is
used to specify a function to create the next candidate point
for the annealing algorithm. If it is left NULL, a default Gaussian
Markov kernel is used - which is fine for my purposes.




  


SANN doesn't need gradients, but constrOptim does, and if you have 
the sort of function for which simulated annealing is useful it is 
unlikely to be the sort of function where the adaptive log-barrier 
method works well.
  





 -thomas

Thomas LumleyAssoc. Professor, Biostatistics
[EMAIL PROTECTED]University of Washington, Seattle

  





Thomas LumleyAssoc. Professor, Biostatistics
[EMAIL PROTECTED]University of Washington, Seattle




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


[R] plotting other axes for PCA

2008-01-18 Thread Silvia Lomascolo

Hi R-community,
I am doing a PCA and I need plots for different combinations of axes (e.g.,
PC1 vs PC3, and PC2 vs PC3) with the arrows indicating the loadings of each
variables.  What I need is exactly what I get using biplot (pca.object) but
for other axes.

I have plotted PC2 and 3 using the scores of the cases, but I don't get the
arrows proportional to the loadings of each variables on each axis.

Any hints on this?

Thanks, Silvia.
-- 
View this message in context: 
http://www.nabble.com/plotting-other-axes-for-PCA-tp14952955p14952955.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] gboxplot (JMP Diamond plot in R?)

2008-01-18 Thread Prof Brian Ripley
On Fri, 18 Jan 2008, Richard Yanicky wrote:

> I am looking to replicate the functionality of the JMP diamond plot in 
> R. I have found the following enhancement and no other references(see 
> below). I have tried to contact the author via email and I have had no 
> luck.
>
> Does any know if this functionality exists in R? If it does not does 
> anyone know how to contact the author of the enhancement request?

Look at the maintainer field of the DBI package on CRAN: that is (as far 
as I know) the most current contact address for the same person.

>
> "Hi,
>
> I experimented with a set of S functions to do  "generalized" boxplots
> sometime ago (e.g., "vase" or "violin, "diamond" plots, etc).  There's
> code to draw these gboxplots at arbitrary positions. Please take a look
> at the help below and let me know if you'd like either  to port
> it R or scavange some of the code.
>
> David A JamesPhone: (908) 582-3082
> Bell Labs, Lucent Technologies   Fax:   (908) 582-3340
> 600 Mountain Ave Email: dj at bell-labs.com
> Murray Hill, NJ 07974

[...]

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

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


[R] Selecting rows conditionally between 2 data.frames

2008-01-18 Thread jiho
Hello everyone,

I have two data.frames that look like

calib:
place   zoomscale
left0.658
left0.805.6
left1.203
right   0.658.4
right   0.806
right   1.202.9

X:
... place   zoom
... left0.80
... left1.20
... right   0.65
... NA  NA  
... right   0.8 
... left1.20

and I want to get the corresponding values of 'scale' in a new column  
in X, i.e.:
X:
... place   zoomscale
... left0.805.6
... left1.203
... right   0.658.4
... NA  NA  NA
... right   0.8 6
... left1.203

I tried various combination of `which` and `match` but could not make  
it work.
I fell back on defining a custom function and applying it over the lines
get.scales <- function(x)
{
if (is.na(x$zoom)) {
scaleF = NA
} else {
scaleF = calib[calib$zoom==x$zoom & 
calib$place==x$place, "scale"]
}
return(scaleF)
}
and
apply(X, 1, get.scales)
but:
- this is not very practical since using apply apparently converts the  
data to an array and looses column titles (i.e. x$size does not work,  
I need to use column numbers, which I'd rather not)
- I feel there is an easier, vector based way.

I would welcome suggestions. Thank you in advance.

JiHO
---
http://jo.irisson.free.fr/

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


Re: [R] constrOptim with method SANN

2008-01-18 Thread Thomas Lumley
On Fri, 18 Jan 2008, Jonas Rumpf wrote:

> Hi,
>
> thank you for your help, Thomas,
> (and my apologies to everyone for the double-post earlier),
> however I'm not sure if I understand you correctly:
>
> Are you basically saying that it doesn't really make sense
> to use SANN with constrOptim and I should use another
> algorithm (like CG etc.) ?


Well, you should use some other algorithm because constrOptim doesn't support 
SANN, as you already had found out.  One reason it doesn't support SANN is that 
it doesn't really make sense to.

   -thomas



> Best regards,
> Jonas
>
>> On Fri, 18 Jan 2008, Jonas Rumpf wrote:
>> 
>>   
>>> Hi Everyone,
>>> 
>>> I'm trying to minimize a function using constrOptim with
>>> the simulated annealing method SANN.
>>> 
>>> If I understand constrOptim well, it basically passes most
>>> of its arguments to optim while somehow enforcing the constraints.
>>> 
>>> My problem is, that since SANN does not need gradients,
>>> when using optim with SANN, the gr argument of optim is
>>> used to specify a function to create the next candidate point
>>> for the annealing algorithm. If it is left NULL, a default Gaussian
>>> Markov kernel is used - which is fine for my purposes.
>>> 
>>> 
>> 
>>   
>
>> SANN doesn't need gradients, but constrOptim does, and if you have the sort 
>> of function for which simulated annealing is useful it is unlikely to be the 
>> sort of function where the adaptive log-barrier method works well.
>>   
>
>
>
>>  -thomas
>> 
>> Thomas LumleyAssoc. Professor, Biostatistics
>> [EMAIL PROTECTED]University of Washington, Seattle
>> 
>>   
>
>

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

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


Re: [R] histogram with NAs

2008-01-18 Thread Gustaf Rydevik
On Jan 18, 2008 4:49 PM,  <[EMAIL PROTECTED]> wrote:
> Dear list,
>
> I have a categorical variable in a data.frame that I would like to
> plot using a histogram to show number of events. Values are 0, 1 and
> some NAs. I can´t make the hist() function to
> 1) include a column with the number of NAs
> 2) have the x axis to be categorical, I always get 0, 0.2, 0.4,... 1
> divisions
>
> Can anyone help me?
>
> This is my code. "database" is my data.frame and "Event" is my
> variable.
> attach(database)
> hist(Event, col = 2, main = "Number of Events"))
>
> Thanks in advance,
>
> David


Please read ?hist, especially the line:

"Typical plots with vertical bars are not histograms. Consider barplot
or plot(*, type = "h") for such bar plots. ". But no worry, I've mixed
them up myself a number of times.

To get a column of NA's, see the following:
###Example:
sample.data<-as.factor(sample(c(1,0,NA),100,replace=T))
sample.data<-as.character(sample.data)
sample.data[is.na(sample.data)]<-" NA"
sample.data<-factor(sample.data)
plot(sample.data)
#

/Gustaf


-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik

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


Re: [R] constrOptim with method SANN

2008-01-18 Thread Jonas Rumpf
Hi,

thank you for your help, Thomas,
(and my apologies to everyone for the double-post earlier),
however I'm not sure if I understand you correctly:

Are you basically saying that it doesn't really make sense
to use SANN with constrOptim and I should use another
algorithm (like CG etc.) ?

Best regards,
Jonas

> On Fri, 18 Jan 2008, Jonas Rumpf wrote:
>
>   
>> Hi Everyone,
>>
>> I'm trying to minimize a function using constrOptim with
>> the simulated annealing method SANN.
>>
>> If I understand constrOptim well, it basically passes most
>> of its arguments to optim while somehow enforcing the constraints.
>>
>> My problem is, that since SANN does not need gradients,
>> when using optim with SANN, the gr argument of optim is
>> used to specify a function to create the next candidate point
>> for the annealing algorithm. If it is left NULL, a default Gaussian
>> Markov kernel is used - which is fine for my purposes.
>>
>> 
>
>   

> SANN doesn't need gradients, but constrOptim does, and if you have the sort 
> of function for which simulated annealing is useful it is unlikely to be the 
> sort of function where the adaptive log-barrier method works well.
>   



>  -thomas
>
> Thomas Lumley Assoc. Professor, Biostatistics
> [EMAIL PROTECTED] University of Washington, Seattle
>
>

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


[R] gboxplot (JMP Diamond plot in R?)

2008-01-18 Thread Richard Yanicky
I am looking to replicate the functionality of the JMP diamond plot in R. I 
have found the following enhancement and no other references(see below). I have 
tried to contact the author via email and I have had no luck. 


Does any know if this functionality exists in R? If it does not does anyone 
know how to contact the author of the enhancement request?

"Hi,

I experimented with a set of S functions to do  "generalized" boxplots 
sometime ago (e.g., "vase" or "violin, "diamond" plots, etc).  There's 
code to draw these gboxplots at arbitrary positions. Please take a look
at the help below and let me know if you'd like either  to port
it R or scavange some of the code.

David A JamesPhone: (908) 582-3082
Bell Labs, Lucent Technologies   Fax:   (908) 582-3340
600 Mountain Ave Email: dj at bell-labs.com
Murray Hill, NJ 07974

Generalized Box Plots

USAGE:
   gboxplot(..., type = "box", range.=,
   width=, varwidth=F, notch=F, names.=, horiz = T,
   fill=F, col=1, old = T, plot.it=TRUE)

   gboxplot(..., type = "vase", from=, to=, kernel.width=, n=,
   width=, varwidth=F, notch=F, names.=, horiz = T,
   fill=F, col=1, plot.it=TRUE)

   gboxplot(..., type = "diamond", width=, varwidth=F,
names.=, horiz = T, fill=F, col=1, pch, plot.it=TRUE)

   gboxplot(..., type = "pts", jitter.pts = F,
   width=, varwidth=F, notch=F, names.=, horiz = T,
   fill=F, col=1, pch, plot.it=TRUE)
ARGUMENTS:
...:vectors  or  a list containing a number of numeric compo-
   nents (e.g., the output of split').  Missing values  (NAs)
   are allowed.
type=:character string (the first letter suffices) specifying
   type of gboxplots, currently "box" for  Tukey's  boxplots,
   "vase"  for vase or violin plots (see Benjamini (1988) and
   Hintze and Nelson (1998)),  "diamond"  for  diamond  plots
   (see,  for  instance, JMP (1995)), or "pts" for one dimen-
   sional histograms (See Chambers et. al. (1983)).  Type may
   also  be the name of a user-written function that computes
   an object for which there exists a draw' method.  For  in-
   stance  type  = cmp.vase' specifies the function that com-
   putes vases and which returns an object of  class  "vase";
   the method draw.vase' (automatically called by the generic
   draw') plots the vases.
range.=:controls the strategy for the whiskers  and  the  de-
   tached  points  beyond  the whiskers. By default, whiskers
   are drawn to the nearest value not beyond a standard range
   from  the quartiles; points beyond are drawn individually.
   Giving range.=0' forces whiskers to the full  data  range.
   Any  positive  value  of  range.'  multiplies the standard
   range by this amount.  The standard range  is  1.5*(inter-
   quartile range).
width=:vector of relative box widths.  See also argument var-
   width'.
varwidth=: if TRUE', box widths will be proportional  to  the
   square-root of the number of observations for the box.
notch=:if  TRUE', notched boxes are drawn, where non-overlap-
   ping of notches of boxes indicates a difference at a rough
   5% significance level.
names.=: optional  character  vector of names for the groups.
   If omitted, names used in labeling the plot will be  taken
   from  the  names  of  the arguments and from the names at-
   tribute of lists.
plot.it=:   if TRUE', the box plot will be  produced;  otherwise,
   the calculated summaries of the arguments are returned.
old=:  if  TRUE',  the plot will be produced in the style de-
   scribed in the Tukey (1977) reference; otherwise, the plot
   will  follow  the  more  modern  style introduced in Tukey
   (1990), where the advantages of  the  new  style  are  de-
   scribed.
horiz=:   if TRUE boxes are drawn horizontally.
from:  (vaseplots) lower bound for the percent of data to use
   in fitting density'.  By default 0.25.
to:(vaseplots) upper bound for the percent of data to use  in
   fitting density'.  By default 0.75.
kernel.width: (vaseplots)  width of the kernel window, as de-
   fined in the function density'.  Its  default  corresponds
   to  the  width  of  a histogram bar as computed by Doane's
   rule.
n: (vaseplot) number of equally spaced density estimates. De-
   fault is 25.
jitter.pts: (pts)  if logical, it specifies whether or not to
   jitter the points inside each group. If numeric it  speci-
   fies  the  amount,  in  data  units, to jitter. Default is
   FALSE.
fill: should boxes or vases be filled? Default is FALSE.
col:   vector of colors for each group.
pch:   vector of plotting character for each group.

   Graphical parameters may also be suppl

Re: [R] constrOptim with method SANN

2008-01-18 Thread Thomas Lumley
On Fri, 18 Jan 2008, Jonas Rumpf wrote:

> Hi Everyone,
>
> I'm trying to minimize a function using constrOptim with
> the simulated annealing method SANN.
>
> If I understand constrOptim well, it basically passes most
> of its arguments to optim while somehow enforcing the constraints.
>
> My problem is, that since SANN does not need gradients,
> when using optim with SANN, the gr argument of optim is
> used to specify a function to create the next candidate point
> for the annealing algorithm. If it is left NULL, a default Gaussian
> Markov kernel is used - which is fine for my purposes.
>

SANN doesn't need gradients, but constrOptim does, and if you have the sort of 
function for which simulated annealing is useful it is unlikely to be the sort 
of function where the adaptive log-barrier method works well.

 -thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

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


Re: [R] Trouble receiving messages from the mailing list

2008-01-18 Thread Adrian Dusa
On Friday 18 January 2008, Ted Harding wrote:
> [...]
>
> This policy would carry a risk that spam mail "From:" a
> subscribed address (probably with a forged "From:", but
> possibly also from a subscriber's compromised computer)
> will reach the list. But I dare say the rest of us can
> live with that. I certainly could.

One possible solution is to digitally sign the message, but there are probably 
few people who know about PGP and its benefits...

Adrian


-- 
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd.
050025 Bucharest sector 5
Romania
Tel./Fax: +40 21 3126618 \
  +40 21 3120210 / int.101


signature.asc
Description: This is a digitally signed message part.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Converting plots to ggplot2

2008-01-18 Thread ONKELINX, Thierry
Dear David,

Try this solution. The data are stored is a dataframe instead of a list
but they should be the same. Once you have this dataframe, thinks get
rather easy. 

library(ggplot2)
a <- seq(0, 360, 5)*pi/180
s <- seq(5, 45, 10)*pi/180
dataset <- expand.grid(a = a, s = s)
dataset$ac <- sin(dataset$a + (45*pi/180)) + 1
dataset$asc <- dataset$s * (cos(dataset$ac) + sin(dataset$ac))

ggplot(data = dataset, aes(x = a, y = ac)) + geom_line() +
geom_line(aes(y = asc, group = s)) + geom_vline(intercept = c(45,
225)*pi/180) + scale_x_continuous("azimuth", breaks = seq(0,6,1),
labels=round(seq(0,6,1)*180/pi)) + scale_y_continuous("index")

when you change # group = s # into # colour = factor(s) # you can
distict the different levels of s in the plot.

ggplot(data = dataset, aes(x = a, y = ac)) + geom_line() +
geom_line(aes(y = asc, colour = factor(s))) + geom_vline(intercept =
c(45, 225)*pi/180) + scale_x_continuous("azimuth", breaks = seq(0,6,1),
labels=round(seq(0,6,1)*180/pi)) + scale_y_continuous("index")

HTH,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
[EMAIL PROTECTED] 
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Namens Thompson, David (MNR)
Verzonden: vrijdag 18 januari 2008 16:44
Aan: hadley wickham
CC: r-help@r-project.org
Onderwerp: Re: [R] Converting plots to ggplot2

Hello Hadley,

Thank you (and Domenico) for your help. I'm almost there.
For convenience, I'll restate the question.
With the following data:
a <- seq(0, 360, 5)*pi/180 ; a
ac <- sin(a + (45*pi/180)) + 1 ; ac
s <- seq(5, 45, 10)*pi/180 ; s
asc <- lapply(s, function(x) x*cos(ac) + x*sin(ac)) ; asc

I can generate my desired plot by traditional methods with:
plot(a, ac, type='l', xaxt = "n", xlab='azimuth', ylab='index')
axis(1, at=seq(0,6,1), labels=round(seq(0,6,1)*180/pi),0)
abline(v=c(45*pi/180, 225*pi/180)) ; par(new=TRUE)
lapply(asc, function(x) {plot(a, x, type='l', xaxt = "n", 
yaxt = "n", xlab='', ylab='', ylim=c(0, 2)) ; par(new=TRUE)})

With ggplot2 and your suggestions I can generate the same with:
p <- qplot(a, ac, geom='line') + geom_line(aes(x=a, y=asc[[1]])) + 
geom_line(aes(x=a, y=asc[[2]])) + geom_line(aes(x=a, y=asc[[3]])) + 
geom_line(aes(x=a, y=asc[[4]])) + geom_line(aes(x=a, y=asc[[5]])) + 
scale_x_continuous(name="azimuth") +
scale_y_continuous(name="index"))

But these attempts to recreate the x-axis labels both generate the
following error:
p + scale_x_continuous(labels=round(seq(0,6,1)*180/pi,0))
p + scale_x_continuous(breaks=seq(0,6,1),
labels=round(seq(0,6,1)*180/pi,0))
Error in get("new", env = ScaleContinuous, inherits =
TRUE)(ScaleContinuous,  : 
  unused argument(s) (labels = c(0, 57, 115, 172, 229, 286, 344))

And these attempts to draw reference lines both generate the following
error:
p + geom_vline(45*pi/180) + geom_vline(225*pi/180)
p + geom_vline(0.79) + geom_vline(3.9)
Error in data.frame(..., check.names = FALSE) : 
  arguments imply differing number of rows: 73, 1

What am I missing?
Thanx, DaveT.
*
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of Natural Resources
[EMAIL PROTECTED]
http://ofri.mnr.gov.on.ca

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

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


[R] histogram with NAs

2008-01-18 Thread darteta001
Dear list,

I have a categorical variable in a data.frame that I would like to 
plot using a histogram to show number of events. Values are 0, 1 and 
some NAs. I can´t make the hist() function to 
1) include a column with the number of NAs
2) have the x axis to be categorical, I always get 0, 0.2, 0.4,... 1 
divisions

Can anyone help me?

This is my code. "database" is my data.frame and "Event" is my 
variable.
attach(database)
hist(Event, col = 2, main = "Number of Events"))

Thanks in advance,

David

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


Re: [R] Assigning into each of a list of dataframes

2008-01-18 Thread Gabor Grothendieck
The problem is that your function is returning x$Y rather than x so
the result is a list of Y's rather than a list of the x's with Y added.
You want function(x) { x$Y <- x$A * x$B; x } or a bit shorter:

   lapply(mylist, transform, Y = A * B)


On Jan 18, 2008 10:37 AM, Chuck Cleland <[EMAIL PROTECTED]> wrote:
>   What is the right way to assign a new variable into each a of list of
> data frames?  Here is my failed attempt:
>
> mylist <- list(df1 = data.frame(A = runif(5), B = runif(5)),
>df2 = data.frame(A = runif(5), B= runif(5)))
>
> lapply(mylist, function(x){x$Y <- x$A * x$B})
>
> $df1
> [1] 0.25589928 0.03446026 0.94992362 0.21388326 0.08668821
>
> $df2
> [1] 0.08771839 0.05643553 0.09036894 0.09179378 0.37394748
>
> mylist
> $df1
>   A  B
> 1 0.3293760 0.77692140
> 2 0.1283307 0.26852710
> 3 0.9865388 0.96288517
> 4 0.5087024 0.42044870
> 5 0.9175345 0.09447951
>
> $df2
>   A B
> 1 0.3887178 0.2256608
> 2 0.2642189 0.2135938
> 3 0.3881635 0.2328115
> 4 0.9060760 0.1013091
> 5 0.4578424 0.8167602
>
>   I want the variable Y to be added to each data frame in mylist.
>
> thanks,
>
> Chuck
>
> --
> Chuck Cleland, Ph.D.
> NDRI, Inc.
> 71 West 23rd Street, 8th floor
> New York, NY 10010
> tel: (212) 845-4495 (Tu, Th)
> tel: (732) 512-0171 (M, W, F)
> fax: (917) 438-0894
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] Converting plots to ggplot2

2008-01-18 Thread Thompson, David (MNR)
Hello Hadley,

Thank you (and Domenico) for your help. I'm almost there.
For convenience, I'll restate the question.
With the following data:
a <- seq(0, 360, 5)*pi/180 ; a
ac <- sin(a + (45*pi/180)) + 1 ; ac
s <- seq(5, 45, 10)*pi/180 ; s
asc <- lapply(s, function(x) x*cos(ac) + x*sin(ac)) ; asc

I can generate my desired plot by traditional methods with:
plot(a, ac, type='l', xaxt = "n", xlab='azimuth', ylab='index')
axis(1, at=seq(0,6,1), labels=round(seq(0,6,1)*180/pi),0)
abline(v=c(45*pi/180, 225*pi/180)) ; par(new=TRUE)
lapply(asc, function(x) {plot(a, x, type='l', xaxt = "n", 
yaxt = "n", xlab='', ylab='', ylim=c(0, 2)) ; par(new=TRUE)})

With ggplot2 and your suggestions I can generate the same with:
p <- qplot(a, ac, geom='line') + geom_line(aes(x=a, y=asc[[1]])) + 
geom_line(aes(x=a, y=asc[[2]])) + geom_line(aes(x=a, y=asc[[3]])) + 
geom_line(aes(x=a, y=asc[[4]])) + geom_line(aes(x=a, y=asc[[5]])) + 
scale_x_continuous(name="azimuth") +
scale_y_continuous(name="index"))

But these attempts to recreate the x-axis labels both generate the
following error:
p + scale_x_continuous(labels=round(seq(0,6,1)*180/pi,0))
p + scale_x_continuous(breaks=seq(0,6,1),
labels=round(seq(0,6,1)*180/pi,0))
Error in get("new", env = ScaleContinuous, inherits =
TRUE)(ScaleContinuous,  : 
  unused argument(s) (labels = c(0, 57, 115, 172, 229, 286, 344))

And these attempts to draw reference lines both generate the following
error:
p + geom_vline(45*pi/180) + geom_vline(225*pi/180)
p + geom_vline(0.79) + geom_vline(3.9)
Error in data.frame(..., check.names = FALSE) : 
  arguments imply differing number of rows: 73, 1

What am I missing?
Thanx, DaveT.
*
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of Natural Resources
[EMAIL PROTECTED]
http://ofri.mnr.gov.on.ca

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


[R] Assigning into each of a list of dataframes

2008-01-18 Thread Chuck Cleland
   What is the right way to assign a new variable into each a of list of 
data frames?  Here is my failed attempt:

mylist <- list(df1 = data.frame(A = runif(5), B = runif(5)),
df2 = data.frame(A = runif(5), B= runif(5)))

lapply(mylist, function(x){x$Y <- x$A * x$B})

$df1
[1] 0.25589928 0.03446026 0.94992362 0.21388326 0.08668821

$df2
[1] 0.08771839 0.05643553 0.09036894 0.09179378 0.37394748

mylist
$df1
   A  B
1 0.3293760 0.77692140
2 0.1283307 0.26852710
3 0.9865388 0.96288517
4 0.5087024 0.42044870
5 0.9175345 0.09447951

$df2
   A B
1 0.3887178 0.2256608
2 0.2642189 0.2135938
3 0.3881635 0.2328115
4 0.9060760 0.1013091
5 0.4578424 0.8167602

   I want the variable Y to be added to each data frame in mylist.

thanks,

Chuck

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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


[R] residuals from pcaiv

2008-01-18 Thread Nikolaos Fyllas
Dear R users,

How can I extract the residuals from a pcaiv/rda in ade4?

In Vegan there is the
residuals()
function, giving the approximation of the original data from the
unconstrained ordination
Is there something similar in ade4?

Nikos

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


Re: [R] Question about making active a previously opened graphic device

2008-01-18 Thread Henrique Dallazuanna
Perhaps:

dev.set(3)

On 18/01/2008, Monica Pisica <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have opened 2 different graphic devices on screen with windows(3) and 
> Windows(4) (I already have had an other graphic on screen opened in device 2).
>
> Now device 3 is inactive and device 4 is active. How i can make device 3 
> active to plot in device 3 and after make device 4 active to have a different 
> plot in it?? For what i am doing it is important to first open the graphic 
> devices - because on each i apply a certain layout . after which i would 
> like to "jump" between devices when plotting graphics.
>
> I looked at help and "bringToTop(which = 3)" just change the focus of the 
> windows but does not make that device active, so everything is still plotted 
> in device 4.
>
> Thanks for any help,
>
> Monica
> _
> [[elided trailing spam]]
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

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


[R] FW: Question about making active a previously opened graphic device - SOLVED

2008-01-18 Thread Monica Pisica

Hi again,
 
It seems that dev.set() will solve my problem. It took me quite a bit of time, 
search and frustration until i stumbled on dev.set ;-)
 
Thanks anyway,
 
Monica


From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: [R] Question about making active a 
previously opened graphic deviceDate: Fri, 18 Jan 2008 15:02:40 +


Hi, I have opened 2 different graphic devices on screen with windows(3) and 
Windows(4) (I already have had an other graphic on screen opened in device 2). 
Now device 3 is inactive and device 4 is active. How i can make device 3 active 
to plot in device 3 and after make device 4 active to have a different plot in 
it?? For what i am doing it is important to first open the graphic devices - 
because on each i apply a certain layout . after which i would like to 
"jump" between devices when plotting graphics. I looked at help and 
"bringToTop(which = 3)" just change the focus of the windows but does not make 
that device active, so everything is still plotted in device 4. Thanks for any 
help, Monica 

Shed those extra pounds with MSN and The Biggest Loser!! Learn more. 
_
[[elided trailing spam]]

[[alternative HTML version deleted]]

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


[R] Res: Leyenda (revisited translation)

2008-01-18 Thread Milton Cezar Ribeiro
(just tranlating...) (i made a little mistake on last on / miltinho).
 
Hi,
 
I am trying to put the legend on the outside of plot region. How can I do that?
My code looks like...

df<-read.table(stdin(),head=T,sep=",")
row,LENGTH,LAT
091639,10.002,42.26282
091640,30.808,42.26834
091641,21.591,42.31689
091642,22.030,41.53246
091643,22.744,42.01954
091644,12.702,42.67751
091645,39.728,42.06479
091647,63.057,41.25283
091648,19.523,41.01925
091649,13.336,42.46904
091650,8.935,42.80971
091651,25.275,42.50678
091652,9.983,42.89345
091653,9.416,41.15288

rownames(df)<-df$row
df<-df[-1]
plot.new()
tplot<-plot(rownames(df), df[,1], type="n", axes=F, xlab="", ylab="" )
lines( rownames(df), df$LENGTH, lwd=1.0, col="blue", lty=1 )
points( rownames(df), df$LAT, lwd=1.0, col="red", pch=19 )
axis(1, rownames(df), labels=rownames(df), tick=T, las=2)
axis( 2, labels=T, tick=T, las=2)
title(ylab="Nivel (m s.n.m.)")
box( lwd=1.0, lty=1)
legend("top", doc$varNames(), ncol=2, pch=c("-", "."), col=c("blue", "red"), 
bty="n")

 
many thanks.



- Mensagem original 
De: Pilar Loren <[EMAIL PROTECTED]>
Para: r-help@r-project.org
Enviadas: Sexta-feira, 18 de Janeiro de 2008 8:50:15
Assunto: [R] Leyenda

Hola estoy intentando colocar la leyenda de un gráfico fuera de la plot
region, es posible hacer esto? Como?

Mi código es el siguiente:
> df
  LENGTH  LAT
091639 10.002 42.26282
091640 30.808 42.26834
091641 21.591 42.31689
091642 22.030 41.53246
091643 22.744 42.01954
091644 12.702 42.67751
091645 39.728 42.06479
091647 63.057 41.25283
091648 19.523 41.01925
091649 13.336 42.46904
091650  8.935 42.80971
091651 25.275 42.50678
091652  9.983 42.89345
091653  9.416 41.15288
> plot.new()
> tplot<-plot(rownames(df), df[,1], type="n", axes=F, xlab="", ylab="" )
> lines( rownames(df), df$LENGTH, lwd=1.0, col="blue", lty=1 )
> points( rownames(df), df$LAT, lwd=1.0, col="red", pch=19 )
> axis(1, rownames(df), labels=rownames(df), tick=T, las=2)
>
> axis( 2, labels=T, tick=T, las=2)
> title(ylab="Nivel (m s.n.m.)")
>
> box( lwd=1.0, lty=1)
>
> legend("top", doc$varNames(), ncol=2, pch=c("-", "."), col=c("blue",
"red"), bty="n")


Muchas gracias

[[alternative HTML version deleted]]




-Anexo incorporado-

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



 para armazenamento!

[[alternative HTML version deleted]]

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


[R] Question about making active a previously opened graphic device

2008-01-18 Thread Monica Pisica

Hi,
 
I have opened 2 different graphic devices on screen with windows(3) and 
Windows(4) (I already have had an other graphic on screen opened in device 2).
 
Now device 3 is inactive and device 4 is active. How i can make device 3 active 
to plot in device 3 and after make device 4 active to have a different plot in 
it?? For what i am doing it is important to first open the graphic devices - 
because on each i apply a certain layout . after which i would like to 
"jump" between devices when plotting graphics.
 
I looked at help and "bringToTop(which = 3)" just change the focus of the 
windows but does not make that device active, so everything is still plotted in 
device 4.
 
Thanks for any help,
 
Monica 
_
[[elided trailing spam]]

[[alternative HTML version deleted]]

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


[R] Res: Leyenda

2008-01-18 Thread Milton Cezar Ribeiro
(just tranlationg...)

Hi,

I am trying to put the legend on the outside of plot region. How can I do that?
My code looks like...

df<-read.table(stdin(),head=T,sep=",")
row,LENGTH,LAT
091639,10.002,42.26282
091640,30.808,42.26834
091641,21.591,42.31689
091642,22.030,41.53246
091643,22.744,42.01954
091644,12.702,42.67751
091645,39.728,42.06479
091647,63.057,41.25283
091648,19.523,41.01925
091649,13.336,42.46904
091650,8.935,42.80971
091651,25.275,42.50678
091652,9.983,42.89345
091653,9.416,41.15288
plot.new()
tplot<-plot(rownames(df), df[,1], type="n", axes=F, xlab="", ylab="" )
lines( rownames(df), df$LENGTH, lwd=1.0, col="blue", lty=1 )
points( rownames(df), df$LAT, lwd=1.0, col="red", pch=19 )
axis(1, rownames(df), labels=rownames(df), tick=T, las=2)
axis( 2, labels=T, tick=T, las=2)
title(ylab="Nivel (m s.n.m.)")
box( lwd=1.0, lty=1)
legend("top", doc$varNames(), ncol=2, pch=c("-", "."), col=c("blue", "red"), 
bty="n")

many thanks.



- Mensagem original 
De: Pilar Loren <[EMAIL PROTECTED]>
Para: r-help@r-project.org
Enviadas: Sexta-feira, 18 de Janeiro de 2008 8:50:15
Assunto: [R] Leyenda

Hola estoy intentando colocar la leyenda de un gráfico fuera de la plot
region, es posible hacer esto? Como?

Mi código es el siguiente:
> df
  LENGTH  LAT
091639 10.002 42.26282
091640 30.808 42.26834
091641 21.591 42.31689
091642 22.030 41.53246
091643 22.744 42.01954
091644 12.702 42.67751
091645 39.728 42.06479
091647 63.057 41.25283
091648 19.523 41.01925
091649 13.336 42.46904
091650  8.935 42.80971
091651 25.275 42.50678
091652  9.983 42.89345
091653  9.416 41.15288
> plot.new()
> tplot<-plot(rownames(df), df[,1], type="n", axes=F, xlab="", ylab="" )
> lines( rownames(df), df$LENGTH, lwd=1.0, col="blue", lty=1 )
> points( rownames(df), df$LAT, lwd=1.0, col="red", pch=19 )
> axis(1, rownames(df), labels=rownames(df), tick=T, las=2)
>
> axis( 2, labels=T, tick=T, las=2)
> title(ylab="Nivel (m s.n.m.)")
>
> box( lwd=1.0, lty=1)
>
> legend("top", doc$varNames(), ncol=2, pch=c("-", "."), col=c("blue",
"red"), bty="n")


Muchas gracias

[[alternative HTML version deleted]]




-Anexo incorporado-

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



 para armazenamento!

[[alternative HTML version deleted]]

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


Re: [R] Regex magic anyone?

2008-01-18 Thread Gabor Grothendieck
strapply in the gsubfn package can split strings based on
content rather than delimiters.

> library(gsubfn)
> strapply(s, ".[(].[)]|.")[[1]]
 [1] "A""B""C""D""E""F""G""T(P)" "H""I"
[11] "J""K"

See home page at:
http://gsubfn.googlecode.com
and vignette:
library(gsubfn); vignette("gsubfn")


On Jan 18, 2008 9:09 AM, Johannes Graumann <[EMAIL PROTECTED]> wrote:
> Hi again,
>
> how to elegantly split
>
> s <- "ABCDEFGT(P)HIJK"
>
> into
>
> "A" "B" "C" "D" "E" "F" "G" "T(P)" "H" "I" "J" "K"
>
> (independently of which letters 'T' or 'P' actually represent ...).
>
> Please jumstart my regexing,
>
> Joh
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] Regex magic anyone?

2008-01-18 Thread Johannes Graumann
Hi again,

how to elegantly split

s <- "ABCDEFGT(P)HIJK"

into

"A" "B" "C" "D" "E" "F" "G" "T(P)" "H" "I" "J" "K"

(independently of which letters 'T' or 'P' actually represent ...).

Please jumstart my regexing,

Joh

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


Re: [R] Select a group of data from a file

2008-01-18 Thread John Kane
Hi
? subset  should do it

xx < subset(x, x$Var2==1)
--- "LA SPINA, MICHELANGELO" <[EMAIL PROTECTED]>
wrote:

> Hello everybody!
> 
> I've a file with several data six variables, three
> quantitative and three qualitative, I would like to
> select a group of data from the file to analyze
> then, i.e:
> my file is like that (but with 6 variables):
> 
> Var1   Var2
> 2   1
> 5   1
> 8   1
> 7   2
> 3   2
> 8   2
> 
> I want to use only the data where var2 is "1"
> 2   1
> 5   1
> 8   1
> 
> Exist a way in R to create a new dataframe with a
> selection of data from other dataframe?
>
___
> 
> 
> Michelangelo La Spina 
> 
> Equipo de Protección de cultivos - Control Biológico
> 
> Departamento de Biotecnología y Protección de
> Cultivos 
> Instituto Murciano de Investigación y Desarrollo
> Agrario y Alimentario (IMIDA) 
> C/ Mayor s/n
> 30150 La Alberca (Murcia) - ESPAÑA 
> 
> teléfono: +34 968 362 788 
> fax: +34 968 366 792 
> móvil: +34 618 451 079 
> 
> web:
>
http://www.imida.es/equipos/eq_prot_cultivos_comp.html
> e-mail: [EMAIL PROTECTED]
> 
> 
>   [[alternative HTML version deleted]]
> 
> > __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>

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


Re: [R] Leyenda

2008-01-18 Thread Ruben Roa Ureta
> Hola estoy intentando colocar la leyenda de un gráfico fuera de la plot
> region, es posible hacer esto? Como?

Pilar,
En la linea de comandos yo escribí:
RSiteSearch(""legend plot region")
y el primer link es
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/43964.html
de Uwe Ligges, y hay varios más respecto del mismo tema.
HTH
Ruben

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


[R] ApnaCircle Invite for Online Social and Professional Networking Site

2008-01-18 Thread ApnaCircle


 [1]ApnaCircle.com
  
Online Social & Professional Networking Site
   

   [2]Make Freinds Earn Rewards 




 [3]ApnaCircle.com 
  gives you a valuable platform to make friends & professional contacts for
  mutual benefit.
 And you get points for joining ApnaCircle & redeem points against rewards.



Join in ,it's Free.




   [4]http://www.apnacircle.com/

   [5]ApnaCircle Privacy Policy [6]Contact us 
   Copyright © 2007-2008 ApnaCircle Infotech Pvt. Ltd., All Rights Reserved

   This email was sent to [EMAIL PROTECTED] [7]Edit your profile
   ::[8]Opt-Out Here:: ::[9]Forward to a friend:: ::[10]Privacy Policy::
   ApnaCircle Infotech Pvt Ltd.
   .
   .
   . - .
   India
   Contact No.
   Powered by [11]myMailGenie.com 
   [count_mailopened.aspx?client_id=2462&[EMAIL PROTECTED]&date
   _sent=1-18-2008&campaign_id=8639&rep_id=16174]

References

   1. 
http://myMailGenie.com/v3/customclick.aspx?pg=www.apnacircle.com&rep_id=16174&[EMAIL
 PROTECTED]&clientid=2462&campaignid=8639
   2. 
http://myMailGenie.com/v3/customclick.aspx?pg=www.apnacircle.com&rep_id=16174&[EMAIL
 PROTECTED]&clientid=2462&campaignid=8639
   3. 
http://myMailGenie.com/v3/customclick.aspx?pg=www.apnacircle.com&rep_id=16174&[EMAIL
 PROTECTED]&clientid=2462&campaignid=8639
   4. 
http://myMailGenie.com/v3/customclick.aspx?pg=www.apnacircle.com&rep_id=16174&[EMAIL
 PROTECTED]&clientid=2462&campaignid=8639
   5. 
http://myMailGenie.com/v3/customclick.aspx?pg=www.apnacircle.com&rep_id=16174&[EMAIL
 PROTECTED]&clientid=2462&campaignid=8639
   6. 
http://myMailGenie.com/v3/customclick.aspx?pg=www.apnacircle.com&rep_id=16174&[EMAIL
 PROTECTED]&clientid=2462&campaignid=8639
   7. http://myMailGenie.com/v3/editprofile.aspx?cclientid=2462&[EMAIL 
PROTECTED]
   8. http://myMailGenie.com/v3/[EMAIL PROTECTED]&client_id=2462&rep_id=16174
   9. http://myMailGenie.com/v3/[EMAIL PROTECTED]&client_id=2462&[EMAIL 
PROTECTED]&campaign_id=8639&datesent=1/18/2008&rep_id=16174&affiliatename=myMailGenie.com
  10. file://localhost/tmp/tmpkwC75z.html
  11. http://myMailGenie.com/
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Any tools for working with US 2000 census data? (Zembower, Kevin)

2008-01-18 Thread A Friedman
Hi Kevin,

  Not an R-specific solution, but by far the easiest way to extract data
from the 2000 census is to use American FactFinder.

Go to the main page:
http://factfinder.census.gov/home/saff/main.html?_lang=en
Hover over Data Sets, click Decennial Census.
Select the file you want (SF-2 for you), then click Detailed Tables.
Click on the Geo Within Geo tab.  This will let you select all the units
within another unit, which seems like what you want, plus the variables
desired.

Ciao,
Ari

[[alternative HTML version deleted]]

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


[R] image/area plot

2008-01-18 Thread Marta Rufino
Dear R users,

I am trying to produce an image plot, that represents the proportions of 
a factor (z variable), so that the number of squares of each colour 
represents each factor level, with the respective label inside (sorry 
for the crap English).

# Something like this:

kk=data.frame(fact=letters[1:10], freq=c(5,1,10,2,10,7,5,10,30,20)) # 
factor and respective frequecies
res="a" # transform into a matrix (is there an easier way to do this?... 
for the image plot
for(ii in 1:dim(kk)[1]){
res=c(res, rep(as.character(kk[ii,1]), l=kk[ii, 2]))
}
res=res[-1]
res
res=matrix(c(factor(res)), nc=10)

image(x=1:10,y=1:10, res[,order(colSums(res))], col=rainbow(20))
abline(h=seq(0.5,10.5,1), col=8, lty=3); abline(v=seq(0.5,10.5,1), 
col=8, lty=3)#add some gridlines

#Problems:
#1. How to add the labels in each area
text(1,1,paste("Factor level",kk[1,1]), pos=4)

#2. How to separate the areas of each factor level (for BW printing), 
with lines (instead of colours as it is)
segments(.5,1.5,5.5,1.5, lwd=2);segments(5.5,.5,5.5,1.5, lwd=2) # 
something like this, but automatically :-(
 
#3. How to keep the areas together (contiguous) and not allow split over 
to lines?

#4. Could I replace the col. by a symbol, for example? I think I would 
need to use plot instead of image.
Any help will be much apretiated,

Thank you very much in advance,
Best wishes,
Marta
PS: This type of graphs are used in community ecology analysis, for 
example-...

-- 
...
Marta M. Rufino (PhD)

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


[R] Leyenda

2008-01-18 Thread Pilar Loren
Hola estoy intentando colocar la leyenda de un gráfico fuera de la plot
region, es posible hacer esto? Como?

Mi código es el siguiente:
> df
   LENGTH  LAT
091639 10.002 42.26282
091640 30.808 42.26834
091641 21.591 42.31689
091642 22.030 41.53246
091643 22.744 42.01954
091644 12.702 42.67751
091645 39.728 42.06479
091647 63.057 41.25283
091648 19.523 41.01925
091649 13.336 42.46904
091650  8.935 42.80971
091651 25.275 42.50678
091652  9.983 42.89345
091653  9.416 41.15288
> plot.new()
> tplot<-plot(rownames(df), df[,1], type="n", axes=F, xlab="", ylab="" )
> lines( rownames(df), df$LENGTH, lwd=1.0, col="blue", lty=1 )
> points( rownames(df), df$LAT, lwd=1.0, col="red", pch=19 )
> axis(1, rownames(df), labels=rownames(df), tick=T, las=2)
>
> axis( 2, labels=T, tick=T, las=2)
> title(ylab="Nivel (m s.n.m.)")
>
> box( lwd=1.0, lty=1)
>
> legend("top", doc$varNames(), ncol=2, pch=c("-", "."), col=c("blue",
"red"), bty="n")


Muchas gracias

[[alternative HTML version deleted]]

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


Re: [R] Problems with lattice plot

2008-01-18 Thread ONKELINX, Thierry
Dear Francesc,

This is rather easy to do with the ggplot2 package.

library(ggplot2)
dataset <- expand.grid(x = 1:10, y = 1:50)
dataset$z <- runif(nrow(dataset))
ggplot(data = dataset, aes(x = x, y = y, fill = z)) + geom_tile() + 
scale_fill_gradient(low="white", high="black") + coord_equal()

Have a look at the ggplot2 website (http://had.co.nz/ggplot2/) for more 
examples.

HTH,

Thierry 



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology 
and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
[EMAIL PROTECTED] 
www.inbo.be 

Do not put your faith in what statistics say until you have carefully 
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of 
uncertainties, a surgery of suppositions. ~M.J.Moroney

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Francesc Montané
Verzonden: vrijdag 18 januari 2008 12:01
Aan: r-help@r-project.org
Onderwerp: [R] Problems with lattice plot

Hello useRs,



I have some problems when I try to plot a lattice. The lattice has 200 
columns (X value) and 5 rows (Y value), with a total of 1000 squares. I 
want to plot this lattice with the squares having different colours 
according to a variable value.



The variable I want to plot is cover value of a shrub, and it has values 
between 0 and 1. I want to plot the squares with value 1, black, the 
squares with values 0, white, and the values between 0 and 1 with grey, 
more or less dark depending on its proximity to 1 (dark grey) or 0 
(light grey). I have tried this:



plot(x=transect41$x,y=transect41$y,asp=1,

xlab="",ylab="",

axes=F,pch=22,cex=1.01,lwd=0.05,

bg=gray(1-transect41$CoverValue),col=gray(0.75))

plot(pch=22,cex=1.01,lwd=0.05)



When I plot the lattice, I have problems because the squares have 
different sizes. Moreover, some of them look like a rectangle and not a 
square.

What can I do to solve this problem?



Many thanks in advance.



Francesc

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

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


Re: [R] Problems with lattice plot

2008-01-18 Thread Richard . Cotton
> I have some problems when I try to plot a lattice. The lattice has 200 
> columns (X value) and 5 rows (Y value), with a total of 1000 squares. I 
> want to plot this lattice with the squares having different colours 
> according to a variable value.
> 
> 
> 
> The variable I want to plot is cover value of a shrub, and it has values 

> between 0 and 1. I want to plot the squares with value 1, black, the 
> squares with values 0, white, and the values between 0 and 1 with grey, 
> more or less dark depending on its proximity to 1 (dark grey) or 0 
> (light grey). I have tried this:
> 
> 
> 
> plot(x=transect41$x,y=transect41$y,asp=1,
> 
> xlab="",ylab="",
> 
> axes=F,pch=22,cex=1.01,lwd=0.05,
> 
> bg=gray(1-transect41$CoverValue),col=gray(0.75))
> 
> plot(pch=22,cex=1.01,lwd=0.05)
> 
> 
> 
> When I plot the lattice, I have problems because the squares have 
> different sizes. Moreover, some of them look like a rectangle and not a 
> square.
> 
> What can I do to solve this problem?

Be really careful with your terminology - to most R users, 'lattice plots' 
refer to plots created using the lattice package.  The function you want 
is image, or its equivalent in the lattice package, levelplot.

Regards,
Richie.

Mathematical Sciences Unit
HSL




ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

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


[R] Problems with lattice plot

2008-01-18 Thread Francesc Montané
Hello useRs,

 

I have some problems when I try to plot a lattice. The lattice has 200 
columns (X value) and 5 rows (Y value), with a total of 1000 squares. I 
want to plot this lattice with the squares having different colours 
according to a variable value.

 

The variable I want to plot is cover value of a shrub, and it has values 
between 0 and 1. I want to plot the squares with value 1, black, the 
squares with values 0, white, and the values between 0 and 1 with grey, 
more or less dark depending on its proximity to 1 (dark grey) or 0 
(light grey). I have tried this:

 

plot(x=transect41$x,y=transect41$y,asp=1,

xlab="",ylab="",

axes=F,pch=22,cex=1.01,lwd=0.05,

bg=gray(1-transect41$CoverValue),col=gray(0.75))

plot(pch=22,cex=1.01,lwd=0.05)

 

When I plot the lattice, I have problems because the squares have 
different sizes. Moreover, some of them look like a rectangle and not a 
square.

What can I do to solve this problem?

 

Many thanks in advance.

 

Francesc

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


Re: [R] Trouble receiving messages from the mailing list

2008-01-18 Thread Ted Harding
On 18-Jan-08 08:32:02, Martin Maechler wrote:
>> "GC" == Gang Chen <[EMAIL PROTECTED]>
>> on Thu, 17 Jan 2008 12:08:40 -0500 writes:
> 
> GC> For some unknown reason I stopped receiving any messages
> GC> from the R- help mailing list.  See if this test gets
> GC> through.
> 
> It does; but you don't see it -- nor my answer -- so maybe
> someone can forward this (post)  to Gang Chen.
> 
> As I found, since about  Jan 14, 13:20 (UTC+01)  your site is
> not accepting any mails from our server any more.
> Probably you are black listing us, because of the recently
> slightly increased spam rate on r-help.

"Slightly" indeed! About 6 spam messages got through to the
list over 9-14 January, and I can't remember when I last
saw one prior to that.

If that triggered a black-listing, then I can only say that
Gang Chen's site is being very sensitive! (And, by the way,
he is being Cc:-ed on this message, so should see your reply.)

> I have to tell you (or rather the R-help audience) that I've
> spent too much time (again!) during this week trying to fight
> spam.

The R-help list is remarkably clean, considering the amount
of spam that probably gets thrown at it behind the scenes.
If that is due to your bare-hands interventions, Martin,
then it is a great tribute to your vigilance and efforts.

> Maybe the time of "free" (unauthorized) posting to mailing
> lists is approaching its end...

I doubt you would want to get into the situation of having
to approve every mail to the list, Martin -- traffic is too
heavy! (Unlike the BUGS list, which requires moderator
approval for every posting even from subscribers, but has
only a few messages per week.)

But there is a lot to be said for "posting by subscribers
only", such messages going straight through. Then the
moderator gets notifications of non-subscriber messages,
and it is a relatively easier task to simply watch out
for "Subject:" lines which indicate legitimate postings,
and moderate those few as they arise, leaving the remainder
for a periodic mass clean-out. (And perhaps it would also
help if the auto-message sent to unsubscribed mailers that
their message has been held for moderation also included
a strong recommendation that they should subscribe to the
list.)

This policy would carry a risk that spam mail "From:" a
subscribed address (probably with a forged "From:", but
possibly also from a subscriber's compromised computer)
will reach the list. But I dare say the rest of us can
live with that. I certainly could.

Best wishes, and thanks for your care of our list.
Ted.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 18-Jan-08   Time: 10:44:26
-- XFMail --

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


[R] constrOptim with method SANN

2008-01-18 Thread Jonas Rumpf
Hi Everyone,

I'm trying to minimize a function using constrOptim with
the simulated annealing method SANN.

If I understand constrOptim well, it basically passes most
of its arguments to optim while somehow enforcing the constraints.

My problem is, that since SANN does not need gradients,
when using optim with SANN, the gr argument of optim is
used to specify a function to create the next candidate point
for the annealing algorithm. If it is left NULL, a default Gaussian
Markov kernel is used - which is fine for my purposes.

But for some reason, when using constrOptim,
a non-NULL grad argument is needed when using the SANN
method. Is there a possible way to circumvent this, possibly
by telling constrOptim to use optim's default or do I have to
specify the function by hand? If so, how do I do that?
Unfortunately, I was not able to find an example or definition
how to appropriately specify the function for the creation of the
next candidate point, nor how to tell constrOptim to simply use
the default of optim.

Any help in this matter will be greatly appreciated, and I apologize,
if this has recently been discussed or I missed something in the manuals.

Best regards,
Jonas Rumpf

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


[R] constrOptim with SANN

2008-01-18 Thread Jonas Rumpf
Hi Everyone,

I'm trying to minimize a function using constrOptim with
the simulated annealing method SANN.

If I understand constrOptim well, it basically passes most
of its arguments to optim while somehow enforcing the constraints.

My problem is, that since SANN does not need gradients,
when using optim with SANN, the gr argument of optim is
used to specify a function to create the next candidate point
for the annealing algorithm. If it is left NULL, a default Gaussian
Markov kernel is used - which is fine for my purposes.

But for some reason, when using constrOptim,
a non-NULL grad argument is needed when using the SANN
method. Is there a possible way to circumvent this, possibly
by telling constrOptim to use optim's default or do I have to
specify the function by hand? If so, how do I do that?
Unfortunately, I was not able to find an example or definition
how to appropriately specify the function for the creation of the
next candidate point, nor how to tell constrOptim to simply use
the default of optim.

Any help in this matter will be greatly appreciated, and I apologize,
if this has recently been discussed or I missed something in the manuals.

Best regards,
Jonas Rumpf

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


Re: [R] Select a group of data from a file

2008-01-18 Thread Richard . Cotton
> I've a file with several data six variables, three quantitative and 
> three qualitative, I would like to select a group of data from the 
> file to analyze then, i.e:
> my file is like that (but with 6 variables):
> 
> Var1   Var2
> 2   1
> 5   1
> 8   1
> 7   2
> 3   2
> 8   2
> 
> I want to use only the data where var2 is "1"
> 2   1
> 5   1
> 8   1
> 
> Exist a way in R to create a new dataframe with a selection of data 
> from other dataframe?

#Your data frame
df1 <- data.frame(Var1 = c(2,5,8,7,3,8), Var2=rep(1:2, each=3))

#The desired frame
df2 <- df1[df1$Var2==1,]

#clearer syntax using the subset function
df3 <- subset(df1, Var2==1)

identical(df2, df3) #TRUE

Please read section 2.7 of the 'Introduction to R' manual
http://cran.r-project.org/doc/manuals/R-intro.pdf

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

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


Re: [R] Select a group of data from a file

2008-01-18 Thread Jeremy Baxter
Try subset.

help(subset)

Subset returns a subsets of vectors, matrices or data frames which meet  
conditions. There are some excellent examples in the help. Here is an example 
similar to your email.

Create some data:

Var1<-sample(1:10,20,replace=TRUE)
Var2<-sample(1:10,20,replace=TRUE)

the.old.data<-cbind(Var1,Var2)

head(the.old.data)
 Var1 Var2
[1,]8   10
[2,]1   10


the.new.data <- subset(the.old.data, Var2==1)
the.new.data

HTH,
Jeremy

On Friday 18 January 2008 10:33:51 LA SPINA, MICHELANGELO wrote:
> I've a file with several data six variables, three quantitative and three
> qualitative, I would like to select a group of data from the file to
> analyze then, i.e: my file is like that (but with 6 variables):
>
> Var1   Var2
> 2   1
> 5   1
> 8   1
> 7   2
> 3   2
> 8   2
>
> I want to use only the data where var2 is "1"

-- 
Jeremy Baxter, Statistics Department, Rhodes University, South Africa.
Views expressed above, no matter how badly spelt, are my own... I think?

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


Re: [R] Trouble receiving messages from the mailing list

2008-01-18 Thread Martin Maechler
> "GC" == Gang Chen <[EMAIL PROTECTED]>
> on Thu, 17 Jan 2008 12:08:40 -0500 writes:

GC> For some unknown reason I stopped receiving any messages
GC> from the R- help mailing list.  See if this test gets
GC> through.

It does; but you don't see it -- nor my answer -- so maybe
someone can forward this (post)  to Gang Chen.

As I found, since about  Jan 14, 13:20 (UTC+01)  your site is
not accepting any mails from our server any more.
Probably you are black listing us, because of the recently
slightly increased spam rate on r-help.

I have to tell you (or rather the R-help audience) that I've
spent too much time (again!) during this week trying to fight
spam.

Maybe the time of "free" (unauthorized) posting to mailing lists
is approaching its end...

Martin Maechler, ETH Zurich

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


[R] Select a group of data from a file

2008-01-18 Thread LA SPINA, MICHELANGELO
Hello everybody!

I've a file with several data six variables, three quantitative and three 
qualitative, I would like to select a group of data from the file to analyze 
then, i.e:
my file is like that (but with 6 variables):

Var1   Var2
2   1
5   1
8   1
7   2
3   2
8   2

I want to use only the data where var2 is "1"
2   1
5   1
8   1

Exist a way in R to create a new dataframe with a selection of data from other 
dataframe?
___
 

Michelangelo La Spina 

Equipo de Protección de cultivos - Control Biológico 
Departamento de Biotecnología y Protección de Cultivos 
Instituto Murciano de Investigación y Desarrollo Agrario y Alimentario (IMIDA) 
C/ Mayor s/n
30150 La Alberca (Murcia) - ESPAÑA 

teléfono: +34 968 362 788 
fax: +34 968 366 792 
móvil: +34 618 451 079 

web: http://www.imida.es/equipos/eq_prot_cultivos_comp.html
e-mail: [EMAIL PROTECTED]


[[alternative HTML version deleted]]

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


Re: [R] Trouble receiving messages from the mailing list

2008-01-18 Thread Martin Maechler
> "GC" == Gang Chen <[EMAIL PROTECTED]>
> on Thu, 17 Jan 2008 12:08:40 -0500 writes:

GC> For some unknown reason I stopped receiving any messages
GC> from the R- help mailing list.  See if this test gets
GC> through.

It does; but you don't see it -- nor my answer -- so maybe
someone can forward this (post)  to Gang Chen.

As I found, since about  Jan 14, 13:20 (UTC+01)  your site is
not accepting any mails from our server any more.
Probably you are black listing us, because of the recently
slightly increased spam rate on r-help.

I have to tell you (or rather the R-help audience) that I've
spent too much time (again!) during this week trying to fight
spam.

Maybe the time of "free" (unauthorized) posting to mailing lists
is approaching its end...

Martin Maechler, ETH Zurich

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


Re: [R] "non-plot" plotting

2008-01-18 Thread Johannes Graumann
Marc, you are kind of crazy ... I asked for a discussion of the path to take
to get there, not to have it done ... but hey, what am I complaining
about? ;0)

Thank you very much!

Joh

Marc Schwartz wrote:

> Johannes Graumann wrote:
>> I really do not know ho to else title this ... I want to draw something
>> like the attached png with R and would like to poll you on how to start
>> ... make an empty plot first and then start positioning the
>> characterstring by 'text' and then drawing the lines ...
>>
>> Joh
> 
> Johannes,
> 
> Try this (PDF of the output attached):
> 
> # Open the initial plot window and set
> # up a coordinate system based upon
> # placement of the letters centered
> # on integer 'x' values 1:12
> plot(1, xlim = c(0, 13), ylim = c(0, 4),
>   type = "n",
>   ann = FALSE, axes = FALSE)
> 
> # Create the vector of letters
> Vec <- c("T", "V", "F", "S", "Q", "A", "Q",
>   "L", "C", "A", "L", "K")
> 
> # Plot them
> text(1:12, 2, Vec, cex = 2, font = 2)
> 
> # Get the height of the letters for spacing
> # See ?strheight
> height <- strheight("T", cex = 2) * .8
> 
> # Set a default width for the "boxes"
> # around the letter
> width <- 0.5
> 
> # Set the values for 'Y's
> Y <- 10:2
> X <- 3:11
> 
> # Loop over the Y's and using plotmath
> # plot the values and subscripts in bold
> # See ?plotmath and ?bquote
> # While looping, do the colored segments
> for (i in 1:9) {
>text(X[i], 2 + (height * 1.6), bquote(bold(Y[.(Y[i])])),
> col = "red", font = 2)
> 
>x <- c(X[i] - width, X[i] - width, X[i] + 0.3)
>y <- c(2, 2 + height, 2 + height)
> 
>lines(x, y, col = "red", lwd = 2)
> }
> 
> 
> 
> 
> # Same here now for the 'b's
> 
> b <- c(2:6, 8, 9, 11)
> X <- b
> 
> for (i in 1:8) {
>text(X[i], 2 - (height * 1.6), bquote(bold(b[.(b[i])])),
> col = "blue", font = 2)
> 
>x <- c(X[i] - 0.3, X[i] + width, X[i] + width)
>y <- c(2 - height, 2 - height, 2)
> 
>lines(x, y, col = "blue", lwd = 2)
> }
> 
> 
> 
> The above should provide the basic approach. You can then adjust/fine
> tune spacing, etc. as you require.
> 
> HTH,
> 
> Marc Schwartz

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