Re: [R] The Origins of R AND CALCULUS

2009-02-05 Thread Wacek Kusnierczyk
Ajay ohri wrote:
 An amusing afterthought : What is a rival software (ahem!) was planting
 this, hoping for a divide between S and R communities.or at the very minimum
 hoping for some amusement. an assumption or even a pretense of stealing
 credit is one of the easiest ways of sparking intellectual discord
 Most users of softwares don't really care about who gets credit ( Who wrote
 Windows Vista ,or Mac OS or Ubuntu Linux), and the NYT is a newspaper not a
 journal.

 Does any student, or teacher for that matter care whether Newton or Leibntiz
 invented calculas.

   

supposed to be funny?  type citation() in r, you'll read:

We have invested a lot of time and effort in creating R, please cite it
when using it for data analysis. See also ‘citation(pkgname)’ for
citing R packages.

why care whether newton or leibnitz invented calculus?  why care who has
invested a lot of time and effort in this or that?

vQ

__
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] R memory usage and size limits

2009-02-05 Thread Tom Quarendon
I have a general question about R's usage or memory and what limits 
exist on the size of datasets it can deal with.
My understanding was that all object in a session are held in memory. 
This implies that you're limited in the size of datasets that you can 
process by the amount of memory you've got access to (be it physical or 
paging). Is this true? Or does R store objects on disk and page them in 
as parts are needed in the way that SAS does?
Are there 64 bit versions of R that can therefore deal with much larger 
objects?


Many thanks.

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


Re: [R] Problem installing ad administrating packages

2009-02-05 Thread Birgitle

It is also not possible if I use this commands

install.packages(analogue,/Library/Frameworks/R.framework/Versions/2.8/Resources/library,repos=http://R-Forge.R-project.org;)
Fehler in .readRDS(pfile) : unbekanntes Eingabeformat

Error in .readRDS(pfile) : unknown enter format

also

library(ape,lib.loc=/Library/Frameworks/R.framework/Versions/2.8/Resources/library)

Error in .readRDS(pfile) : unknown enter format
Error in if (!noCache  file.exists(dest)  file.info(dest)$mtime   : 
  missing value, where TRUE/FALSE is necessary

Error in .readRDS(pfile) : unbekanntes Eingabeformat
Fehler in if (!noCache  file.exists(dest)  file.info(dest)$mtime   : 
  Fehlender Wert, wo TRUE/FALSE nötig ist

Please could somebody give me an advice. I can not do anything because I
need some packages.

Thanks

Birgit




Birgitle wrote:
 
 Hello R-User!
 
 I am running R 2.8.1 on an Intel Mac.
 I just tried to install a package using the GUI and got the following
 error message:
 Fehler in if (14 + nchar(dcall, type = w) + nchar(sm[1], type = w)  
 : 
   Fehlender Wert, wo TRUE/FALSE nötig ist
 
 Error in (14 + nchar(dcall, type = w) + nchar(sm[1], type = w)   :
   missing value, where TRUE/FALSE is necessary
 
 also if I try to look at my installed packages using GUI
 
 Fehler in .readRDS(pfile) : unbekanntes Eingabeformat
 
 Error in .readRDS(pfile) : unknown enter format.
 
 Some days ago I used a different working directory and now came back to my
 usual one. Don`t know if this causes the error.
 
 I would be very grateful if somebody could help me.
 
 Many thanks in advance
 
 B.
 
 
 


-
The art of living is more like wrestling than dancing.
(Marcus Aurelius)
-- 
View this message in context: 
http://www.nabble.com/Problem-installing-ad-administrating-packages-tp21834632p21847159.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] The Origins of R AND CALCULUS

2009-02-05 Thread Thomas Lumley


Wacek,

If you have bug reports for a contributed package please take them up with the 
maintainer, not the list.

  -thomas


On Thu, 5 Feb 2009, Wacek Kusnierczyk wrote:


Ajay ohri wrote:
An amusing afterthought : What is a rival software (ahem!) was planting
this, hoping for a divide between S and R communities.or at the very minimum
hoping for some amusement. an assumption or even a pretense of stealing
credit is one of the easiest ways of sparking intellectual discord
Most users of softwares don't really care about who gets credit ( Who wrote
Windows Vista ,or Mac OS or Ubuntu Linux), and the NYT is a newspaper not a
journal.

Does any student, or teacher for that matter care whether Newton or Leibntiz
invented calculas.




supposed to be funny?  type citation() in r, you'll read:

We have invested a lot of time and effort in creating R, please cite it
when using it for data analysis. See also ‘citation(pkgname)’ for
citing R packages.

why care whether newton or leibnitz invented calculus?  why care who has
invested a lot of time and effort in this or that?

vQ

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

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity 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] Sweave and \Sexpr{}

2009-02-05 Thread Dieter Menne
Felipe Carrillo mazatlanmexico at yahoo.com writes:

 I am trying to create a dynamic latex table using \Sexpr{} but it's 
 not evaluating it. I also tried the
 example below without Sweave and also fails. I have also copied the 
 Sweave.sty to my working directory but
 nothing seems to work. Do I need to have certain package in order to 
 run \Sexpr{}?

 \documentclass[a4paper]{article}
 \usepackage{C:/R/R-2.8.1/share/texmf/Sweave}
 \begin{document}
 
... rest removed

Your example works well in my setting when I replace the usepackage by

\usepackage{Sweave}

which is on my file name database path of latex. Make sure you run update file
name database.

Maybe better start with a tiny example, such as

\documentclass[a4paper]{article}
\usepackage{Sweave}
\begin{document}
\Sexpr{Hello}
\end{document}

to locate the problem more precisely.

Dieter

__
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] Sweave and \Sexpr{}

2009-02-05 Thread Eric R.

Felipe:

See Leisch's FAQ A18.  

http://www.statistik.lmu.de/~leisch/Sweave/FAQ.html#x1-2A.18

You likely have R2HTML loaded (likely because you are using Tinn-R) and that
causes some difficulties for Sweave that are easily solved as described in
the FAQ.



Felipe Carrillo wrote:
 
 Hi: 
 I am trying to create a dynamic latex table using \Sexpr{} but it's not
 evaluating it. I also tried the example below without Sweave and also
 fails. I have also copied the Sweave.sty to my working directory but
 nothing seems to work. Do I need to have certain package in order to run
 \Sexpr{}?
 
 \documentclass[a4paper]{article}
 \usepackage{C:/R/R-2.8.1/share/texmf/Sweave}
 \begin{document}
 
 echo=false,results=hide=
 library(lattice)
 library(xtable)
 data(cats, package=MASS)
 @ 
 
 \section*{The Cats Data}
 
 Consider the \texttt{cats} regression example from Venables \ Ripley
 (1997). The data frame contains measurements of heart and body weight
 of \SExpr{nrow(cats)} cats (\Sexpr{sum(cats$Sex==F)} female,
 \Sexpr{sum(cats$Sex==M)} male).
 
 A linear regression model of heart weight by sex and gender can be
 fitted in R using the command
 =
 lm1 = lm(Hwt~Bwt*Sex, data=cats)
 lm1
 @ 
 Tests for significance of the coefficients are shown in
 Table~\ref{tab:coef}, a scatter plot including the regression lines is
 shown in Figure~\ref{fig:cats}.
 
 \SweaveOpts{echo=false}
 
 results=tex=
 xtable(lm1, caption=Linear regression model for cats data.,
 label=tab:coef)
 @ 
 
 \begin{figure}
   \centering
 fig=TRUE,width=12,height=6=
 
 print(xyplot(Hwt~Bwt|Sex, data=cats, type=c(p, r)))
 @  
   \caption{The cats data from package MASS.}
   \label{fig:cats}
 \end{figure}
 \begin{center}
 \end{center}
 
 \end{document}
 
 
 Felipe D. Carrillo  
 Supervisory Fishery Biologist  
 Department of the Interior  
 US Fish  Wildlife Service  
 California, USA
 
 __
 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/Sweave-and-%5CSexpr%7B%7D-tp21841963p21847606.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] eliminating control characters from formatted data files

2009-02-05 Thread David Epstein

I have a few hundred files of formatted data. Unfortunately most of them end
with a spurious CONTROL-Z. I want to rewrite the files without the spurious
character. Here's what I've come up with so far, but my code is unsafe
because it assumes without justification that the last row of df contains a
control character (and some NAs to fill up the record).

options(warn=-1) #turn off irritating warning from read.table()
df-read.table(file=filename)
df.new-df[1:nrow(df)-1,]
write.table(df.new,file=filename.new, quote=F)

Before defining df.new, I want to check that the last line really does
contain a control character. I've tried various methods, but none of them
work.

I have been wondering if I should use a function (scan?) that reads in the
file line by line and checks each line for control characters, but I don't
know how to do this either.

Thanks for any help
David
-- 
View this message in context: 
http://www.nabble.com/eliminating-control-characters-from-formatted-data-files-tp21847583p21847583.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] R memory usage and size limits

2009-02-05 Thread Prof Brian Ripley
Please read ?Memory-limits and the R-admin manual for basic 
information.


On Thu, 5 Feb 2009, Tom Quarendon wrote:

I have a general question about R's usage or memory and what limits exist on 
the size of datasets it can deal with.
My understanding was that all object in a session are held in memory. This 
implies that you're limited in the size of datasets that you can process by 
the amount of memory you've got access to (be it physical or paging). Is this 
true? Or does R store objects on disk and page them in as parts are needed in 
the way that SAS does?


That's rather a false dichotomy: paging uses the disk, so the 
distinction is if R implemented its own virtual memory system or uses 
the OS's one (the latter).


There are also interfaces to DBMSs for use with large datasets: see 
the R-data manual and also look at the package list in the FAQ.


Are there 64 bit versions of R that can therefore deal with much larger 
objects?


Yes, there have been 64-bit versions of R for many years, and they are 
in routine use on very large problems.




Many thanks.

__
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,  rip...@stats.ox.ac.uk
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] The Origins of R AND CALCULUS

2009-02-05 Thread Mark Difford

 If you have bug reports for a contributed package please take them up with
the maintainer, 
 not the list.

Of course, Wacek is right. His observations being made with a customary
needle-like precision. It's that old conundrum about how to have your cake
and still eat it.

Regards to all, Mark.


Thomas Lumley wrote:
 
 
 Wacek,
 
 If you have bug reports for a contributed package please take them up with
 the maintainer, not the list.
 
-thomas
 
 
 On Thu, 5 Feb 2009, Wacek Kusnierczyk wrote:
 
 Ajay ohri wrote:
 An amusing afterthought : What is a rival software (ahem!) was planting
 this, hoping for a divide between S and R communities.or at the very
 minimum
 hoping for some amusement. an assumption or even a pretense of stealing
 credit is one of the easiest ways of sparking intellectual discord
 Most users of softwares don't really care about who gets credit ( Who
 wrote
 Windows Vista ,or Mac OS or Ubuntu Linux), and the NYT is a newspaper not
 a
 journal.

 Does any student, or teacher for that matter care whether Newton or
 Leibntiz
 invented calculas.


 
 supposed to be funny?  type citation() in r, you'll read:
 
 We have invested a lot of time and effort in creating R, please cite it
 when using it for data analysis. See also ‘citation(pkgname)’ for
 citing R packages.
 
 why care whether newton or leibnitz invented calculus?  why care who has
 invested a lot of time and effort in this or that?
 
 vQ
 
 __
 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.
 
 Thomas Lumley Assoc. Professor, Biostatistics
 tlum...@u.washington.edu  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.
 
 

-- 
View this message in context: 
http://www.nabble.com/The-Origins-of-R-AND-CALCULUS-tp21846099p21847724.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] non linear regression with nls

2009-02-05 Thread lauramorg...@bluewin.ch
Thank you a lot Mr. Ritz!
I've tried the loop you suggested and I added a list for lower and upper limits 
of the parameters, but there is still 
a problem... 

I have a list of functions, which works...
fz1-function(Portata, a, b){a+(b/Portata)} 
fz2-function(Portata, a, b){a*exp(b*Portata)}
fz3-function(Portata, a, b, d, e){a+(b/Portata)+d*(Portata^e)}
fz4-function(Portata, a, b){a*Portata^b}
fz5-function(Portata, a, b, d){a+b*(Portata^d)}
fctList - list(fz1, fz2, fz3, fz4, fz5)

as well as lists for starting values, upper and lower values, which work as 
well:
startList - list(list(a=10, b=10), list(a=10, b=1), list(a=10, b=10, d=10, 
e=1), list(a=10, b=1), list(a=10, b=10, 
d=1))
lowerList-list(list(a=0,b=0),list(a=0,b=0), list(a=0,b=0,d=0,e=-50),list(a=0, 
b=-50), list(a=0, b=0, d=-50))
upperList-list(list(a=1000, b=1000), list(a=1000, b=1000), 
list(a=1000,b=1000,d=1000,e=50), list(a=1000,b=50), list
(a=1000, b=1000, d=50))

but if I try to run this for loop


resultList - list()
for (i in 1:5)
{
resultList[[i]] - nls(NT.N ~ fctList[[i]](Portata, a,b), data=subset(dati, 
Fiume==Laveggio), start=startList[[i]], 
nls.control(maxiter=200), algorithm='port', trace=TRUE, na.action=na.omit, 
upper=upperList[[i]], lower=lowerList[[i]])
}
 I get the following error message:
Error in fctList[[i]](Portata, a, b) : element 1 is empty;
   the part of the args list of '*' being evaluated was:
   (d, (Portata^e))

I realized that the problem is the element after the function, i.e. (Portata, 
a, b), since fct 3 and 5 have more 
parameters (Portata,a,b,d,e).
So I tried to make a list (parList) for this too, i tried 2 versions:
#version1
list(Portata,a, b)-pf1.2.4
list(Portata,a,b,d,e)-pf3
list(Portata,a,b,d)-pf5
parList-list(pf1.2.4, pf1.2.4,pf3,pf1.2.4,pf5)

#version 2
parList-list(Portata,a,b,Portata,a,b,Portata,a,b,d,e, 
Portata,a,b,Portata,a,b,d)

and then I tried them (one at a time) in the loop:

resultList - list()
for (i in 1:5)
{
resultList[[i]] - nls(NT.N ~ fctList[[i]](parList[[i]]), data=subset(dati, 
Fiume==Laveggio), start=startList
[[i]], nls.control(maxiter=200), algorithm='port', trace=TRUE, 
na.action=na.omit,upper=upperList[[i]], lower=lowerList
[[i]])
}
but I got this error message:  Error in fctList[[i]](parList[i]) : element 1 
is empty;
   the part of the args list of '+' being evaluated was:
   (a, (b/Portata))

What can I do to fix it?
I'm also wondering which kind of function (maybe another loop?) I could use to 
automize the regression not only for 
the variable NT.N but for every variable (PTG.P, PO4.P,. ..)

My dataframe look like this (a sample):

Fiume giorno mese anno Portata  PTG.P   PO4.P   NT.N  NH4.N NO3.N   
BOD5 SiO2  data
1Vedeggio 101 1995   0.981 218.40 118.000  9.196 6.5700  2.06  
6.080 4.33 34709
2Vedeggio  72 1995   0.965 125.84  54.000  8.701 5.2600  2.31 
16.480 4.43 34737
3Vedeggio  73 1995   1.536  37.44  12.000  7.271 5.5600  1.88  
5.240 4.15 34765
...
190 Cassarate 299 2008   1.240  26.00  20.000  2.480 0.1200  1.79  
1.700 4.03 39720
191 Cassarate 13   10 2008   0.860  23.00  16.000  2.720 0.0200  2.13  
1.780 3.71 39734
192 Cassarate 10   11 2008   8.840  26.00  14.000  2.900 0.0500NA  
1.400 3.62 39762
193 Cassarate  9   12 2008   2.030  35.00  23.000  2.190 0.0700  1.79  
1.950 3.74 39791
...
279  Laveggio 151 2002   0.347  77.00  30.000  9.690 0.4300  7.23  
1.950 4.17 37271
280  Laveggio 112 2002   0.527  54.00  17.000  7.520 0.8800  5.87  
2.410 3.58 37298
281  Laveggio 133 2002   0.900  34.00  15.000  7.520 0.7100  6.17  
6.550 3.03 37328
...
Thanks to anyone that could give me any hint!!
Laura




## a for loop
resultList - list()
for (i in 1:5)
{
## storing the result as the i'th list component
## notice that the i'th list components in fctList and startList
## are used for the i'th fit
resultList[[i]] - nls(NT.N ~ fctList[[i]](parList[[i]]), data=subset(dati, 
Fiume==Laveggio), start=startList
[[i]], nls.control(maxiter=200), algorithm='port', trace=TRUE, 
na.action=na.omit)
}

Messaggio originale
Da: r...@life.ku.dk
Data: 03.02.2009 19.00
A: lauramorg...@bluewin.ch
Oggetto: Re: [R] non linear regression with nls

Hi Laura,

I've the following suggestion for you using several lists and a for loop:


fz1-function(Portata, a, b){a+b/Portata}
fz2-function(Portata, a, b){a*exp(b*Portata)}
fz3-function(Portata, a, b, d, e){a+b/Portata+d*(Portata^e)}
fz4-function(Portata, b, d){b*Portata^d}
fz5-function(Portata, a, b, d){a+b*(Portata^d)}
fctList - list(fz1, fz2, fz3, fz4, fz5)

startList - list(list(a=10, b=10), list(a=10, b=1), start=list(a=10, b=10, 
d=10, e=10),
list(a=10, b=1), list(a=10, b=10, d=1))

## a for loop
resultList - list()
for (i in 1:5)
{
## storing the result as the i'th list component
## notice that the i'th list components in fctList and startList
## are used for the i'th fit
resultList[[i]] - nls(NT.N ~ 

[R] UNIX Installation of package systemfit fails

2009-02-05 Thread Yong Wang
Dear list
I am trying to install the systemfit package under unix,

install.packages(systemfit)

the installation failed. I am attaching the error and version
information below,
(if dependencies=TRUE, much more error)
any help appreciated

best,
yong

=
 install.packages(systemfit)
Warning in install.packages(systemfit) :
  argument 'lib' is missing: using
'/usr/home/d/068/meta/R/x86_64-unknown-linux-gnu-library/2.7'
--- Please select a CRAN mirror for use in this session ---
CRAN mirror

 1: Argentina   2: Australia
 3: Austria 4: Belgium
 5: Brazil (PR) 6: Brazil (RJ)
 7: Brazil (SP 1)   8: Brazil (SP 2)
 9: Canada (BC)10: Canada (ON)
11: Chile  12: China
13: Croatia14: Denmark
15: France (Toulouse)  16: France (Lyon)
17: France (Paris) 18: Germany (Goettingen)
19: Germany (Muenchen) 20: Iran
21: Ireland22: Italy (Milano)
23: Italy (Padua)  24: Italy (Palermo)
25: Japan (Aizu)   26: Japan (Tokyo)
27: Japan (Tsukuba)28: Korea
29: Mexico 30: Netherlands (Amsterdam 2)
31: Netherlands (Utrecht)  32: New Zealand
33: Norway 34: Poland (Oswiecim)
35: Poland (Wroclaw)   36: Portugal
37: Russia 38: Singapore 1
39: Singapore 240: Slovenia (Ljubljana)
41: South Africa   42: Spain (Madrid)
43: Sweden 44: Switzerland
45: Taiwan (Taichung)  46: Taiwan (Taipeh)
47: Thailand   48: Turkey
49: UK (Bristol)   50: USA (CA 1)
51: USA (CA 2) 52: USA (IA)
53: USA (MI)   54: USA (MO)
55: USA (NC)   56: USA (OH)
57: USA (PA 1) 58: USA (PA 2)
59: USA (TX 1) 60: USA (TX 2)
61: USA (WA)

Selection: 57
also installing the dependencies âzooâ, âMatrixâ, âcarâ, âlmtestâ

trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/zoo_1.5-4.tar.gz'
Content type 'application/x-gzip' length 609057 bytes (594 Kb)
opened URL
==
downloaded 594 Kb

trying URL 
'http://lib.stat.cmu.edu/R/CRAN/src/contrib/Matrix_0.999375-20.tar.gz'
Content type 'application/x-gzip' length 1954872 bytes (1.9 Mb)
opened URL
==
downloaded 1.9 Mb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/car_1.2-12.tar.gz'
Content type 'application/x-gzip' length 220728 bytes (215 Kb)
opened URL
==
downloaded 215 Kb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/lmtest_0.9-22.tar.gz'
Content type 'application/x-gzip' length 191099 bytes (186 Kb)
opened URL
==
downloaded 186 Kb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/systemfit_1.0-8.tar.gz'
Content type 'application/x-gzip' length 727116 bytes (710 Kb)
opened URL
==
downloaded 710 Kb

ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'
ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'
ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'
ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'
ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'

The downloaded packages are in
/tmp/RtmpJ28hPv/downloaded_packages
Warning messages:
1: In install.packages(systemfit) :
  installation of package 'zoo' had non-zero exit status
2: In install.packages(systemfit) :
  installation of package 'Matrix' had non-zero exit status
3: In install.packages(systemfit) :
  installation of package 'car' had non-zero exit status
4: In install.packages(systemfit) :
  installation of package 'lmtest' had non-zero exit status
5: In install.packages(systemfit) :
  installation of package 'systemfit' had non-zero exit status



 version
   _
platform   x86_64-unknown-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  2
minor  7.0
year   2008
month  04
day22

Re: [R] non linear regression with nls

2009-02-05 Thread lauramorg...@bluewin.ch
Hello, thanks for the advice of nlsList!
I tried to look at the help page of nlsList, but I didnt understand how to use 
the subset argument of the function 
and it's not clear to 
me if this only allows you to choose one subset or if it run the regression for 
every given subset, in this case how 
can someone specify the groups/subset?
Thanks a lot!
Laura


Messaggio originale
Da: kfr...@wisc.edu
Data: 03.02.2009 15.36
A: lauramorg...@bluewin.ch
Oggetto: Re: [R] non linear regression with nls

Hi, Laura-

You might have a look at ?nlsList().

Ken


- Original Message -
From: lauramorg...@bluewin.ch lauramorg...@bluewin.ch
Date: Tuesday, February 3, 2009 4:38 am
Subject: [R] non linear regression with nls
To: r-help@r-project.org


 Hello,
 I'm a beginner with R and it's the first time I'm using the R-help 
 list... I hope I'm in the right place, if not: 
 Sorry!!
 
 I need to do non linear regressions on a data set which columns are:
 river.namePortata  PTG.P   PO4.P   NT.NNH4.N   
 NO3.N   BOD5SiO2   
 I need to predict every variable (PTG, PO4, NT, ..., which are 
 concentration of substances in water) starting from 
 the Portata variable (which is the water flow)
 The functions that I'm using are:
  fz1-function(Portata, a, b){a+b/Portata}
  fz2-function(Portata, a, b){a*exp(b*Portata)}
  fz3-function(Portata, a, b, d, e){a+b/Portata+d*(Portata^e)}
  fz4-function(Portata, b, d){b*Portata^d}
  fz5-function(Portata, a, b, d){a+b*(Portata^d)}
 I've made a list of the functions with list(fz1, fz2, fz3, fz4, fz5)
 
 and the starting , lower and upper parameters for each function are:
 fz1: start=list(a=10, b=10), lower=list(a=0, b=0), upper=list(a=1000, 
 b=1000) 
 fz2: start=list(a=10, b=1), lower=list(a=0, b=0), upper=list(a=1000, b=1000)
 fz3: start=list(a=10, b=10, d=10, e=10), lower=list(a=0, b=0, d=0, 
 e=-50), upper=list(a=1000, b=1000, d=1000, e=50) 
 fz4: start=list (a=10, b=1), lower=list(a=0, b=-50), 
 upper=list(a=1000, b=50)
 fz5: start=list(a=10, b=10, d=1), lower=list(a=0, b=0, d=-50), 
 upper=list(a=1000, b=1000, d=50)
 
 so far i manage to do non linear regression one at a time that is, 
 using one function for one river) using nls(), for 
 example:
 r.NT.lav-nls(NT.N~ fz1(Portata, a,b), 
 data=subset(dati,river.name==Laveggio), start=list(a=10, b=10), nls.control
 (maxiter=200), algorithm='port', trace=TRUE, na.action=na.omit, 
 lower=list(a=0, b=0), upper=list(a=1000, b=1000))
 and then I get the results with summary() and the graph using plotfit()
 
 but this will get extremly long since I have 12 rivers to analize for 
 every variable and then compare the results, so 
 I'd like to use a loop (cycle for??) but I can't figure out how it 
 works. I've tried to look on the help page on ?
 Control (control flow) but I didn't understand it... 
 Can somebody help me (give me a hint or an example of a loop) to 
 automize the regression and save the results
 Please consider that my knowledge of computer programming is 
 practically non-existent!!
 Thanks a lot!
 Laura  F.
 
 __
 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] UNIX Installation of package systemfit fails

2009-02-05 Thread Uwe Ligges

Please read your output which tells you several times:

Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'



Uwe Ligges



Yong Wang wrote:

Dear list
I am trying to install the systemfit package under unix,

install.packages(systemfit)

the installation failed. I am attaching the error and version
information below,
(if dependencies=TRUE, much more error)
any help appreciated

best,
yong

=

install.packages(systemfit)

Warning in install.packages(systemfit) :
  argument 'lib' is missing: using
'/usr/home/d/068/meta/R/x86_64-unknown-linux-gnu-library/2.7'
--- Please select a CRAN mirror for use in this session ---
CRAN mirror

 1: Argentina   2: Australia
 3: Austria 4: Belgium
 5: Brazil (PR) 6: Brazil (RJ)
 7: Brazil (SP 1)   8: Brazil (SP 2)
 9: Canada (BC)10: Canada (ON)
11: Chile  12: China
13: Croatia14: Denmark
15: France (Toulouse)  16: France (Lyon)
17: France (Paris) 18: Germany (Goettingen)
19: Germany (Muenchen) 20: Iran
21: Ireland22: Italy (Milano)
23: Italy (Padua)  24: Italy (Palermo)
25: Japan (Aizu)   26: Japan (Tokyo)
27: Japan (Tsukuba)28: Korea
29: Mexico 30: Netherlands (Amsterdam 2)
31: Netherlands (Utrecht)  32: New Zealand
33: Norway 34: Poland (Oswiecim)
35: Poland (Wroclaw)   36: Portugal
37: Russia 38: Singapore 1
39: Singapore 240: Slovenia (Ljubljana)
41: South Africa   42: Spain (Madrid)
43: Sweden 44: Switzerland
45: Taiwan (Taichung)  46: Taiwan (Taipeh)
47: Thailand   48: Turkey
49: UK (Bristol)   50: USA (CA 1)
51: USA (CA 2) 52: USA (IA)
53: USA (MI)   54: USA (MO)
55: USA (NC)   56: USA (OH)
57: USA (PA 1) 58: USA (PA 2)
59: USA (TX 1) 60: USA (TX 2)
61: USA (WA)

Selection: 57
also installing the dependencies âzooâ, âMatrixâ, âcarâ, âlmtestâ

trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/zoo_1.5-4.tar.gz'
Content type 'application/x-gzip' length 609057 bytes (594 Kb)
opened URL
==
downloaded 594 Kb

trying URL 
'http://lib.stat.cmu.edu/R/CRAN/src/contrib/Matrix_0.999375-20.tar.gz'
Content type 'application/x-gzip' length 1954872 bytes (1.9 Mb)
opened URL
==
downloaded 1.9 Mb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/car_1.2-12.tar.gz'
Content type 'application/x-gzip' length 220728 bytes (215 Kb)
opened URL
==
downloaded 215 Kb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/lmtest_0.9-22.tar.gz'
Content type 'application/x-gzip' length 191099 bytes (186 Kb)
opened URL
==
downloaded 186 Kb

trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/systemfit_1.0-8.tar.gz'
Content type 'application/x-gzip' length 727116 bytes (710 Kb)
opened URL
==
downloaded 710 Kb

ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'
ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'
ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'
ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'
ERROR: failed to lock directory
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
modifying
Try removing 
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'

The downloaded packages are in
/tmp/RtmpJ28hPv/downloaded_packages
Warning messages:
1: In install.packages(systemfit) :
  installation of package 'zoo' had non-zero exit status
2: In install.packages(systemfit) :
  installation of package 'Matrix' had non-zero exit status
3: In install.packages(systemfit) :
  installation of package 'car' had non-zero exit status
4: In install.packages(systemfit) :
  installation of package 'lmtest' had non-zero exit status
5: In install.packages(systemfit) :
  installation of package 'systemfit' had non-zero exit status



version

   _
platform   x86_64-unknown-linux-gnu

[R] help regarding storing time difference values in same unit?

2009-02-05 Thread Suresh_FSFM

Dear R-Experts, 

Seek your help.

In a List object e.g. Time_duration[[]], I am storing differece between two
time-stamps (start-time and end-time) for a certain event. 
Time difference does not remain constant for, say, 10 observations.
Each time, the time difference is given in different time units: seconds /
hours / minutes.
Can you please tell me - how I can store the values of time difference in
just one time unit ?
It can be either seconds, or minutes or hours. The criterion is - unit
should be consistent.

Thank you in advance.

Regards,
Suresh




-- 
View this message in context: 
http://www.nabble.com/help-regarding-storing-time-difference-values-in-same-unit--tp21847883p21847883.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] The Origins of R AND CALCULUS

2009-02-05 Thread Richard . Cotton
 Does any student, or teacher for that matter care whether Newton or 
Leibntiz
 invented calculas.

Students or teachers may not care, but Newton and Leibniz themselves were 
pretty bitter about who should get credit for what.
http://en.wikipedia.org/wiki/Newton_v._Leibniz_calculus_controversy

I think this whole debate has gotten rather silly.  The original article 
was targetted at non-techies, and provided at reasonable summary of what R 
does for that audience.  The followup clarified on the history of R.  As 
for Ashley Vance's journalism, well, he's more qualified to write about 
software than most, being the former editor of The Register.  Hopefully, 
this storm-in-a-teacup will blow over soon.

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] How to do ICC

2009-02-05 Thread pgseye

Hi,

I'm essentially wanting to calculate intra- and inter-observer variabilities
for the first principal component of an optic disc shape measure of a sample
of individuals, so from what I can work out I need to work out an intraclass
correlation coefficient(s).

For the intra-data, I have 2 measurements taken on each individual by the
same observer. For the inter-data, 2 observers have taken one measurement
each on the sample.

I've found the 'icc' function in the {psy} package, but am not sure how I'd
perform the intra- calculation as the data argument is an 'n*p matrix or
dataframe, n subjects p raters'.

Would I just substitute the replica for the rater?

Hope this makes sense - still learning about it all.

Thank you.

Paul
 
-- 
View this message in context: 
http://www.nabble.com/How-to-do-ICC-tp21849168p21849168.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] How do I get my IT department to bless R?

2009-02-05 Thread S Ellison
Rolf:
I'm in the odd position of having run the modest IT department at my
lab for five years, which (when I took it over) included my small
statistics team, since split out. So I'm a gamekeeper turned poacher.

Stavros wasn't wrong; these are all genuine issues for an IT manager. I
can think of a couple of others, too.

But the difference between a mere tyrant and a good IT manager (who may
be a tyrant as well) is that the latter treats them as issues to be
resolved if necessary, and the former as excuses to justify an
entrenched position. 

A point that is probably worth making; if you're an IT manager and two
or more packages can apparently do a user's job well, you would
certainly see the _user_ as a tyrant if they insisted dogmatically on
one over the other. There are probably R tyrants out there somewhere
too.

Steve E



 Rolf Turner r.tur...@auckland.ac.nz 02/02/2009 20:14 
I would just like to say that in my very humble opinion Stavros's
reply was utter nonsense.  It was the sort of excuse-making favoured
by tyrants since time immemorial.


***
This email and any attachments are confidential. Any use...{{dropped:8}}

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


Re: [R] Problem installing ad administrating packages

2009-02-05 Thread Birgitle

Solved:

I reinstalled R 2.8.1.

B.



Birgitle wrote:
 
 It is also not possible if I use this commands
 
 install.packages(analogue,/Library/Frameworks/R.framework/Versions/2.8/Resources/library,repos=http://R-Forge.R-project.org;)
 Fehler in .readRDS(pfile) : unbekanntes Eingabeformat
 
 Error in .readRDS(pfile) : unknown enter format
 
 also
 
 library(ape,lib.loc=/Library/Frameworks/R.framework/Versions/2.8/Resources/library)
 
 Error in .readRDS(pfile) : unknown enter format
 Error in if (!noCache  file.exists(dest)  file.info(dest)$mtime   : 
   missing value, where TRUE/FALSE is necessary
 
 Error in .readRDS(pfile) : unbekanntes Eingabeformat
 Fehler in if (!noCache  file.exists(dest)  file.info(dest)$mtime   : 
   Fehlender Wert, wo TRUE/FALSE nötig ist
 
 Please could somebody give me an advice. I can not do anything because I
 need some packages.
 
 Thanks
 
 Birgit
 
 
 
 
 Birgitle wrote:
 
 Hello R-User!
 
 I am running R 2.8.1 on an Intel Mac.
 I just tried to install a package using the GUI and got the following
 error message:
 Fehler in if (14 + nchar(dcall, type = w) + nchar(sm[1], type = w)  
 : 
   Fehlender Wert, wo TRUE/FALSE nötig ist
 
 Error in (14 + nchar(dcall, type = w) + nchar(sm[1], type = w)   :
   missing value, where TRUE/FALSE is necessary
 
 also if I try to look at my installed packages using GUI
 
 Fehler in .readRDS(pfile) : unbekanntes Eingabeformat
 
 Error in .readRDS(pfile) : unknown enter format.
 
 Some days ago I used a different working directory and now came back to
 my usual one. Don`t know if this causes the error.
 
 I would be very grateful if somebody could help me.
 
 Many thanks in advance
 
 B.
 
 
 
 
 


-
The art of living is more like wrestling than dancing.
(Marcus Aurelius)
-- 
View this message in context: 
http://www.nabble.com/Problem-installing-ad-administrating-packages-tp21834632p21848545.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] split dataset randomly in prediction and validation set

2009-02-05 Thread Els Verfaillie
 

For a geostatistical analysis, I would like to split my dataset randomly
into 2 parts: a prediction set (with 2/3 of my data) and a validation set
(with 1/3 of my data). Both datasets will thus contain different data.  Any
suggestions?

 


[[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] basic question: Linear model

2009-02-05 Thread Stefan Kraemer
Hey,
I try to understand a basic statistic question. I am modelling a linear 
regression Y=X*B+E. To compute the effect of “group” the B-values of the 
regressors/columns that code the interaction effects (col. 5-8 and col. 11-14, 
see below) have to be weighted with non-zero elements within the contrast 
Group 1 minus Group 2 (see below). My first understanding was that the 
interaction effects add up to zero in each group. Why do they get non-zero 
contrast weights? Do you recommend any literature discussing this topic? 

Many Thanks,
Stefan

The columns of matrix X dummy-codes
1.  Data of Group1 (G1)
2.  Data of Group2 (G2)
3.  Data condition A1 (factor A)
4.  Data condition A2 (factor A)
5.  Data in cell A1G1
6.  Data in cell A2G1 
7.  Data in cell A1G2
8.  Data in cell A2G2
9.  Data condition B1 (factor B)
10. Data condition B2 (factor B)
11. Data in cell B1G1
12. Data in cell B2G1
13. Data in cell B1G2
14. Data in cell B2G2
15. Mean

Example:
#create X
dimnames = list( paste(sub,c(1:8)),
c(Group1,Group2,A1,A2,A1G1,A2G1, A1G2,A2G2,B1,B2, 
B1G1,B2G1, B1G2,B2G2,mean ))
X=matrix(nrow=8,ncol=15,dimnames=dimnames)
X[,1]= c(rep(1,4), rep(0,4))
X[,2]=c(rep(0,4),rep(1,4))
X[,3]=c(1,1,0,0,1,1,0,0);
X[,4]=c(0,0,1,1,0,0,1,1);
X[,5]=c(1,1,0,0,0,0,0,0);
X[,6]=c(0,0,1,1,0,0,0,0);
X[,7]=c(0,0,0,0,1,1,0,0);
X[,8]=c(0,0,0,0,0,0,1,1);
X[,9]=c(1, 0, 1, 0, 1, 0,1, 0);
X[,10]=c(0, 1, 0, 1, 0, 1, 0, 1);
X[,11]=c(1, 0, 1, 0,0, 0, 0, 0);
X[,12]=c( 0, 1, 0, 1,0, 0, 0, 0);
X[,13]=c( 0, 0, 0, 0,  1, 0, 1, 0)
X[,14]=c(0, 0, 0, 0,0, 1, 0, 1)
X[,15]=c(1,1,1,1,1,1,1,1)
#y data
Y=c(1.2,5.1,1.7,7,6.1,8,1.1,2.5)

library(MASS)
ginv()
B=(ginv(t(X)%*%X) %*% t(X)) %*% Y

#contrast
c1=rep(0,15)
c1[1]=1
c1[c(5,6,11,12)]=1/2
c2=rep(0,15)
c2[2]=-1
c2[c(7,8,13,14)]=-1/2

#Group effect
mean(Y[1:4])-mean(Y[5:8])
c1%*%B+c2%*%B

--

__
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] Chi-squared test adjusted for multiple comparisons? Harbe's test?

2009-02-05 Thread Laura Lucia Prieto Godino
Hi!

I have some data that looks like this
up  downpercentaje
uew_21  20  14  58.82
uew_20_527  40  40.29
uew_20  8   13  38.09
uew_19_517  42  28.81



So I have 4 experimental conditions and I am counting number of  
animals in the up and down compartment and the calculating the  
percentage, I want to know which one of the conditions is different  
from each other. If the data wouldn't be percentage I would runt a  
kruskal-wallis test to check for general differences and then when  
significan a post-hoc test, comparing differents pairs with Man- 
Whitney (wilcoxon function in R) with a bonferroni correction for  
multiple comparisons. But as the data are in the percentaje form, I  
know I need to analize them with either a chi squared or a g-test, but  
I have no idea if I can do such a test with many comparissons or how  
to do it in R, as well I have seen a paper in which they do something  
similar and they are using a Harber's chi squared test. Does anybody  
know how to do that in R?

Thank you  very much for your help, and thanks to the jim and chuck  
for answering my previous statistical question!

Lucia

[[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] Unexpected mfrow, layout behavior (pdf still has multiple pages)

2009-02-05 Thread Paul Johnston
My goal is to create a graph with one column and three rows into a
single graphic. The mfrow, mfcol, and layout functions all have the
same effect: three graphs are produced in a single pdf file, having
one graph per page.  This is not what I want (I didn't want multiple
pages).  Just before I sent this post, I was able to generate the
desired output with split.screen.  Is this the expected behavior of
mfrow and layout?

Paul



My code is as follows (ToruosityPlot and DiameterPlot are essentially
identical to LDRPlot).

layout(matrix(1:3, ncol=1))
#par(mfrow=c(3,1))

pdf(results.pdf, width=4, height=3, pointsize=4, colormodel=cmyk,
onefile=TRUE)

TortuosityPlot(left, right)
DiameterPlot(left, right)
LDRPlot(left, right)

dev.off()

LDRPlot - function(left, right)
  {
plot(left$x, left$LDR, bty=n, ann=FALSE, xlim=c(-1500, 1000),
ylim=c(1.0, 1.5))
abline(v=0, col=gray(.90))
lines(left$x, left$LDR, col=green4, lty=solid)
points(left$x, left$LDR, bg=limegreen, pch=21)
lines(right$x, right$LDR, col=blue4, lty=dashed)
points(right$x, right$LDR, bg=blue, pch=21)
#title(main=LDR, xlab=Distance (um), ylab=LDR,
col.main=black, col.lab=gray(.4), cex.main=1.2, cex.lab=1.0,
font.main=4, font.lab=3)
  }


platform   i386-apple-darwin8.11.1
arch   i386
os darwin8.11.1
system i386, darwin8.11.1
status
major  2
minor  8.1
year   2008
month  12
day22
svn rev47281
language   R
version.string R version 2.8.1 (2008-12-22)

__
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] UNIX Installation of package systemfit fails

2009-02-05 Thread Peter Dalgaard
Yong Wang wrote:
 Dear list
 I am trying to install the systemfit package under unix,
 
 install.packages(systemfit)
 
 the installation failed. I am attaching the error and version
 information below,
 (if dependencies=TRUE, much more error)
 any help appreciated

 ERROR: failed to lock directory
 '/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7' for
 modifying
 Try removing 
 '/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'

So, did you try removing
'/usr/home/d/068/wangyong/R/x86_64-unknown-linux-gnu-library/2.7/00LOCK'

?


If you didn't, you should, if you did, you should have said so...




-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

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


[R] confidence interval for roc curves

2009-02-05 Thread marc bernard

Dear all,
 
I am looking for an R package that allows me to calculate and plot the 
confidence limits for the roc curve using for example some bootstrapping.
 I tried ROCR who seems doing such work but i couldn't find the right option 
to do it.
 
Many thanks
 
Bests
 
Marc
 
_


tarted! 

[[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] Roc curves confidence intervals

2009-02-05 Thread marc bernard

Dear all, I am looking for an R package that allows me to calculate and plot 
the confidence intervals for the roc curve using for example some 
bootstrapping. I tried ROCR who seems doing such work but i couldn't find the 
right option in it. Many thanks Bests Marc
_


[[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] The Origins of R AND CALCULUS

2009-02-05 Thread Peter Dalgaard

Mark Difford wrote:



It would have been very easy for Mr. Vance to have written:

John M. Chambers, a former Bell Labs researcher who is now a consulting
professor of statistics at Stanford University, was an early champion. At
Bell Labs, Mr. Chambers had helped develop S, THE PROTOTYPE OF R, which was
meant to give researchers of all stripes an accessible data analysis tool.



...except that it would be wrong in about as many ways. (In fact, 
referring to S (v.3) as the prototype was an internal R Core joke for 
quite a while.) Two major points:


- S-PLUS was at the time a strong commercial product, not a prototype of 
   anything, and calling it that would be disrespectful to quite a few 
people working for and with StatSci/Insightful/TIBCO and their 
international distributors, as well as the Bell Labs/Lucent Technologies 
group. It couldn't touch the dinosaurs SAS and SPSS, but it did reach 
a level of more than 10 licenced users. It took several years for R 
to get to a credibility level where it was even known outside some 
narrow academic circles.


- S compatibility was not a primary goal of R. The original plan was for 
a Scheme-like language with syntactic sugar making in not unlike S. 
The potential for running existing S scripts with minimal modifications 
drove R much closer to S than originally anticipated.  This of course 
does not mean that the current R should not acknowledge its substantial 
S heritage, just that if you want to describe the early history of R 
accurately, you do need to choose your words rather more carefully.


--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

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


Re: [R] Unexpected mfrow, layout behavior (pdf still has multiple pages)

2009-02-05 Thread Peter Dalgaard
Paul Johnston wrote:
 My goal is to create a graph with one column and three rows into a
 single graphic. The mfrow, mfcol, and layout functions all have the
 same effect: three graphs are produced in a single pdf file, having
 one graph per page.  This is not what I want (I didn't want multiple
 pages).  Just before I sent this post, I was able to generate the
 desired output with split.screen.  Is this the expected behavior of
 mfrow and layout?

If you call them before opening the device, then yes, they will not
affect that device, but presumably some other device...

-p

 
 Paul
 
 
 
 My code is as follows (ToruosityPlot and DiameterPlot are essentially
 identical to LDRPlot).
 
 layout(matrix(1:3, ncol=1))
 #par(mfrow=c(3,1))
 
 pdf(results.pdf, width=4, height=3, pointsize=4, colormodel=cmyk,
 onefile=TRUE)
 
 TortuosityPlot(left, right)
 DiameterPlot(left, right)
 LDRPlot(left, right)
 
 dev.off()
 
 LDRPlot - function(left, right)
   {
 plot(left$x, left$LDR, bty=n, ann=FALSE, xlim=c(-1500, 1000),
 ylim=c(1.0, 1.5))
 abline(v=0, col=gray(.90))
 lines(left$x, left$LDR, col=green4, lty=solid)
 points(left$x, left$LDR, bg=limegreen, pch=21)
 lines(right$x, right$LDR, col=blue4, lty=dashed)
 points(right$x, right$LDR, bg=blue, pch=21)
 #title(main=LDR, xlab=Distance (um), ylab=LDR,
 col.main=black, col.lab=gray(.4), cex.main=1.2, cex.lab=1.0,
 font.main=4, font.lab=3)
   }
 
 
 platform   i386-apple-darwin8.11.1
 arch   i386
 os darwin8.11.1
 system i386, darwin8.11.1
 status
 major  2
 minor  8.1
 year   2008
 month  12
 day22
 svn rev47281
 language   R
 version.string R version 2.8.1 (2008-12-22)
 
 __
 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.


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

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


Re: [R] help regarding storing time difference values in same unit?

2009-02-05 Thread jim holtman
If you are using 'difftime', you can specify the units:

 x - as.POSIXct(c('2009-01-01 10:00', '2009-03-04 13:00'))
 x
[1] 2009-01-01 10:00:00 GMT 2009-03-04 13:00:00 GMT
 difftime(x[2], x[1])
Time difference of 62.125 days

 difftime(x[2], x[1], units='secs')
Time difference of 5367600 secs



On Thu, Feb 5, 2009 at 4:40 AM, Suresh_FSFM suresh.ghals...@gmail.com wrote:

 Dear R-Experts,

 Seek your help.

 In a List object e.g. Time_duration[[]], I am storing differece between two
 time-stamps (start-time and end-time) for a certain event.
 Time difference does not remain constant for, say, 10 observations.
 Each time, the time difference is given in different time units: seconds /
 hours / minutes.
 Can you please tell me - how I can store the values of time difference in
 just one time unit ?
 It can be either seconds, or minutes or hours. The criterion is - unit
 should be consistent.

 Thank you in advance.

 Regards,
 Suresh




 --
 View this message in context: 
 http://www.nabble.com/help-regarding-storing-time-difference-values-in-same-unit--tp21847883p21847883.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.




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

What is the problem that you are trying to solve?

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


[R] maptools: Test if point is in polygon

2009-02-05 Thread Aleksandr Andreev
In R's maptools package, is there a built-in function to test if a
given point is inside a given polygon on the map?  The map was
loaded from an ESRI Shapefile. The point's latitude and longitude are
known.

Thank you!

Aleks

-- 

Aleksandr Andreev
Fulbright Fellow
Graduate School of Management
St Petersburg State 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.


[R] plotrix::thigmophobe could usefully coerce to numeric...

2009-02-05 Thread S Ellison

thigmophobe.labels() fails with error when supplied with an array
resulting from tapply (example below).
The error originates in thigmophobe()

I know the help page says 'numeric vector' but it would be kind of nice
if it worked with numeric things of class array too. I think it would
need no more than a couple of as.numeric() calls in thigmophobe itself,
or (simpler but slightly less useful) in the call to thigmophobe in
thigmophobe.labels.

As an aside, it might also be nice if the labels in thigmophobe.labels
defaulted to names(x) if present 

I would be happy to attempt a patch if someone can point me to the
right person and svn repository.

Steve Ellison.
[This is posted to R-help and not R-dev 'cos it's a wish, not a bug and
I don't want to clutter R-dev unnecessarily]



#
# Example:
#


require(plotrix)

x-rnorm(500)
g-factor(rep(colours()[1:50], 10))

m-tapply(x,g,mean)
s-tapply(x,g,sd)

plot(m,s)
thigmophobe.labels(m,s, labels=colours()[1:50]) #Throws error

thigmophobe.labels(as.numeric(m),as.numeric(s), labels=colours()[1:50],
cex=0.7) #Works OK




***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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 running multiple R windows

2009-02-05 Thread milton ruser
On Thu, Feb 5, 2009 at 6:31 AM, Uwe Ligges
lig...@statistik.tu-dortmund.dewrote:



 milton ruser wrote:

 Dear George,
 I think it will depends on the amount of memory that each your session
 will
 need.
 Case each session use a big amount of memory, may be your some of your
 sessions will get error. I also think that you will not save time if you
 start several dataset at same time, because windows is windows.


 E, you obviously never tried. Please don't speculate.


Dear U.L.,

It is not a speculation. I had problems on run several sessions under
windows XP on a machine with 2GB, and the error occurred mainly because the
kind of processing was very memory consuming.

Obviously I can only contribute with my own experience, and not with yours.


Kind regards,

miltinho

[[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] question about running multiple R windows

2009-02-05 Thread Uwe Ligges



milton ruser wrote:

Dear George,
I think it will depends on the amount of memory that each your session will
need.
Case each session use a big amount of memory, may be your some of your
sessions will get error. I also think that you will not save time if you
start several dataset at same time, because windows is windows. 


E, you obviously never tried. Please don't speculate.

For CRAN, we are installing and checking all  1600 CRAN packages on a 
Windows machine in less than 5 hours, because it runs in parallel on 8 
CPU cores. In scaling is almost linear up to the number of actual CPU 
cores in your system - as long as a sufficient amount of memory is 
available.


Uwe Ligges



By other
side, I think that on linux you can get better results.

Good luck.

miltinho
brazil

On Wed, Feb 4, 2009 at 10:22 PM, George Chen glc...@stanford.edu wrote:


Hello,

I use R on a Microsoft Windows machine.
Is it possible for me to open multiple windows of R, have them run the same
program but for different data sets, and get accurate results?  It takes 8+
hours to run the program so I want to multitask as much as possible.
Thanks in advance,
George Chen

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



[[alternative HTML version deleted]]

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


__
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] The Origins of R AND CALCULUS

2009-02-05 Thread Mark Difford

Peter Dalgaard wrote:

 This of course does not mean that the current R should not acknowledge
 its substantial S heritage, just that if you want to describe the early
 history of R 
 accurately, you do need to choose your words rather more carefully.

Point taken, Peter. But I wan't trying to give an accurate portrayal of the
origins of R. That was Mr. Vance's obligation. I was attempting to show how
easy it would be for someone who is a writer by profession to make
reasonable, and proper, reference to R's substantial S heritage..., as you
yourself put it. And that, really, I feel, is the point.



Peter Dalgaard wrote:
 
 Mark Difford wrote:
 
 
 It would have been very easy for Mr. Vance to have written:
 
 John M. Chambers, a former Bell Labs researcher who is now a consulting
 professor of statistics at Stanford University, was an early champion. At
 Bell Labs, Mr. Chambers had helped develop S, THE PROTOTYPE OF R, which
 was
 meant to give researchers of all stripes an accessible data analysis
 tool.
 
 
 ...except that it would be wrong in about as many ways. (In fact, 
 referring to S (v.3) as the prototype was an internal R Core joke for 
 quite a while.) Two major points:
 
 - S-PLUS was at the time a strong commercial product, not a prototype of 
 anything, and calling it that would be disrespectful to quite a few 
 people working for and with StatSci/Insightful/TIBCO and their 
 international distributors, as well as the Bell Labs/Lucent Technologies 
 group. It couldn't touch the dinosaurs SAS and SPSS, but it did reach 
 a level of more than 10 licenced users. It took several years for R 
 to get to a credibility level where it was even known outside some 
 narrow academic circles.
 
 - S compatibility was not a primary goal of R. The original plan was for 
 a Scheme-like language with syntactic sugar making in not unlike S. 
 The potential for running existing S scripts with minimal modifications 
 drove R much closer to S than originally anticipated.  This of course 
 does not mean that the current R should not acknowledge its substantial 
 S heritage, just that if you want to describe the early history of R 
 accurately, you do need to choose your words rather more carefully.
 
 -- 
 O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
   (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/The-Origins-of-R-AND-CALCULUS-tp21846099p21849958.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] Installing package RODBC error - please help

2009-02-05 Thread Vaz Joao (QPT TO EPA)
Hi,

I have R version 2.8.1 running on Windows 2000 and can't seem to be able to 
install package RODBC. I've tried reinstalling R but that wasn't successful. 
Can some one please help?

This is the command I'm using and the subsequent error message:

 install.packages(RODBC, .Library, repos=http://cran.r-project.org;, 
 method=internal, destdir=getwd())

Warning: unable to access index for repository 
http://cran.r-project.org/bin/windows/contrib/2.8
Warning message:
package 'RODBC' is not available


Thanks,
Joao Vaz

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


[R] Problem with plotting data from within a function

2009-02-05 Thread Marie Sivertsen
Dear List,

I try to develop code where plotting functions are embeded in my own
functions.  The following is simplified example:

 test - function() {
data - data.frame(x=rep(1:2, each=50), y=rnorm(100))
   library(lattice)
attach(data)
xyplot(y~x)
detach()
}
test()


As far as I understand R, when test is called this should create one local
data frame, attach it that it's columns are available directly, load the
lattice library, plot data, and then detach the data frame.  But, when I
call test, nothing happens.  I see not plot and no error message.  When I
try the script from Rscript, nothing happens too.  But when I copy the
inside code from test and run it directly, all seems to work.  What am I
doing wrong?  Is this a question to be asked here, or to the developers of
lattice package?

Mvh.
Marie

[[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] optimal control, maximization with several variables?

2009-02-05 Thread Frederik Noack
Dear all,
I would like to solve the following problem, which can be done with optimal 
control theory or dynamic programming:

max(x,y) a*u1+b*u2+c*f1(u2)   s.t.  0u1x, 0u2f2(x,u2),  x'=f3(u1,u2,x)

which can be rewritten if optimal control theory should be applied as

H=a*u1+b*u2+c*f1(u2)+lambda*(x') s.t. 0u1x, 0u2f2(x,u2)

The maximum principle conditions would solve the problem.
However in steady state conditions the system simplifies further with u1=x' und 
lambda=a.
Is it possible to solve this problem in R and if yes then how?
It might be sufficient for me to maximize a simple nonlinear function
f(x,y) w.r.t. x and y.
Does anyone know how to do it? I tried optim and genoud but untill now it did 
not work.
Best wishes
Frederik



-- 
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

__
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] eliminating control characters from formatted data files

2009-02-05 Thread jim holtman
Here is one way of doing it.  You can read it in as raw and then
either replace/delete the control character and write the file back
out:

 # read in as 'raw' and delete the control-Z from the string
 x - readBin('/tempyy.txt', 'raw', n=10)
 x
 [1] 54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 1a 2e 0d 0a 4d 4f 52
45 20 4f 46 20 54 48 45 20 44 41 54 45 4d
[37] 1a 1a 0d 0a 74 68 69 73 20 69 73 20 73 6f 6d 65 20 64 61 74 61 0d
0a 6c 61 73 74 20 6c 69 6e 65 0d 0a
 rawToChar(x)
[1] This is a test \032.\r\nMORE OF THE DATEM\032\032\r\nthis is some
data\r\nlast line\r\n
 # delete ^Z
 x - x[x != as.raw(26)]
 x
 [1] 54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 2e 0d 0a 4d 4f 52 45
20 4f 46 20 54 48 45 20 44 41 54 45 4d 0d
[37] 0a 74 68 69 73 20 69 73 20 73 6f 6d 65 20 64 61 74 61 0d 0a 6c 61
73 74 20 6c 69 6e 65 0d 0a
 rawToChar(x)
[1] This is a test .\r\nMORE OF THE DATEM\r\nthis is some
data\r\nlast line\r\n
 # can now write out 'x'




On Thu, Feb 5, 2009 at 4:01 AM, David Epstein
david.epst...@warwick.ac.uk wrote:

 I have a few hundred files of formatted data. Unfortunately most of them end
 with a spurious CONTROL-Z. I want to rewrite the files without the spurious
 character. Here's what I've come up with so far, but my code is unsafe
 because it assumes without justification that the last row of df contains a
 control character (and some NAs to fill up the record).

 options(warn=-1) #turn off irritating warning from read.table()
 df-read.table(file=filename)
 df.new-df[1:nrow(df)-1,]
 write.table(df.new,file=filename.new, quote=F)

 Before defining df.new, I want to check that the last line really does
 contain a control character. I've tried various methods, but none of them
 work.

 I have been wondering if I should use a function (scan?) that reads in the
 file line by line and checks each line for control characters, but I don't
 know how to do this either.

 Thanks for any help
 David
 --
 View this message in context: 
 http://www.nabble.com/eliminating-control-characters-from-formatted-data-files-tp21847583p21847583.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.




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

What is the problem that you are trying to solve?

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


Re: [R] Problem with plotting data from within a function

2009-02-05 Thread Peter Dalgaard
Marie Sivertsen wrote:
 Dear List,
 
 I try to develop code where plotting functions are embeded in my own
 functions.  The following is simplified example:
 
 test - function() {
data - data.frame(x=rep(1:2, each=50), y=rnorm(100))
   library(lattice)
attach(data)
xyplot(y~x)
detach()
 }
 test()
 
 
 As far as I understand R, when test is called this should create one local
 data frame, attach it that it's columns are available directly, load the
 lattice library, plot data, and then detach the data frame.  But, when I
 call test, nothing happens.  I see not plot and no error message.  When I
 try the script from Rscript, nothing happens too.  But when I copy the
 inside code from test and run it directly, all seems to work.  What am I
 doing wrong?  Is this a question to be asked here, or to the developers of
 lattice package?

You need to print() your plot:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

It is probably OK to ask elementary questions on widely used packages
here. Actual bug reports should go to the maintainers and for
specialist questions, you might consider the relevant R-SIG-* group
(of which in this case there appears to be none, but there would be one
for, say, genetic marker analysis).


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

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


Re: [R] Roc curves confidence intervals

2009-02-05 Thread David Freedman

Would you be interested in the cross-validation that's on pp 3 and 4 of the
ROCR package PDF?

plot(perf,lwd=3,avg=vertical,spread.estimate=boxplot,add=TRUE)

there are various options for the 'spread.estimate'

David Freedman

marc bernard-2 wrote:
 
 
 Dear all, I am looking for an R package that allows me to calculate and
 plot the confidence intervals for the roc curve using for example some
 bootstrapping. I tried ROCR who seems doing such work but i couldn't
 find the right option in it. Many thanks Bests Marc
 _
 
 
   [[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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Roc-curves-confidence-intervals-tp21850816p21851991.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] split dataset randomly in prediction and validation set

2009-02-05 Thread jim holtman
?sample

 x - 1:100  # test data
 y - split(x, sample(1:2, length(x), replace=TRUE, prob=c(1,2)))

 y
$`1`
 [1]  4  6  7 13 15 17 18 20 21 29 35 36 37 39 41 43 46 49 50 52 61 68
70 72 76 77 79 80 82 85 87 94 95 96 99

$`2`
 [1]   1   2   3   5   8   9  10  11  12  14  16  19  22  23  24  25
26  27  28  30  31  32  33  34  38  40  42
[28]  44  45  47  48  51  53  54  55  56  57  58  59  60  62  63  64
65  66  67  69  71  73  74  75  78  81  83
[55]  84  86  88  89  90  91  92  93  97  98 100



On Thu, Feb 5, 2009 at 5:45 AM, Els Verfaillie els.verfail...@ugent.be wrote:


 For a geostatistical analysis, I would like to split my dataset randomly
 into 2 parts: a prediction set (with 2/3 of my data) and a validation set
 (with 1/3 of my data). Both datasets will thus contain different data.  Any
 suggestions?




[[alternative HTML version deleted]]

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




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

What is the problem that you are trying to solve?

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


Re: [R] help regarding storing time difference values in same unit?

2009-02-05 Thread Suresh_FSFM

Thank you, Jholtman ! :-)

Regards,
Suresh


jholtman wrote:
 
 If you are using 'difftime', you can specify the units:
 
 x - as.POSIXct(c('2009-01-01 10:00', '2009-03-04 13:00'))
 x
 [1] 2009-01-01 10:00:00 GMT 2009-03-04 13:00:00 GMT
 difftime(x[2], x[1])
 Time difference of 62.125 days
 
 difftime(x[2], x[1], units='secs')
 Time difference of 5367600 secs

 
 
 On Thu, Feb 5, 2009 at 4:40 AM, Suresh_FSFM suresh.ghals...@gmail.com
 wrote:

 Dear R-Experts,

 Seek your help.

 In a List object e.g. Time_duration[[]], I am storing differece between
 two
 time-stamps (start-time and end-time) for a certain event.
 Time difference does not remain constant for, say, 10 observations.
 Each time, the time difference is given in different time units: seconds
 /
 hours / minutes.
 Can you please tell me - how I can store the values of time difference in
 just one time unit ?
 It can be either seconds, or minutes or hours. The criterion is - unit
 should be consistent.

 Thank you in advance.

 Regards,
 Suresh




 --
 View this message in context:
 http://www.nabble.com/help-regarding-storing-time-difference-values-in-same-unit--tp21847883p21847883.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.

 
 
 
 -- 
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390
 
 What is the problem that you are trying to solve?
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/help-regarding-storing-time-difference-values-in-same-unit--tp21847883p21852134.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] eliminating control characters from formatted data files

2009-02-05 Thread Murray Cooper

David,

This may be a case of If all you have is a hammer, everything looks like a 
nail.
If all you want to do is remove the last line if it contains a CONTROL-Z, 
why

not use something like perl to process the files?

Murray M Cooper, Ph.D.
Richland Statistics
9800 N 24th St
Richland, MI, USA 49083
Mail: richs...@earthlink.net

- Original Message - 
From: David Epstein david.epst...@warwick.ac.uk

To: r-help@r-project.org
Sent: Thursday, February 05, 2009 4:01 AM
Subject: [R] eliminating control characters from formatted data files




I have a few hundred files of formatted data. Unfortunately most of them 
end
with a spurious CONTROL-Z. I want to rewrite the files without the 
spurious

character. Here's what I've come up with so far, but my code is unsafe
because it assumes without justification that the last row of df contains 
a

control character (and some NAs to fill up the record).

options(warn=-1) #turn off irritating warning from read.table()
df-read.table(file=filename)
df.new-df[1:nrow(df)-1,]
write.table(df.new,file=filename.new, quote=F)

Before defining df.new, I want to check that the last line really does
contain a control character. I've tried various methods, but none of them
work.

I have been wondering if I should use a function (scan?) that reads in the
file line by line and checks each line for control characters, but I don't
know how to do this either.

Thanks for any help
David
--
View this message in context: 
http://www.nabble.com/eliminating-control-characters-from-formatted-data-files-tp21847583p21847583.html

Sent from the R help mailing list archive at Nabble.com.

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

and provide commented, minimal, self-contained, reproducible code.



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


Re: [R] Numeric class and sasxport.get

2009-02-05 Thread Sebastien Bihorel
Ok, just so as I get that straight, is the 'labelled' class something 
that you created in your package or a readily available class in base R?


*Sebastien Bihorel, PharmD, PhD*
PKPD Scientist
Cognigen Corp
Email: sebastien.biho...@cognigencorp.com 
mailto:sebastien.biho...@cognigencorp.com

Phone: (716) 633-3463 ext. 323


Frank E Harrell Jr wrote:

Sebastien Bihorel wrote:

I also realized the flaw after testing the script on various datasets...

Following up on your last note:
1- Is that the reason why the class of integer and regular numeric 
variable is solely labelled following sasxport.get?


Yes.  R gurus might correct me but just creating a numeric vector 
doesn't create a 'hard' class, add adding your own class attribute 
equal to 'numeric' or 'integer' might cause a problem downstream.



2- Can class be 'soft' for other 'kind' of variables?


Not that I can recall.

3- Would you anticipate the following wrapper function to generate 
incompatibilities with other R functions?


I'm going to beg off on that.  I'm not enough of an expert on the 
impact of adding such classes.


Frank




SASxpt.get - function(file, force.single = TRUE,
 method=c('read.xport','dataload','csv'), 
formats=NULL, allow=NULL,

 out=NULL, keep=NULL, drop=NULL, as.is=0.5, FUN=NULL) {

 foo - sasxport.get(file=file, force.single=force.single, 
method=method,

 formats=formats, allow=allow, out=out, keep=keep,
 drop=drop, as.is=as.is, FUN=FUN)

 # For each variable of class labelled (and only labelled), add 
the native class as a second class argument


 sglClassVarInd - which(lapply(lapply(unclass(foo),class),length)==1)

 for (i in 1:length(sglClassVarInd)){
   x - foo[,sglClassVarInd[i]]  if (class(x)==labelled) 
class(foo[,sglClassVarInd[i]]) - c(class(x), class(unclass(x)))

 }
 return(foo)
}


*Sebastien Bihorel, PharmD, PhD*
PKPD Scientist
Cognigen Corp
Email: sebastien.biho...@cognigencorp.com 
mailto:sebastien.biho...@cognigencorp.com

Phone: (716) 633-3463 ext. 323


Frank E Harrell Jr wrote:

Sebastien Bihorel wrote:

Thanks a lot Frank,

One last question, though. I was tempted to remove all attributes 
of my variables after the sasxport.get call using

foo - sasxport.get(...)
foo - as.data.frame(lapply(unclass(foo),as.vector))
Since I never worked with the objects of class 'labeled', I was 
wondering what I will loose by removing this attribute.


Not a good idea, for many reasons including dates and other types.

And the labelled type is need if you subset the data, in order to 
keep the labels.


Note that your original issue is related to class being soft for 
integers and regular numerics:


 x - 1:3
 attributes(x)
NULL
 class(x)
[1] integer
 x - runif(3)
 class(x)
[1] numeric
 attributes(x)
NULL

Frank



*Sebastien Bihorel, PharmD, PhD*
PKPD Scientist
Cognigen Corp
Email: sebastien.biho...@cognigencorp.com 
mailto:sebastien.biho...@cognigencorp.com

Phone: (716) 633-3463 ext. 323


Frank E Harrell Jr wrote:

sebastien.biho...@cognigencorp.com wrote:
The problem is actually not related to a broken command but a 
attempt of
operational qualification of R. A few years ago, my company 
developed a

set of scripts for the 'operational qualification' of Splus. We are
switching to R so I am currently trying to port the scripts to R.
All Splus scripts imported SAS data using the importData 
function, which I
substituted by sasxport.get. One particular script returns the 
class of

each variable of the imported data frame; the output must match the
expected values: numeric, factor, integer, etc... The R 
'translation' with

sasxport.get is thus problematic.
If there is no easy tweak of the function, we will probably have 
to remove

this script from our list of 'qualification' scripts.

Although it would be nice


Then my advice is to write your own wrapper function for 
sasxport.get that takes its output, looks for labelled variables, 
and adds a new class of your choosing depending on properties of 
the variable, making sure that you write methods needed for that 
class (if any).  Then test your new function, not sasxport.get 
explicitly.


Frank




Sebastien Bihorel wrote:

Frank,

It is a non existing issue for me if the variables of class 
labelled

(and only labelled) can only be numerical variables (integer or
numeric).

Sebastien

'labelled' can apply to any type of vector.  I'm not clear on the
problem this causes you.  Please provide a command that is 
broken by

this behavior.

Frank


Frank E Harrell Jr wrote:

Sebastien Bihorel wrote:

Dear R-users,

The sasxport.get function (from the Hmisc package) automatically
defines the class of imported variables. I have noticed that the
class of theoretically numeric variables is simply labelled,
although character variables might end up been defined as 
labelled

Date or labelled factor.
Is there a way to tell sasxport.get to define numeric 
variable as

labelled integer or labelled 

Re: [R] Problems in Recommending R

2009-02-05 Thread hadley wickham
   I don't think you should completely rule out javascript.  It's
   possible to use it in ways that add to the utility of a page, while
   not detracting from it if not available.

 OK, what particularly do you have in mind?

Here's a few of examples off the top of my head.  These are things
that would add to the aesthetic appeal/usability of the site, without
distracting from the main content and without making the site unusable
if javascript is turned off.

 * instead of a single graphic from the r graph gallery, you could
have a slideshow of a random selection of many graphics (e.g.
http://css-tricks.com/creating-a-slick-auto-playing-featured-content-slider/)

 * you could use a js client side web analytics service (like google
analytics) to collect usage statistics across all cran mirrors in one
place (wouldn't work for packages, just pages)

 * you could use jsMath (http://www.math.union.edu/~dpvc/jsMath/) to
convert from tex style math formulas to nicely styled formulas

 * you could use amberjack (http://amberjack.org/) to help people
learn where the important parts of the site are

 * you could use a lightboxing technique when zooming into screenshot
thumbnails, e.g. http://fancy.klade.lv/

These techniques all degrade well so if you don't have javascript you
don't missing functionality.

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] Problems in Recommending R

2009-02-05 Thread hadley wickham
On Thu, Feb 5, 2009 at 8:32 AM, hadley wickham h.wick...@gmail.com wrote:
   I don't think you should completely rule out javascript.  It's
   possible to use it in ways that add to the utility of a page, while
   not detracting from it if not available.

 OK, what particularly do you have in mind?

Some more ideas:

Because we are limited in terms of server side interactivity, you
could write a small script that sniffs the user agent and presents the
matching version of R most prominently.

Or use an ip2geo service to guess which cran mirror is geographically
closest and move that to the top of the list of mirrors. (e.g.
http://www.petefreitag.com/item/683.cfm)

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] change individual label colours in a cluster plot?

2009-02-05 Thread Jim Ottaway
I am doing some bibliometric analysis of interdisciplinarity using
cluster analysis of co-authorship.

I'd like to be able to specify the colour of individual authors in the
labels to show a prior grouping by discipline (red for sociology
authors, blue for economics authors, ..., that sort of thing).

Is there any way of doing this sort of thing? I'm hoping for something like:

h - hclust(authors.dist)

h$labels - colorlabels(c(red, blue,..., green))

plot(h)

__
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] Three questions about DSE

2009-02-05 Thread Rebecca Sela
I have been using the dse1 and dse2 packages to estimate a model in which the 
underlying state is an ARMA(2,2) and the observed variables are equal to the 
state plus noise.  I am describing this model using a state space model.

First, in estimation, is there a way to restrict two of the estimated 
coefficients to be equal to each other?  In order to desribe an ARMA(2,2) model 
using a state space model, I must restrict the innovation variance to have its 
two non-zero elements equal to each other, and I haven't figured out how to do 
that.

Second, I am using the smoother to extract the signal using the code in the 
attached file.  The estimated value of the signal in the last period is 0, but 
all the estimated values are right.  Is there something I am missing here?

Finally, sometimes the smoother fails, but the filtered version of the signal 
is fine.  (That will not be the case with the attached code.)  Is there a known 
reason why this sometimes occurs?

Thank you in advance for all of your help!

Rebecca

--
Rebecca Sela
Doctoral Candidate
Statistics Group/IOMS
Stern School of Business__
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] overlay plot question

2009-02-05 Thread Doran, Harold
Did you want something like this:

library(lattice)
x - plogis(.x, location=0, scale=1)
y -  plogis(.x, location=2, scale=4)
xvals - seq(-7.6, 7.6, length=100)
xyplot(x+y ~ xvals,  type = c(g, l)) 

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of David Kaplan
 Sent: Wednesday, February 04, 2009 5:25 PM
 To: r-h...@stat.math.ethz.ch
 Subject: [R] overlay plot question
 
 Greetings all,
 
 I have two logistic plots coming from two calls to plogis.  
 The code is
 
 .x - seq(-7.6, 7.6, length=100)
   plot(.x, plogis(.x, location=0, scale=1), xlab=x, 
 ylab=Density,  main=Logistic Distribution: location = 0, 
 scale = 1, type=l)
   abline(h=0, col=gray)
  
 
 .y - seq(-7.6, 7.6, length=100)
   plot(.x, plogis(.x, location=2, scale=4), xlab=x, ylab=Density,
   main=Logistic Distribution: location = 2, scale = 4, 
 type=l)  abline(h=0, col=gray)
  
  remove(.x)
 
  remove(.y)
 
 
 I would like to overlay these on one plot.  Notice here the 
 y-axis is different.  But I would like to axis to be 0 to 1 
 as in the first plot.
 
 Any suggestions would be greatly appreciated.
 
 Thanks in advance,
 
 David
 
 
 --
 ==
 =
 David Kaplan, Ph.D.
 Professor
 Department of Educational Psychology
 University of Wisconsin - Madison
 Educational Sciences, Room, 1061
 1025 W. Johnson Street
 Madison, WI 53706
 
 email: dkap...@education.wisc.edu
 homepage:
 http://www.education.wisc.edu/edpsych/default.aspx?content=kaplan.html
 Phone: 608-262-0836
 
 __
 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] change individual label colours in a cluster plot?

2009-02-05 Thread patricia garcía gonzález

Hi, 

If you have a variable, that defines what you want to differentiate (sociology, 
economics etc.) then you can add color depending on the value of that  
variable. You will have to convert it to numeric if it is not.
An example would be

plot( iris[ , 1 ], iris[ , 2], col = iris[ , 3 ] )


Regards


Patricia

 To: r-h...@stat.math.ethz.ch
 From: j.otta...@lse.ac.uk
 Date: Thu, 5 Feb 2009 13:44:21 +
 Subject: [R] change individual label colours in a cluster plot?
 
 I am doing some bibliometric analysis of interdisciplinarity using
 cluster analysis of co-authorship.
 
 I'd like to be able to specify the colour of individual authors in the
 labels to show a prior grouping by discipline (red for sociology
 authors, blue for economics authors, ..., that sort of thing).
 
 Is there any way of doing this sort of thing? I'm hoping for something like:
 
 h - hclust(authors.dist)
 
 h$labels - colorlabels(c(red, blue,..., green))
 
 plot(h)
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

_


[[alternative HTML version deleted]]

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


Re: [R] maptools: Test if point is in polygon

2009-02-05 Thread baptiste auguie
I don't know about the maptools package but one general way to do this  
would be to compute the convex hull (?chull)  of the augmented set of  
points and test if the point belongs to it.


Hope this helps,

baptiste



On 5 Feb 2009, at 13:21, Aleksandr Andreev wrote:


In R's maptools package, is there a built-in function to test if a
given point is inside a given polygon on the map?  The map was
loaded from an ESRI Shapefile. The point's latitude and longitude are
known.

Thank you!

Aleks

--

Aleksandr Andreev
Fulbright Fellow
Graduate School of Management
St Petersburg State 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.


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

__
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] maptools: Test if point is in polygon

2009-02-05 Thread Rainer M Krug
On Thu, Feb 5, 2009 at 3:21 PM, Aleksandr Andreev
aleksandr.andr...@gmail.com wrote:
 In R's maptools package, is there a built-in function to test if a
 given point is inside a given polygon on the map?  The map was
 loaded from an ESRI Shapefile. The point's latitude and longitude are
 known.

If everything else fails, convert the shape file into a raster and
drill down at the location of the points.

Rainer


 Thank you!

 Aleks

 --
 
 Aleksandr Andreev
 Fulbright Fellow
 Graduate School of Management
 St Petersburg State 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.




-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa

__
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] The Origins of R

2009-02-05 Thread Duncan Murdoch

On 2/5/2009 1:05 AM, Mark Difford wrote:
I think that all appeared on January 8 in Vance's blog posting, with a 
comment on it by David M Smith on Jan 9.  So those people have -27 days 


Then there was no need for vituperative comments (not from you, of course):
simply point doubters to the right place, as you have done. But Mr. Vance's
comments only deepen the mystery.

If Mr. Vance was aware of the true origins of R, why did he choose to
misrepresent them in his article, which is what got the publicity and which
is the item that most people saw/read? Most right-thinking people don't,
wouldn't, or haven't taken the matter further than that. Their criticisms,
as mine have been, have been aimed at the NY Times and Mr. Vance's lack of
ethics. It also seems clear from Mr. Vance's comments that there was no
editorial or sub-editorial meddling.


That's not what I read in the posting to this list that I cited.

I doubt if Ashlee Vance is reading this list, so it doesn't really seem 
fair to blame him if he doesn't respond to your attacks.


So I'm not complaining, but the main problem I saw in his article was 
that it didn't mention me.  I knew Robert Gentleman (even had an office 
next to him!) before he started R:  surely that must have been a key 
influence.  Why else did he move to the far side of the globe?  And not 
only that, but to compound the insult, the NY Times has failed to 
mention me every day since then!


Duncan Murdoch



The knee-jerk reaction ? Well, it is almost amusing to see how sensitive
some very hard-nosed individuals on this list can be, or have become.

Regards, Mark.

still to wait.

Duncan Murdoch-2 wrote:


On 2/4/2009 3:53 PM, Mark Difford wrote:
 Indeed.  The postings exuded a tabloid-esque level of slimy  

 nastiness.


Hi Rolf,

It is good to have clarification, for you wrote ..,the postings...,
tarring everyone with the same brush. And it was quite a nasty brush. It
also is conjecture that this was due to an editor or sub-editor, i.e.
the
botched article.

I think that what some people are waiting for are factual statements from
the parties concerned. Conjecture is, well, little more than conjecture.


I think that all appeared on January 8 in Vance's blog posting, with a 
comment on it by David M Smith on Jan 9.  So those people have -27 days 
still to wait.


Duncan Murdoch




Regards, Mark.


Rolf Turner-3 wrote:



On 4/02/2009, at 8:15 PM, Mark Difford wrote:



Indeed.  The postings exuded a tabloid-esque level of slimy  
nastiness.


Indeed, indeed. But I do not feel that that is necessarily the  
case. Credit
should be given where credit is due. And that, I believe is the  
issue that
is getting (some) people hot and bothered. Certainly, Trevor Hastie  
in his
reply to the NY Times article, was not too happy with this aspect  
of the

story.

Granted, his comments were not made on this list, but the objection is
essentially the same. I would not call what he had to say Mischief  
making
or smacking of a tabloid-esque level of slimy nastiness. The knee- 
jerk

reaction seems to be that this is a criticism of R. It is not. It is a
criticism of a poorly researched article.

It also is an undeniable and inescapable fact that most S code runs  
in R.


The problem is not with criticism of the NY Times article, although  
as Pat
Burns and others have pointed out this criticism was somewhat  
misdirected
and unrealistic considering the exigencies of newspaper editing.  The  
problem

was with a number of posts that cast aspersions upon the integrity of
Ihaka and Gentleman.  It is these posts that exuded tabloid-esque slimy
nastiness.

I am sure that Ross and Robert would never dream of failing to give  
credit
where credit is due and it is almost certainly the case that they  
explained
the origins of R in the S language to the writer of the NYT article  
(wherefrom

the explanation was cut in the editing process).

Those of us on this list (with the possible exception of one or two  
nutters)
would take it that it goes without saying that R was developed on the  
basis
of S --- we all ***know*** that.  To impugn the integrity of Ihaka  
and Gentleman,
because an article which *they didn't write* failed to mention this  
fact, is

unconscionable.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
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] eliminating control characters from formatted data files

2009-02-05 Thread David Epstein



Murray Cooper wrote:
 
 This may be a case of If all you have is a hammer, everything looks like
 a 
 nail.
 If all you want to do is remove the last line if it contains a CONTROL-Z, 
 why
 not use something like perl to process the files?
 
My first thought was to use perl, and this would have saved a lot of my
time, in the short run. However, I'm trying to learn R, and the way to learn
a programming language is to use it. I've learned a lot about R from this
exercise, much more than has been revealed on this forum.
David
-- 
View this message in context: 
http://www.nabble.com/eliminating-control-characters-from-formatted-data-files-tp21847583p21853836.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] The Origins of R

2009-02-05 Thread Mark Difford

Duncan Murdoch wrote:

 So I'm not complaining, but the main problem I saw in his article was 
 that it didn't mention me.  I knew Robert Gentleman (even had an office 
 next to him!) before he started R:  surely that must have been a key 
 influence.

I am sorry to hear that. If I understand you correctly, it seems that Mr.
Vance made an even more botched job of parts of his article than one would
have thought possible. The proverbial curate's egg, it seems.

Regards, Mark.


Duncan Murdoch-2 wrote:
 
 On 2/5/2009 1:05 AM, Mark Difford wrote:
 I think that all appeared on January 8 in Vance's blog posting, with a 
 comment on it by David M Smith on Jan 9.  So those people have -27 days 
 
 Then there was no need for vituperative comments (not from you, of
 course):
 simply point doubters to the right place, as you have done. But Mr.
 Vance's
 comments only deepen the mystery.
 
 If Mr. Vance was aware of the true origins of R, why did he choose to
 misrepresent them in his article, which is what got the publicity and
 which
 is the item that most people saw/read? Most right-thinking people don't,
 wouldn't, or haven't taken the matter further than that. Their
 criticisms,
 as mine have been, have been aimed at the NY Times and Mr. Vance's lack
 of
 ethics. It also seems clear from Mr. Vance's comments that there was no
 editorial or sub-editorial meddling.
 
 That's not what I read in the posting to this list that I cited.
 
 I doubt if Ashlee Vance is reading this list, so it doesn't really seem 
 fair to blame him if he doesn't respond to your attacks.
 
 So I'm not complaining, but the main problem I saw in his article was 
 that it didn't mention me.  I knew Robert Gentleman (even had an office 
 next to him!) before he started R:  surely that must have been a key 
 influence.  Why else did he move to the far side of the globe?  And not 
 only that, but to compound the insult, the NY Times has failed to 
 mention me every day since then!
 
 Duncan Murdoch
 
 
 The knee-jerk reaction ? Well, it is almost amusing to see how sensitive
 some very hard-nosed individuals on this list can be, or have become.
 
 Regards, Mark.
 
 still to wait.
 
 Duncan Murdoch-2 wrote:
 
 On 2/4/2009 3:53 PM, Mark Difford wrote:
  Indeed.  The postings exuded a tabloid-esque level of slimy  
  nastiness.
 
 Hi Rolf,
 
 It is good to have clarification, for you wrote ..,the postings...,
 tarring everyone with the same brush. And it was quite a nasty brush.
 It
 also is conjecture that this was due to an editor or sub-editor, i.e.
 the
 botched article.
 
 I think that what some people are waiting for are factual statements
 from
 the parties concerned. Conjecture is, well, little more than
 conjecture.
 
 I think that all appeared on January 8 in Vance's blog posting, with a 
 comment on it by David M Smith on Jan 9.  So those people have -27 days 
 still to wait.
 
 Duncan Murdoch
 
 
 
 Regards, Mark.
 
 
 Rolf Turner-3 wrote:
 
 
 On 4/02/2009, at 8:15 PM, Mark Difford wrote:
 

 Indeed.  The postings exuded a tabloid-esque level of slimy  
 nastiness.

 Indeed, indeed. But I do not feel that that is necessarily the  
 case. Credit
 should be given where credit is due. And that, I believe is the  
 issue that
 is getting (some) people hot and bothered. Certainly, Trevor Hastie  
 in his
 reply to the NY Times article, was not too happy with this aspect  
 of the
 story.

 Granted, his comments were not made on this list, but the objection
 is
 essentially the same. I would not call what he had to say Mischief  
 making
 or smacking of a tabloid-esque level of slimy nastiness. The knee- 
 jerk
 reaction seems to be that this is a criticism of R. It is not. It is
 a
 criticism of a poorly researched article.

 It also is an undeniable and inescapable fact that most S code runs  
 in R.
 
 The problem is not with criticism of the NY Times article, although  
 as Pat
 Burns and others have pointed out this criticism was somewhat  
 misdirected
 and unrealistic considering the exigencies of newspaper editing.  The  
 problem
 was with a number of posts that cast aspersions upon the integrity of
 Ihaka and Gentleman.  It is these posts that exuded tabloid-esque
 slimy
 nastiness.
 
 I am sure that Ross and Robert would never dream of failing to give  
 credit
 where credit is due and it is almost certainly the case that they  
 explained
 the origins of R in the S language to the writer of the NYT article  
 (wherefrom
 the explanation was cut in the editing process).
 
 Those of us on this list (with the possible exception of one or two  
 nutters)
 would take it that it goes without saying that R was developed on the  
 basis
 of S --- we all ***know*** that.  To impugn the integrity of Ihaka  
 and Gentleman,
 because an article which *they didn't write* failed to mention this  
 fact, is
 unconscionable.
 
   cheers,
 
   Rolf Turner
 
 ##
 

Re: [R] change individual label colours in a cluster plot?

2009-02-05 Thread Jim Ottaway
 patricia garcía gonzález kurtney...@hotmail.com writes:

 Hi,

 If you have a variable, that defines what you want to differentiate
 (sociology, economics etc.) then you can add color depending on the
 value of that variable. You will have to convert it to numeric if it is
 not. An example would be

 plot( iris[ , 1 ], iris[ , 2], col = iris[ , 3 ] )


Thank you.  I'm not sure that I can do that with an hclust object,
though: perhaps something using the text function and the order data in
the hclust object might work?

Currently, I'm good getting results using a script to edit the
postscript output, but I'm keen to find an R solution, if only to
improve my understanding of R graphicss.

Yours sincerely,
-- 
Jim Ottaway

__
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] The Origins of R

2009-02-05 Thread Roy Mendelssohn
Can we give this a rest  (or take it offline)?  This is the R-Help  
mail list, and I fail to grasp how anyone is being helped to use R by  
this endless discussion.


-Roy M.


**
The contents of this message do not reflect any position of the U.S.  
Government or NOAA.

**
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: roy.mendelss...@noaa.gov (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/

Old age and treachery will overcome youth and skill.
From those who have been given much, much will be expected

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


[R] A way to lock down the order of bars for ggplot dodged histogram

2009-02-05 Thread Jason Rupert
It appears that ggplot reorder the data for a dodged histogram based on 
whether or not a specific variable has a value in the first bin. 
 
I would like to be able to absolutely force the order of the variables in the 
bin.  For example, say I have three variables Me, You, and Them. 
 
Me_df-data.frame(Data = c(1:15), Person = Me)
You_df-data.frame(Data = c(10:20), Person = You)
Them_df-data.frame(Data = c(15:25), Person = Them)
Group_df_tmp-rbind(Me_df,You_df)
Group_df-rbind(Group_df_tmp,Them_df)
counts - ddply(Group_df, .(cut(Data, breaks=fullseq(range(Data), 5)), Person), 
nrow) 
names(counts) - c(Bin, Person, Frequency)
qplot(Person, Frequency, data = counts, fill = Person, geom=bar, 
stat=identity, width = 0.9, xlab=Person) +  facet_grid(. ~ Bin) 
 
However, I absolutely must have the bar order be Them, You, Me.   Is there a to 
fix the order of the bars so that they are always in the Them, You, Me order? 
 
Thank you again for any feedback you can provide.  
 
 


  
[[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] The Origins of R

2009-02-05 Thread Murray Cooper

Consider yourself lucky!
I'm sure there are many people who would
prefer not to see their name in the NYT. ;-)

Murray Coooper

- Original Message - 
From: Duncan Murdoch murd...@stats.uwo.ca

To: Mark Difford mark_diff...@yahoo.co.uk
Cc: r-help@r-project.org
Sent: Thursday, February 05, 2009 10:16 AM
Subject: Re: [R] The Origins of R



On 2/5/2009 1:05 AM, Mark Difford wrote:
I think that all appeared on January 8 in Vance's blog posting, with a 
comment on it by David M Smith on Jan 9.  So those people have -27 days


Then there was no need for vituperative comments (not from you, of 
course):
simply point doubters to the right place, as you have done. But Mr. 
Vance's

comments only deepen the mystery.

If Mr. Vance was aware of the true origins of R, why did he choose to
misrepresent them in his article, which is what got the publicity and 
which

is the item that most people saw/read? Most right-thinking people don't,
wouldn't, or haven't taken the matter further than that. Their 
criticisms,
as mine have been, have been aimed at the NY Times and Mr. Vance's lack 
of

ethics. It also seems clear from Mr. Vance's comments that there was no
editorial or sub-editorial meddling.


That's not what I read in the posting to this list that I cited.

I doubt if Ashlee Vance is reading this list, so it doesn't really seem 
fair to blame him if he doesn't respond to your attacks.


So I'm not complaining, but the main problem I saw in his article was that 
it didn't mention me.  I knew Robert Gentleman (even had an office next to 
him!) before he started R:  surely that must have been a key influence. 
Why else did he move to the far side of the globe?  And not only that, but 
to compound the insult, the NY Times has failed to mention me every day 
since then!


Duncan Murdoch



The knee-jerk reaction ? Well, it is almost amusing to see how sensitive
some very hard-nosed individuals on this list can be, or have become.

Regards, Mark.

still to wait.

Duncan Murdoch-2 wrote:


On 2/4/2009 3:53 PM, Mark Difford wrote:

 Indeed.  The postings exuded a tabloid-esque level of slimy

 nastiness.


Hi Rolf,

It is good to have clarification, for you wrote ..,the postings...,
tarring everyone with the same brush. And it was quite a nasty brush. 
It

also is conjecture that this was due to an editor or sub-editor, i.e.
the
botched article.

I think that what some people are waiting for are factual statements 
from
the parties concerned. Conjecture is, well, little more than 
conjecture.


I think that all appeared on January 8 in Vance's blog posting, with a 
comment on it by David M Smith on Jan 9.  So those people have -27 days 
still to wait.


Duncan Murdoch




Regards, Mark.


Rolf Turner-3 wrote:



On 4/02/2009, at 8:15 PM, Mark Difford wrote:



Indeed.  The postings exuded a tabloid-esque level of slimy 
nastiness.


Indeed, indeed. But I do not feel that that is necessarily the  case. 
Credit
should be given where credit is due. And that, I believe is the 
issue that
is getting (some) people hot and bothered. Certainly, Trevor Hastie 
in his
reply to the NY Times article, was not too happy with this aspect  of 
the

story.

Granted, his comments were not made on this list, but the objection 
is
essentially the same. I would not call what he had to say Mischief 
making
or smacking of a tabloid-esque level of slimy nastiness. The knee- 
jerk
reaction seems to be that this is a criticism of R. It is not. It is 
a

criticism of a poorly researched article.

It also is an undeniable and inescapable fact that most S code runs 
in R.


The problem is not with criticism of the NY Times article, although 
as Pat
Burns and others have pointed out this criticism was somewhat 
misdirected
and unrealistic considering the exigencies of newspaper editing.  The 
problem

was with a number of posts that cast aspersions upon the integrity of
Ihaka and Gentleman.  It is these posts that exuded tabloid-esque 
slimy

nastiness.

I am sure that Ross and Robert would never dream of failing to give 
credit
where credit is due and it is almost certainly the case that they 
explained
the origins of R in the S language to the writer of the NYT article 
(wherefrom

the explanation was cut in the editing process).

Those of us on this list (with the possible exception of one or two 
nutters)
would take it that it goes without saying that R was developed on the 
basis
of S --- we all ***know*** that.  To impugn the integrity of Ihaka 
and Gentleman,
because an article which *they didn't write* failed to mention this 
fact, is

unconscionable.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and 
confid...{{dropped:9}}


__
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 

Re: [R] A way to lock down the order of bars for ggplot dodgedhistogram

2009-02-05 Thread ONKELINX, Thierry
Dear Jason,

Convert Person to a factor with the levels in the order that you want.

Group_df$Person - factor(Group_df$Person, levels = c(Them, You, Me)) 

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
thierry.onkel...@inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more than 
asking him to perform a post-mortem examination: he may be able to say what the 
experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure 
that a reasonable answer can be extracted from a given body of data.
~ John Tukey

-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens 
Jason Rupert
Verzonden: donderdag 5 februari 2009 17:09
Aan: R-help@r-project.org
CC: ggpl...@googlegroups.com
Onderwerp: [R] A way to lock down the order of bars for ggplot 
dodgedhistogram

It appears that ggplot reorder the data for a dodged histogram based on 
whether or not a specific variable has a value in the first bin. 
 
I would like to be able to absolutely force the order of the variables in the 
bin.  For example, say I have three variables Me, You, and Them. 
 
Me_df-data.frame(Data = c(1:15), Person = Me)
You_df-data.frame(Data = c(10:20), Person = You)
Them_df-data.frame(Data = c(15:25), Person = Them)
Group_df_tmp-rbind(Me_df,You_df)
Group_df-rbind(Group_df_tmp,Them_df)
counts - ddply(Group_df, .(cut(Data, breaks=fullseq(range(Data), 5)), Person), 
nrow) 
names(counts) - c(Bin, Person, Frequency)
qplot(Person, Frequency, data = counts, fill = Person, geom=bar, 
stat=identity, width = 0.9, xlab=Person) +  facet_grid(. ~ Bin) 
 
However, I absolutely must have the bar order be Them, You, Me.   Is there a to 
fix the order of the bars so that they are always in the Them, You, Me order? 
 
Thank you again for any feedback you can provide.  
 
 


  
[[alternative HTML version deleted]]


Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

__
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] Chi-squared test adjusted for multiple comparisons? Harbe'stest?

2009-02-05 Thread Murray Cooper

Categorical data analysis is definitely the way you want to go.
Which test you use depends on how you are going to use the results.

For quick and dirty I would suggest using Fisher's exact test on all
2x2 submatricies of counts. In this case, with 4 treatments you have
6 possible 2x2 submatricies. See fishers.test function.

Another possibility would be a log-linear model, to model Ln(p/q).

Murray M Cooper, Ph.D.
Richland Statistics
9800 N 24th St
Richland, MI, USA 49083
Mail: richs...@earthlink.net

- Original Message - 
From: Laura Lucia Prieto Godino ll...@cam.ac.uk

To: r-help@r-project.org
Sent: Thursday, February 05, 2009 7:06 AM
Subject: [R] Chi-squared test adjusted for multiple comparisons? 
Harbe'stest?




Hi!

I have some data that looks like this
up down percentaje
uew_21 20 14 58.82
uew_20_5 27 40 40.29
uew_20 8 13 38.09
uew_19_5 17 42 28.81



So I have 4 experimental conditions and I am counting number of
animals in the up and down compartment and the calculating the
percentage, I want to know which one of the conditions is different
from each other. If the data wouldn't be percentage I would runt a
kruskal-wallis test to check for general differences and then when
significan a post-hoc test, comparing differents pairs with Man-
Whitney (wilcoxon function in R) with a bonferroni correction for
multiple comparisons. But as the data are in the percentaje form, I
know I need to analize them with either a chi squared or a g-test, but
I have no idea if I can do such a test with many comparissons or how
to do it in R, as well I have seen a paper in which they do something
similar and they are using a Harber's chi squared test. Does anybody
know how to do that in R?

Thank you  very much for your help, and thanks to the jim and chuck
for answering my previous statistical question!

Lucia

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


[R] sqlQuery problem

2009-02-05 Thread stenka1

__
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] tm Module in R

2009-02-05 Thread ryan

__
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] optimal control, maximization with several variables?

2009-02-05 Thread Ravi Varadhan
I assume that you are looking to solve, in R, the constrained optimization 
problem:

H (u1, u2) = a*u1+b*u2+c*f1(u2)+lambda*(x') 
with constraints: 0u1x, 0u2f2(x,u2)

where a, b, x, and x' are known.
 
Am I right?

If so, you can use the package Rdonlp2.  

I have written an extension of ConstrOptim that can handle nonlinear inequality 
constraints. This is another option.

Best,
Ravi.



Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvarad...@jhmi.edu


- Original Message -
From: Frederik Noack frederik.no...@gmx.de
Date: Thursday, February 5, 2009 8:47 am
Subject: [R] optimal control, maximization with several variables?
To: R-help@r-project.org


 Dear all,
  I would like to solve the following problem, which can be done with 
 optimal control theory or dynamic programming:
  
  max(x,y) a*u1+b*u2+c*f1(u2)   s.t.  0u1x, 0u2f2(x,u2),  x'=f3(u1,u2,x)
  
  which can be rewritten if optimal control theory should be applied as
  
  H=a*u1+b*u2+c*f1(u2)+lambda*(x') s.t. 0u1x, 0u2f2(x,u2)
  
  The maximum principle conditions would solve the problem.
  However in steady state conditions the system simplifies further with 
 u1=x' und lambda=a.
  Is it possible to solve this problem in R and if yes then how?
  It might be sufficient for me to maximize a simple nonlinear function
  f(x,y) w.r.t. x and y.
  Does anyone know how to do it? I tried optim and genoud but untill 
 now it did not work.
  Best wishes
  Frederik
  
  
  
  -- 
  Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
  für nur 17,95 Euro/mtl.!* 
  
  __
  R-help@r-project.org mailing list
  
  PLEASE do read the posting guide 
  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] A way to lock down the order of bars for ggplot dodgedhistogram

2009-02-05 Thread Jason Rupert
Thierry, 
 
Thank you for such a quick response. 
 
I changed the code, but I seem to get the same response.  Ugh.  Maybe I am 
missing a step.  Thank you again for any feedback. 
 
Me_df-data.frame(Data = c(1:15), Person = Me)
You_df-data.frame(Data = c(10:20), Person = You)
Them_df-data.frame(Data = c(15:25), Person = Them)
Group_df_tmp-rbind(Me_df,You_df)
Group_df-rbind(Group_df_tmp,Them_df)
Group_df$Person - factor(Group_df$Person, levels = c(Them, You, Me)) 
counts - ddply(Group_df, .(cut(Data, breaks=fullseq(range(Data), 5)), Person), 
nrow) 
names(counts) - c(Bin, Person, Frequency)
qplot(Person, Frequency, data = counts, fill = Person, geom=bar, 
stat=identity, width = 0.9, xlab=Person) +  facet_grid(. ~ Bin) 


--- On Thu, 2/5/09, ONKELINX, Thierry thierry.onkel...@inbo.be wrote:

From: ONKELINX, Thierry thierry.onkel...@inbo.be
Subject: RE: [R] A way to lock down the order of bars for ggplot 
dodgedhistogram
To: jasonkrup...@yahoo.com, R-help@r-project.org
Cc: ggpl...@googlegroups.com
Date: Thursday, February 5, 2009, 10:17 AM

Dear Jason,

Convert Person to a factor with the levels in the order that you want.

Group_df$Person - factor(Group_df$Person, levels = c(Them,
You, Me)) 

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
thierry.onkel...@inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more than
asking him to perform a post-mortem examination: he may be able to say what the
experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure
that a reasonable answer can be extracted from a given body of data.
~ John Tukey

-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens
Jason Rupert
Verzonden: donderdag 5 februari 2009 17:09
Aan: R-help@r-project.org
CC: ggpl...@googlegroups.com
Onderwerp: [R] A way to lock down the order of bars for ggplot
dodgedhistogram

It appears that ggplot reorder the data for a
dodged histogram based on whether or not a specific variable has a
value in the first bin. 
 
I would like to be able to absolutely force the order of the variables in the
bin.  For example, say I have three variables Me, You, and Them. 
 
Me_df-data.frame(Data = c(1:15), Person = Me)
You_df-data.frame(Data = c(10:20), Person = You)
Them_df-data.frame(Data = c(15:25), Person = Them)
Group_df_tmp-rbind(Me_df,You_df)
Group_df-rbind(Group_df_tmp,Them_df)
counts - ddply(Group_df, .(cut(Data, breaks=fullseq(range(Data), 5)),
Person), nrow) 
names(counts) - c(Bin, Person,
Frequency)
qplot(Person, Frequency, data = counts, fill = Person, geom=bar,
stat=identity, width = 0.9, xlab=Person) + 
facet_grid(. ~ Bin) 
 
However, I absolutely must have the bar order be Them, You, Me.   Is there
a to fix the order of the bars so that they are always in the Them, You, Me
order? 
 
Thank you again for any feedback you can provide.  
 
 


  
[[alternative HTML version deleted]]


Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd
is
door een geldig ondertekend document. The views expressed in  this message
and any annex are purely those of the writer and may not be regarded as stating

an official position of INBO, as long as the message is not confirmed by a duly

signed document.



  
[[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] Suppressing output in Garch estimation

2009-02-05 Thread Shimrit Abraham
HI,

I'm calling the garch() function several times within a for-loop and I would
like to suppress the output that the function generates. Setting
garch.control(trace = F) does not seem to help. Any suggestions on how to
solve this problem?

Thanks,

S.A.

[[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] R-help Digest, Vol 72, Issue 3

2009-02-05 Thread Charles Geyer
 Date: Mon, 2 Feb 2009 12:56:15 +0100
 From: friedrich.lei...@stat.uni-muenchen.de
 Subject: Re: [R] Problems in Recommending R
 To: thomas.petzo...@tu-dresden.de
 Cc: r-help@r-project.org r-help@r-project.org,
   user-2...@r-project.org,p...@stat.auckland.ac.nz
 Message-ID: 18822.57183.637787.426...@lxh5.stat.uni-muenchen.de
 Content-Type: text/plain; charset=iso-8859-1
 
  On Mon, 02 Feb 2009 08:44:21 +0100,
  Thomas Petzoldt (TP) wrote:
 
Hi,
you are probably right, though I must say that I like *spartanic and 
efficient* homepages and I don't think that the example given by the 
first mail is a good prototype for the R homepage. But, yes, occasional 
face lifting may be adequate.  Anti-aliasing is of course simple, but 
that's probably not the point. (And I know that there are graphics 
experts with a masters in psychology between us.)
 
So, why not a new Homepage Graphics Competition 2009? There is still 
some time until useR!2009 in Rennes:
 
http://www2.agrocampus-ouest.fr/math/useR-2009/
 
 Perhaps we should extend that to a competition for the complete design
 of the homepage?
 
 We often get emails like the first in this thread that R could do with
 an update on homepage design (I fully agree) ... but actually nobody
 volunteers to do it. Hence, we still have what I did when the
 worldwide number of R users was probably less than 1000.
 
 For technical reasons there are some conditions: the homepage is
 maintained via SVN like the R sources, so all should be plain HTML, no
 content management system etc.

For my course web pages I am now using the Perl Template Toolkit
(http://template-toolkit.org/).  This allows all the benefits of a CMS
with with none of the overhead.  On one of my web pages, such as
http://www.stat.umn.edu/geyer/5101/, all of the fritterware (headers,
navigation, contents, footers) is added by PTT.  The source is clean,
and everything is as consistent as if done by a CMS.

The process is this.

   * edit the PTT source, which contains only HTML interspersed with
 PPT commands for include navigation here and so forth.

   * bin/build in the top level directory

   * static HTML+CSS web pages are produced for the server.

Think of PTT as sort of an Sweave for web pages.

Yes, there is no handholding, but R and handholding?  Are you serious?

Since I assume the R pages wouldn't look at all like my class web pages,
I wouldn't presume to get into details yet.  But I would gladly provide
the source tree for any of my course web sites as an example for anyone
who wants to try the PTT.

 Ad frames: the main reason that I used them in the first place is to
 have the menus etc in only one file, no need for updating several
 files when a link changes. Today I would probably use iframes, but any
 other soultion is fine, too.

The best solution is NO FRAMES.  Let the PTT organize the pages.

 Another plus would be if we could use the same design for CRAN, and
 that means no server-trickery like server-side includes etc (because
 we do not control the server setup of the mirrors).

No problem.  I use basically the same design for all my class web pages.
Just copy the PTT macro definitions and edit slightly.

 
 Best,
 Fritz
 
 -- 
 ---
 Prof. Dr. Friedrich Leisch 
 
 Institut f?r Statistik  Tel: (+49 89) 2180 3165
 Ludwig-Maximilians-Universit?t  Fax: (+49 89) 2180 5308
 Ludwigstra?e 33
 D-80539 M?nchen http://www.statistik.lmu.de/~leisch
 ---
Journal Computational Statistics --- http://www.springer.com/180 
   M?nchner R Kurse --- http://www.statistik.lmu.de/R

__
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] Sweave and \Sexpr{}

2009-02-05 Thread Felipe Carrillo
Thaks Eric and Dieter:
It is working now although I still have to specify the path to Sweave.sty 
\usepackage{C:/R/R-2.8.1/share/texmf/Sweave}
and it doesn't evaluate \Sexpr{} when I simply use \usepackage{Sweave}. I 
placed Sweave.sty in the same folder where my rnw and tex file reside.


--- On Thu, 2/5/09, Eric R. er...@mcs.st-and.ac.uk wrote:

 From: Eric R. er...@mcs.st-and.ac.uk
 Subject: Re: [R] Sweave and \Sexpr{}
 To: r-help@r-project.org
 Date: Thursday, February 5, 2009, 1:03 AM
 Felipe:
 
 See Leisch's FAQ A18.  
 
 http://www.statistik.lmu.de/~leisch/Sweave/FAQ.html#x1-2A.18
 
 You likely have R2HTML loaded (likely because you are using
 Tinn-R) and that
 causes some difficulties for Sweave that are easily solved
 as described in
 the FAQ.
 
 
 
 Felipe Carrillo wrote:
  
  Hi: 
  I am trying to create a dynamic latex table using
 \Sexpr{} but it's not
  evaluating it. I also tried the example below without
 Sweave and also
  fails. I have also copied the Sweave.sty to my working
 directory but
  nothing seems to work. Do I need to have certain
 package in order to run
  \Sexpr{}?
  
  \documentclass[a4paper]{article}
  \usepackage{C:/R/R-2.8.1/share/texmf/Sweave}
  \begin{document}
  
  echo=false,results=hide=
  library(lattice)
  library(xtable)
  data(cats, package=MASS)
  @ 
  
  \section*{The Cats Data}
  
  Consider the \texttt{cats} regression example from
 Venables \ Ripley
  (1997). The data frame contains measurements of heart
 and body weight
  of \SExpr{nrow(cats)} cats
 (\Sexpr{sum(cats$Sex==F)} female,
  \Sexpr{sum(cats$Sex==M)} male).
  
  A linear regression model of heart weight by sex and
 gender can be
  fitted in R using the command
  =
  lm1 = lm(Hwt~Bwt*Sex, data=cats)
  lm1
  @ 
  Tests for significance of the coefficients are shown
 in
  Table~\ref{tab:coef}, a scatter plot including the
 regression lines is
  shown in Figure~\ref{fig:cats}.
  
  \SweaveOpts{echo=false}
  
  results=tex=
  xtable(lm1, caption=Linear regression model for
 cats data.,
  label=tab:coef)
  @ 
  
  \begin{figure}
\centering
  fig=TRUE,width=12,height=6=
  
  print(xyplot(Hwt~Bwt|Sex, data=cats,
 type=c(p, r)))
  @  
\caption{The cats data from package MASS.}
\label{fig:cats}
  \end{figure}
  \begin{center}
  \end{center}
  
  \end{document}
  
  
  Felipe D. Carrillo  
  Supervisory Fishery Biologist  
  Department of the Interior  
  US Fish  Wildlife Service  
  California, USA
  
  __
  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/Sweave-and-%5CSexpr%7B%7D-tp21841963p21847606.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.

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


[R] See source code for survplot function in Design package

2009-02-05 Thread Eleni Rapsomaniki

Dear R users,

I know one way to see the code for a hidden function, say function_x,  
is using default.function_x (e.g. summary.default). But how can I see  
the code for imported packages that have no namespace (in this case  
Design)?


Many Thanks
Eleni

__
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] Does the labpt object in the Polygons-class represent the centroid of the polygon

2009-02-05 Thread Rizzo . Michael

Hello,

I need to calculate the centroids of some spatial polygons that I have
placed into a Polygons-class object.  Is the labeling point in the
Polygons-class the centroid of the polygon?

Thank you for your help.

__
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 I get my IT department to bless R?

2009-02-05 Thread Christian Langkamp

I know on the website there are some pretty reputable sponsors of the
software who at some stage donated some (presumably significant) amount of
money out of thankfulness because some project worked and the software
helped in some way.

In order to push however the use of that software, might it not be just
simply possible to start producing a List of corporate projects where the
software was used with someone in the hierarchy saying: 
1. It helped the project (we managed to reduce the complexity, it was more
stable, flexible, ...)
2. We saved costs
3. The project actually was worth doing and wasn't just pasttime of an
employee who just hasn't realized that he is in a company now, and not
messing around at Uni

Maybe also include cases where it didn't work
1. Key personel left the project, nobody to pick up the left stuff
2. Found out that it was the wrong tool (missing features, too complex, ...)

And the moment one has a list including a couple of cases, ideally also a
case similar to the stuff one wants to do, one can move onwards in ones own
company: 'Our competitor / customer / great admired idol is doing it, why
don't we ?'

Chances are that such a list already has been started somewhere, it just
hasn't been linked properly.
-- 
View this message in context: 
http://www.nabble.com/How-do-I-get-my-IT-department-to-%22bless%22-R--tp21739359p21856976.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] Sweave and \Sexpr{}

2009-02-05 Thread Dieter Menne
Felipe Carrillo mazatlanmexico at yahoo.com writes:

 It is working now although I still have to specify the path to Sweave.sty
\usepackage{C:/R/R-2.8.1/share/texmf/Sweave}
 and it doesn't evaluate \Sexpr{} when I simply use \usepackage{Sweave}. I
placed Sweave.sty in the same
 folder where my rnw and tex file reside.

If it works, keep it. If you, like me, do not like explicit paths, either 
copy Sweave.sty to the local tex directory and update your database; in 
Miktex, this is from the settings gui.

Or add the Sweave path in share to you local tex directory (from the
same dialog, next tab).

Dieter

__
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] Numeric class and sasxport.get

2009-02-05 Thread Frank E Harrell Jr

Sebastien Bihorel wrote:
Ok, just so as I get that straight, is the 'labelled' class something 
that you created in your package or a readily available class in base R?


It's something we added for the Hmisc package.
Signing off,
Frank



*Sebastien Bihorel, PharmD, PhD*
PKPD Scientist
Cognigen Corp
Email: sebastien.biho...@cognigencorp.com 
mailto:sebastien.biho...@cognigencorp.com

Phone: (716) 633-3463 ext. 323


Frank E Harrell Jr wrote:

Sebastien Bihorel wrote:

I also realized the flaw after testing the script on various datasets...

Following up on your last note:
1- Is that the reason why the class of integer and regular numeric 
variable is solely labelled following sasxport.get?


Yes.  R gurus might correct me but just creating a numeric vector 
doesn't create a 'hard' class, add adding your own class attribute 
equal to 'numeric' or 'integer' might cause a problem downstream.



2- Can class be 'soft' for other 'kind' of variables?


Not that I can recall.

3- Would you anticipate the following wrapper function to generate 
incompatibilities with other R functions?


I'm going to beg off on that.  I'm not enough of an expert on the 
impact of adding such classes.


Frank




SASxpt.get - function(file, force.single = TRUE,
 method=c('read.xport','dataload','csv'), 
formats=NULL, allow=NULL,

 out=NULL, keep=NULL, drop=NULL, as.is=0.5, FUN=NULL) {

 foo - sasxport.get(file=file, force.single=force.single, 
method=method,

 formats=formats, allow=allow, out=out, keep=keep,
 drop=drop, as.is=as.is, FUN=FUN)

 # For each variable of class labelled (and only labelled), add 
the native class as a second class argument


 sglClassVarInd - which(lapply(lapply(unclass(foo),class),length)==1)

 for (i in 1:length(sglClassVarInd)){
   x - foo[,sglClassVarInd[i]]  if (class(x)==labelled) 
class(foo[,sglClassVarInd[i]]) - c(class(x), class(unclass(x)))

 }
 return(foo)
}


*Sebastien Bihorel, PharmD, PhD*
PKPD Scientist
Cognigen Corp
Email: sebastien.biho...@cognigencorp.com 
mailto:sebastien.biho...@cognigencorp.com

Phone: (716) 633-3463 ext. 323


Frank E Harrell Jr wrote:

Sebastien Bihorel wrote:

Thanks a lot Frank,

One last question, though. I was tempted to remove all attributes 
of my variables after the sasxport.get call using

foo - sasxport.get(...)
foo - as.data.frame(lapply(unclass(foo),as.vector))
Since I never worked with the objects of class 'labeled', I was 
wondering what I will loose by removing this attribute.


Not a good idea, for many reasons including dates and other types.

And the labelled type is need if you subset the data, in order to 
keep the labels.


Note that your original issue is related to class being soft for 
integers and regular numerics:


 x - 1:3
 attributes(x)
NULL
 class(x)
[1] integer
 x - runif(3)
 class(x)
[1] numeric
 attributes(x)
NULL

Frank



*Sebastien Bihorel, PharmD, PhD*
PKPD Scientist
Cognigen Corp
Email: sebastien.biho...@cognigencorp.com 
mailto:sebastien.biho...@cognigencorp.com

Phone: (716) 633-3463 ext. 323


Frank E Harrell Jr wrote:

sebastien.biho...@cognigencorp.com wrote:
The problem is actually not related to a broken command but a 
attempt of
operational qualification of R. A few years ago, my company 
developed a

set of scripts for the 'operational qualification' of Splus. We are
switching to R so I am currently trying to port the scripts to R.
All Splus scripts imported SAS data using the importData 
function, which I
substituted by sasxport.get. One particular script returns the 
class of

each variable of the imported data frame; the output must match the
expected values: numeric, factor, integer, etc... The R 
'translation' with

sasxport.get is thus problematic.
If there is no easy tweak of the function, we will probably have 
to remove

this script from our list of 'qualification' scripts.

Although it would be nice


Then my advice is to write your own wrapper function for 
sasxport.get that takes its output, looks for labelled variables, 
and adds a new class of your choosing depending on properties of 
the variable, making sure that you write methods needed for that 
class (if any).  Then test your new function, not sasxport.get 
explicitly.


Frank




Sebastien Bihorel wrote:

Frank,

It is a non existing issue for me if the variables of class 
labelled

(and only labelled) can only be numerical variables (integer or
numeric).

Sebastien

'labelled' can apply to any type of vector.  I'm not clear on the
problem this causes you.  Please provide a command that is 
broken by

this behavior.

Frank


Frank E Harrell Jr wrote:

Sebastien Bihorel wrote:

Dear R-users,

The sasxport.get function (from the Hmisc package) automatically
defines the class of imported variables. I have noticed that the
class of theoretically numeric variables is simply labelled,
although character variables might end up been defined as 
labelled

Date or labelled factor.

[R] ThinkCell type waterfall charts in R?

2009-02-05 Thread Millo Giovanni
Hello Kerstin, 

I had done something like this in the past but can't find it any more,
so I've put up a very raw example you might want to sophisticate upon. 
The idea is that of drawing an empty high-level plot and then putting
some low-level elements (mainly bars and connecting lines) into it
according to the coordinates of the data. Attached below, I hope it
helps and avoids you the sin of importing ppt charts into LaTeX
(aaargh!). 

PS The 'grid' package can help you produce more sophisticated (possibly
more corporate-like, if this is a virtue...) graphs while retaining
the level of automation possible with R: e.g., for using Sweave for
automatic report generation. I'm sending you some examples by separate
mail. 

Best,
Giovanni

examples:  cascadeplot(rnorm(10)); cascadeplot(c(3,2,-7,5,8,3,-9,10))

cascadeplot - function(x, barwidth=2, barspace=1,
colpalette=rep(grey(0.5), length(x)),
linecol=orange, ...) {
## how many bars? one for each data point
barnum - length(x)

## total graph width
grw - (barnum+1)*barspace+barnum*barwidth

## graph height
l.grh - min(cumsum(x),0)
u.grh - max(cumsum(x))+1

## draw an empty plot with the required dims
## (passing on any graphic parm you like, e.g. 'title')
plot(0:grw, ylim=c(l.grh,u.grh), xlim=c(0,grw), type=n, ...)

## draw x axis
lines(c(0,grw), c(0,0), col=blue)

## init vector (this will be useful later)
ytxtpos - rep(NA, length(x))

## for each data point draw a polygon
## starting from the level reached by the
## previous bar

for(i in 1:length(x)) {
## each bar has 4 verices, abcd
## x coordinates for them:
## left vertices: ab, right: cd
## so bars are drawn like a-b-c-d
leftx - barspace+(barspace+barwidth)*(i-1)
rightx - leftx+barwidth
xcoo - c(leftx, leftx, rightx, rightx)
## y coord.:
## lower y:
if(i==1) {
lowy - 0
} else {
lowy - cumsum(x)[i-1]
}
highy - cumsum(x)[i]
ycoo - c(lowy, highy, highy, lowy)
polygon(xcoo, ycoo, col=colpalette[i], ...)

## now draw the connecting lines between
## the current and the previous bar
if(i  1) {
lines(x=c(leftx-barspace,leftx),
  y=c(lowy,lowy),
  col=linecol)
}

## save top-bar position for label
ytxtpos[i] - max(lowy, highy)+0.05*(u.grh-l.grh)
}

## lastly, put the values on top of the bars
xtxtpos - (1:length(x))*(barwidth+barspace)-barwidth/2
text(xtxtpos,ytxtpos,labels=as.character(x))
}



## original message below
--

Message: 157
Date: Tue, 03 Feb 2009 11:30:51 +0100
From: Kerstin kerstin.ba...@open-innovation-projects.org
Subject: Re: [R] ThinkCell type waterfall charts in R?
To: Jim Lemon j...@bitwrit.com.au
Cc: r-help@r-project.org
Message-ID: 49881cdb.3090...@open-innovation-projects.org
Content-Type: text/plain; charset=iso-8859-1; Format=flowed

Jim Lemon wrote:
 Kerstin wrote:
 Hi all,

 with PowerPoint and ThinkCell one can draw something they call
 waterfall chart and it looks like this:
 http://www.think-cell.com/products/images/waterfall.gif

 I found discussions on waterfall charts in the archive of this
 mailinglist, but unfortunately they looked totally different. Other 
 names for this type of plot seem to be bridge chart, cascade chart, 
 stair case chart, etc. but neither of them brought successful 
 results. So I decided to ask you directly on the list.

 Does anyone have an idea on how I could plot this type of chart in R?
 Well Kirsten, it's a real challenge trying to find something that you
 _can't_ plot in R. Perhaps if you sent some data to the mailing list 
 and a description of how the various counts (?) are related to one 
 another, some R-nut may reply with what you want.

 Jim
Thanks a lot for your quick reply.

In the attached pdf you can see the chart I would like to draw with R. I

could of course make my life easier and use the Power Point chart, but 
importing a ppt chart into Latex would not make me sleep very well, 
besides the fact that all other plots in my document will come from R 
and I don't want this one to look totally different...

Cheers
Kerstin

-- next part --
A non-text attachment was scrubbed...
Name: Waterfall.pdf
Type: application/pdf
Size: 9761 bytes
Desc: not available
URL:
https://stat.ethz.ch/pipermail/r-help/attachments/20090203/6b6e3787/att
achment-0001.pdf

--


Giovanni Millo
Research Dept.,
Assicurazioni Generali SpA
Via Machiavelli 4, 
34132 Trieste (Italy)
tel. +39 040 671184 
fax  +39 040 671160

Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:13}}

__
R-help@r-project.org mailing list

[R] liknage analysis

2009-02-05 Thread Federico Calboli
Dear All,

is there a package in R that implements parametric and non parametric  
genetic linkage analysis (with both case/control or quantitative  
phenos)? I tried using Merlin, which could not deal with pedigrees the  
size I have, and SimWalk2 does not look like the answer either --for  
instance I do not have a recombination map, just a position map and I  
doubt SW2 would like that.

I had a look in the archives and on CRAN but nothing popped out as  
being the R equivalent of linkage analysis software (though I just had  
a quick look).

Best,

Federico

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

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

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




[[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] Non-linear optimisation

2009-02-05 Thread ehxpieterse

Hi there,

I have a piece of Matlab code I use to optimise a trding strategy. If there
are any Matlab/R specialists out there, I would appreciate your help in
doing the exact same optimisation in R.

I suspect I would use nlm() in R but am not sure where to define my
constraints.

I have attached my Matlab code below for reference.

Many thanks.

Constraints
function [c,ceq]=TriskellConstraints(X)
global objFunc_vol;
[a,b] = objFunc_vol(X);
c(1) = b-6.5;
c(2) = std(X(:))-6.5;
ceq = [];
end

Optimise
global objFunc_vol
objFunc_vol = @(C) compute_strategy_before_fees(prices, C, floor, cap,
m_ret_reb, prices_TR, hedge_fund, vg, euribor, last_reb_date, Maturity,
fixed_fees, var_fees);

objFunc_vol(C);

objFunc = @(C) compute_strategy_before_fees(prices, C, floor, cap,
m_ret_reb, prices_TR, hedge_fund, vg, euribor, last_reb_date, Maturity,
fixed_fees, var_fees);

objFunc(C);

options = optimset('MaxIter',1000,'MaxFunEvals',1000);

tic;

% OPTIMISE

%M =
fmincon(objFunc,C,[],[],[],[],repmat(-20,12,9),repmat(20,12,9),@TriskellConstraints,options);
M =
fmincon(objFunc_vol,C,[],[],[],[],repmat(-20,12,9),repmat(20,12,9),@TriskellConstraints,options);
[Z, ZZ] = compute_strategy_after_fees(prices, C, floor, cap, m_ret_reb,
prices_TR, Hedge_Fund, vg, euribor, last_reb_date, Maturity, fixed_fees,
var_fees, dates, variation_cap_property, eurusd);
[Y, YY] = compute_strategy_after_fees(prices, M, floor, cap, m_ret_reb,
prices_TR, Hedge_Fund, vg, euribor, last_reb_date, Maturity, fixed_fees,
var_fees, dates, variation_cap_property, eurusd);

timespent = toc/60; %converts to minutes


-- 
View this message in context: 
http://www.nabble.com/Non-linear-optimisation-tp21856818p21856818.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] Reading images

2009-02-05 Thread gabo
Hi

Can anyone tell me how to convert an image file (a jpg file for instance)
into a matrix file?

The command image(blabla) transforms a matrix into an image file, I am
searching exactly the inverse.

Thanks...

[[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] See source code for survplot function in Design package

2009-02-05 Thread Dieter Menne
Eleni Rapsomaniki e.rapsomaniki at mail.cryst.bbk.ac.uk writes:

 I know one way to see the code for a hidden function, say function_x,  
 is using default.function_x (e.g. summary.default). But how can I see  
 the code for imported packages that have no namespace (in this case  
 Design)?

Just type the name without ()

library(Design)
Surv


For namespaces, you might also try 

getAnywhere(myfunctioname)

But note that what you see is the bare-bones codes, not the source.
To see comments, for example, better download the code from CRAN,
e.g. from:

http://cran.at.r-project.org/web/packages/abind/index.html


Dieter

__
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] See source code for survplot function in Design package

2009-02-05 Thread Frank E Harrell Jr

Eleni Rapsomaniki wrote:

Dear R users,

I know one way to see the code for a hidden function, say function_x, is 
using default.function_x (e.g. summary.default). But how can I see the 
code for imported packages that have no namespace (in this case Design)?


Many Thanks
Eleni


 methods(survplot)
[1] survplot.Design
[2] survplot.residuals.psm.censored.normalized
[3] survplot.survfit

Type any one of those function names to see the full code.  Or go to 
http://biostat.mc.vanderbilt.edu/cgi-bin/viewvc.cgi/Design/trunk/ as 
detailed in the home page for Design: 
http://biostat.mc.vanderbilt.edu/s/Design


Frank



__
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] See source code for survplot function in Design package

2009-02-05 Thread Marc Schwartz
on 02/05/2009 10:54 AM Eleni Rapsomaniki wrote:
 Dear R users,
 
 I know one way to see the code for a hidden function, say function_x, is
 using default.function_x (e.g. summary.default). But how can I see the
 code for imported packages that have no namespace (in this case Design)?
 
 Many Thanks
 Eleni

The easiest way is probably to use getAnywhere():

library(Design)

 getAnywhere(survplot)
A single object matching ‘survplot’ was found
It was found in the following places
  package:Design
with value

function (fit, ...)
UseMethod(survplot)


This tells you that the function is in package Design and has certain
dispatch methods associated with it. There is also the absence of any
indication of a namespace being present.

The next step would be:

 methods(survplot)
[1] survplot.Design
[2] survplot.residuals.psm.censored.normalized
[3] survplot.survfit

which tells you which methods are present for the function. Note also
that there is no 'default' method.

Note that the methods for survplot() are not hidden within a namespace,
as they would normally be followed by a '*' in the output of methods().
Had this been the case, you could use:

  Design:::survplot.Design


Thus, you can just use:

 survplot.Design
function (fit, ..., xlim, ylim = if (loglog) c(-5, 1.5) else if (what ==
survival  missing(fun)) c(0, 1), xlab, ylab, time.inc,
what = c(survival, hazard), type = c(tsiatis, kaplan-meier),
conf.type = c(log-log, log, plain, none), conf.int = FALSE,
conf = c(bars, bands), add = FALSE, label.curves = TRUE,
abbrev.label = FALSE, lty, lwd = par(lwd), col = 1, adj.subtitle,
loglog = FALSE, fun, n.risk = FALSE, logt = FALSE, dots = FALSE,
dotsize = 0.003, grid = FALSE, srt.n.risk = 0, sep.n.risk = 0.056,
adj.n.risk = 1, y.n.risk, cex.n.risk = 0.6, pr = FALSE)
{
what - match.arg(what)
if (.R.)
ylim - ylim
type - match.arg(type)
conf.type - match.arg(conf.type)
conf - match.arg(conf)
psmfit - inherits(fit, psm) || (length(fit$fitFunction) 
any(fit$fitFunction == psm))
if (what == hazard  !psmfit)
stop(what=\hazard\ may only be used for fits from psm)
if (what == hazard  conf.int  0) {
warning(conf.int may only be used with what=\survival\)
conf.int - FALSE
}
...


and the same for the other methods for the function.

In general, for methods that are within a namespace, you can use:

  namespace:::function.method

or:

  getAnywhere(function.method)


See ?getAnywhere and ?methods

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.


Re: [R] Target Plot?

2009-02-05 Thread Jason Rupert
I had a bit of problems with my email, so if any one responded to this I may 
have not received it.  
 
Is there any chance you can repost any ideas you might have? 
 
Right now I am looking at the plotrix package, but I have not been able to put 
together what I'm looking for. 
 
Thank you again for your feedback and insights. 

--- On Tue, 2/3/09, Jason Rupert jasonkrup...@yahoo.com wrote:

From: Jason Rupert jasonkrup...@yahoo.com
Subject: [R] Target Plot?
To: r-help@r-project.org
Date: Tuesday, February 3, 2009, 7:00 PM

I've done a little snooping around the R Gallery Site
(http://addictedtor.free.fr/graphiques/) and the Statistics with R
site (http://zoonek2.free.fr/UNIX/48_R/all.html), but I can't seem to find
what I'm looking for.  

Here is the type of plot I would like to draw:
(1) 2-D three axis plot where each axis is separated by 120-degrees (would be
great if the number of axis was configurable)
(2) Would like the value at the origin of the axis to be configurable, and then
have each axis to be increasing equally out from the origin, e.g. have the
origin have a value of 0.5 and each axis increase from there
(3) Would then like to be able to lay concentrically increasing circles over
the axis so that they intersect each axis 
(4) Data values would only lye on the axis.  

I would like to put together this plot to show how far each variable is from
the target variable, so I'm thinking this would be a target plot where the
value of the target would be configurable.  (I guess normalization would have
similar result, but I would like to show the actual values.)

I guess the result would look kind of like a dart board or something similar. 

Thank you for any insights that can be provided, especially if something like
this already exist.  






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



  
[[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] See source code for survplot function in Design package

2009-02-05 Thread David M Smith
Uwe Ligges actually had a nice write-up on finding source code for functions
like this in R-news a couple of years ago.  You can find it here:
http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf (see p44)

There are some other tips for finding R source code here:

http://blog.revolution-computing.com/2009/02/finding-the-source.html

# David Smith

On Thu, Feb 5, 2009 at 2:10 PM, Dieter Menne
dieter.me...@menne-biomed.dewrote:

 Eleni Rapsomaniki e.rapsomaniki at mail.cryst.bbk.ac.uk writes:

  I know one way to see the code for a hidden function, say function_x,
  is using default.function_x (e.g. summary.default). But how can I see
  the code for imported packages that have no namespace (in this case
  Design)?

 Just type the name without ()

 library(Design)
 Surv


 For namespaces, you might also try

 getAnywhere(myfunctioname)

 But note that what you see is the bare-bones codes, not the source.
 To see comments, for example, better download the code from CRAN,
 e.g. from:

 http://cran.at.r-project.org/web/packages/abind/index.html


 Dieter

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




-- 
David M Smith da...@revolution-computing.com
Director of Community, REvolution Computing www.revolution-computing.com
Tel: +1 (206) 577-4778 x3203 (Seattle, USA)

[[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] Non-linear optimisation

2009-02-05 Thread Ravi Varadhan
Hi,

I don't understand your Matlab code.  However, let me say this:

 - you could use L-BFGS-B algorithm in optim() or nlminb(), if you only have 
box constraints

 - you could use ConstrOptim(), if you only have linear inequality constraints

 - you could use Rdonlp2 if you have more general equality/inequality 
constraints

Best,
Ravi.



Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvarad...@jhmi.edu


- Original Message -
From: ehxpieterse eduard.piete...@macquarie.com
Date: Thursday, February 5, 2009 2:03 pm
Subject: [R]  Non-linear optimisation
To: r-help@r-project.org


  Hi there,
  
  I have a piece of Matlab code I use to optimise a trding strategy. If 
 there
  are any Matlab/R specialists out there, I would appreciate your help 
 in
  doing the exact same optimisation in R.
  
  I suspect I would use nlm() in R but am not sure where to define my
  constraints.
  
  I have attached my Matlab code below for reference.
  
  Many thanks.
  
  Constraints
  function [c,ceq]=TriskellConstraints(X)
  global objFunc_vol;
  [a,b] = objFunc_vol(X);
  c(1) = b-6.5;
  c(2) = std(X(:))-6.5;
  ceq = [];
  end
  
  Optimise
  global objFunc_vol
  objFunc_vol = @(C) compute_strategy_before_fees(prices, C, floor, cap,
  m_ret_reb, prices_TR, hedge_fund, vg, euribor, last_reb_date, Maturity,
  fixed_fees, var_fees);
  
  objFunc_vol(C);
  
  objFunc = @(C) compute_strategy_before_fees(prices, C, floor, cap,
  m_ret_reb, prices_TR, hedge_fund, vg, euribor, last_reb_date, Maturity,
  fixed_fees, var_fees);
  
  objFunc(C);
  
  options = optimset('MaxIter',1000,'MaxFunEvals',1000);
  
  tic;
  
  % OPTIMISE
  
  %M =
  
 fmincon(objFunc,C,[],[],[],[],repmat(-20,12,9),repmat(20,12,9),@TriskellConstraints,options);
  M =
  
 fmincon(objFunc_vol,C,[],[],[],[],repmat(-20,12,9),repmat(20,12,9),@TriskellConstraints,options);
  [Z, ZZ] = compute_strategy_after_fees(prices, C, floor, cap, m_ret_reb,
  prices_TR, Hedge_Fund, vg, euribor, last_reb_date, Maturity, fixed_fees,
  var_fees, dates, variation_cap_property, eurusd);
  [Y, YY] = compute_strategy_after_fees(prices, M, floor, cap, m_ret_reb,
  prices_TR, Hedge_Fund, vg, euribor, last_reb_date, Maturity, fixed_fees,
  var_fees, dates, variation_cap_property, eurusd);
  
  timespent = toc/60; %converts to minutes
  
  
  -- 
  View this message in context: 
  Sent from the R help mailing list archive at Nabble.com.
  
  __
  R-help@r-project.org mailing list
  
  PLEASE do read the posting guide 
  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] seq(along= surprise

2009-02-05 Thread Kjetil Halvorsen
This surprised me:

 reps - 100
 sims - list(length=reps)
 sims
$length
[1] 100

 for(i in seq(along=sims))print(i)
[1] 1


This is R 2.8.1.

Kjetil

[[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] Unexpected mfrow, layout behavior (pdf still has multiple pages)

2009-02-05 Thread Paul Johnston
You are correct, thank you. I added a new subsection 'Graphics
Devices' in http://wiki.r-project.org/rwiki/doku.php?id=tips:surprises:traps
to document this behavior.

Paul

On Thu, Feb 5, 2009 at 4:58 AM, Peter Dalgaard p.dalga...@biostat.ku.dk wrote:
 Paul Johnston wrote:
 My goal is to create a graph with one column and three rows into a
 single graphic. The mfrow, mfcol, and layout functions all have the
 same effect: three graphs are produced in a single pdf file, having
 one graph per page.  This is not what I want (I didn't want multiple
 pages).  Just before I sent this post, I was able to generate the
 desired output with split.screen.  Is this the expected behavior of
 mfrow and layout?

 If you call them before opening the device, then yes, they will not
 affect that device, but presumably some other device...

-p


 Paul

 

 My code is as follows (ToruosityPlot and DiameterPlot are essentially
 identical to LDRPlot).

 layout(matrix(1:3, ncol=1))
 #par(mfrow=c(3,1))

 pdf(results.pdf, width=4, height=3, pointsize=4, colormodel=cmyk,
 onefile=TRUE)

 TortuosityPlot(left, right)
 DiameterPlot(left, right)
 LDRPlot(left, right)

 dev.off()

 LDRPlot - function(left, right)
   {
 plot(left$x, left$LDR, bty=n, ann=FALSE, xlim=c(-1500, 1000),
 ylim=c(1.0, 1.5))
 abline(v=0, col=gray(.90))
 lines(left$x, left$LDR, col=green4, lty=solid)
 points(left$x, left$LDR, bg=limegreen, pch=21)
 lines(right$x, right$LDR, col=blue4, lty=dashed)
 points(right$x, right$LDR, bg=blue, pch=21)
 #title(main=LDR, xlab=Distance (um), ylab=LDR,
 col.main=black, col.lab=gray(.4), cex.main=1.2, cex.lab=1.0,
 font.main=4, font.lab=3)
   }


 platform   i386-apple-darwin8.11.1
 arch   i386
 os darwin8.11.1
 system i386, darwin8.11.1
 status
 major  2
 minor  8.1
 year   2008
 month  12
 day22
 svn rev47281
 language   R
 version.string R version 2.8.1 (2008-12-22)

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


 --
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907



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


Re: [R] lattice key inside panel

2009-02-05 Thread Dieter Menne
Deepayan Sarkar deepayan.sarkar at gmail.com writes:

  One other thing that has so far eluded me is how to specify two
  different kinds of symbols on a single column. The key above shows
 
  text line text rectangle
 
  but I would really like to get
 
  text line
  text rectangle
 
  but this did not seem possible to me. Am I wrong?
 
 Not possible with draw.key(), but legends can be arbitrary grobs, so
 you could construct a suitable one.

I would have guessed that columns=2 would work, but you are right,
it given an error message (Not enough rows for columns). Why?

Dieter

xyplot(1~1,
   panel = function(...) {
   require(grid)
   panel.xyplot(...)
   draw.key(list(text=list(lab='catch'),
 columns=2,
 lines=list(lwd=c(2)),
 text=list(lab='landings'),
 rectangles=list(col=rgb(0.1, 0.1, 0, 0.1))),
  draw = TRUE,
  vp = viewport(x = unit(0.75, npc), y = unit(0.9, npc)))
   })

__
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] Reading images

2009-02-05 Thread Sarah Goslee
There's lots of info in the mailing list archives on this topic - 2 minutes with
google would have gotten you to read.jpeg and saved you some time.

Sarah

On Thu, Feb 5, 2009 at 1:01 PM, gabo gabriel.31...@gmail.com wrote:
 Hi

 Can anyone tell me how to convert an image file (a jpg file for instance)
 into a matrix file?

 The command image(blabla) transforms a matrix into an image file, I am
 searching exactly the inverse.

 Thanks...


-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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] maptools: Test if point is in polygon

2009-02-05 Thread Renaud Lancelot
See function pip (point in polygon) in package splancs.

Renaud

2009/2/5 Rainer M Krug r.m.k...@gmail.com

 On Thu, Feb 5, 2009 at 3:21 PM, Aleksandr Andreev
 aleksandr.andr...@gmail.com wrote:
  In R's maptools package, is there a built-in function to test if a
  given point is inside a given polygon on the map?  The map was
  loaded from an ESRI Shapefile. The point's latitude and longitude are
  known.

 If everything else fails, convert the shape file into a raster and
 drill down at the location of the points.

 Rainer

 
  Thank you!
 
  Aleks
 
  --
  
  Aleksandr Andreev
  Fulbright Fellow
  Graduate School of Management
  St Petersburg State 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.
 



 --
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
 Biology, UCT), Dipl. Phys. (Germany)

 Centre of Excellence for Invasion Biology
 Faculty of Science
 Natural Sciences Building
 Private Bag X1
 University of Stellenbosch
 Matieland 7602
 South Africa

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




-- 
Renaud LANCELOT
Département Systèmes Biologiques du CIRAD
CIRAD, Biological Systems Department

Campus International de Baillarguet
TA 30 / B
F34398 Montpellier
Tel   +33 (0)4 67 59 37 17
Secr. +33 (0)4 67 59 37 37
Fax   +33 (0)4 67 59 37 95

[[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] seq(along= surprise

2009-02-05 Thread Uwe Ligges



Kjetil Halvorsen wrote:

This surprised me:


reps - 100
sims - list(length=reps)
sims

$length
[1] 100


for(i in seq(along=sims))print(i)

[1] 1

This is R 2.8.1.



What is surprising?

sims is now a list that contains 1 element called length with a 
numeric value of 100.

Then seq(along=sims) is exactly 1, because sims has length 1.
Hence i is printed once (1 iteration of the loop) and is 1 in the first 
(and only) iteration.


Uwe




Kjetil

[[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] Reading images

2009-02-05 Thread Jorge Ivan Velez
Hi there,
Take a look at this:
http://hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/rimage/html/read.jpeg.html

HTH,

Jorge


On Thu, Feb 5, 2009 at 1:01 PM, gabo gabriel.31...@gmail.com wrote:

 Hi

 Can anyone tell me how to convert an image file (a jpg file for instance)
 into a matrix file?

 The command image(blabla) transforms a matrix into an image file, I am
 searching exactly the inverse.

 Thanks...

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


[[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] Legend for radial.plot?

2009-02-05 Thread Jason Rupert
Using plotrix, is it possible to create a legend for the following and attach 
it to the radial.plot?
 
posmat-matrix(sample(2:9,30,TRUE),nrow=3)
 radial.plot(posmat,labels=paste(X,1:10,sep=),rp.type=p,
  main=Spiderweb plot,line.col=2:4,show.grid=FALSE,lwd=1:3,
  radial.lim=c(0,10))

 
Thanks.


  
[[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] seq(along= surprise

2009-02-05 Thread Uwe Ligges



Uwe Ligges wrote:



Kjetil Halvorsen wrote:

This surprised me:


reps - 100
sims - list(length=reps)
sims

$length
[1] 100


for(i in seq(along=sims))print(i)

[1] 1

This is R 2.8.1.



What is surprising?

sims is now a list that contains 1 element called length with a 
numeric value of 100.

Then seq(along=sims) is exactly 1, because sims has length 1.
Hence i is printed once (1 iteration of the loop) and is 1 in the first 
(and only) iteration.


Uwe


I should have added that you probably want

sims - vector(mode=list, length=100)

Uwe






Kjetil

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


[R] pdata.frame for panel data

2009-02-05 Thread ele . fanti
Hi there,

as a newbie in R I have a question on the plm package for panel data:

How do I actually manage to get data into the pdata.frame format?
i.e. how do I declare id and time? I already tried various things and got even 
more error messages. for example

 country - 
 c(AGO,BWA,DRC,LSO,MDG,MWI,MUS,MOZ,NAM,SYC,ZAF,SWZ,TZA,ZMB,ZWE)
 time1 - c(1991:2006)
 pdata.frame(EMPR1,id=country,time=time1)
serie SYC  is NA and has been removed
Fehler in (function(x, i) if (is.matrix(i)) as.matrix(x)[[i]] else .subset2(x,  
: 
rekursives Indizieren auf Level 2 fehlgeschlagen

where EMPR is a data.frame with 16 rows (time) and 15 columns (countries).

Thank you,
Kirsten
-- 


--

__
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] seq(along= surprise

2009-02-05 Thread baptiste auguie

Perhaps this is what was intended?



sims - list(length=100)



do.call(seq, sims)


seq by itself does not expect a list, but do.call() can create the  
appropriate call if a list is what you want to pass to the function.


Hope this helps,

baptiste

On 5 Feb 2009, at 19:46, Uwe Ligges wrote:




Uwe Ligges wrote:



Kjetil Halvorsen wrote:

This surprised me:


reps - 100
sims - list(length=reps)
sims

$length
[1] 100


for(i in seq(along=sims))print(i)

[1] 1

This is R 2.8.1.



What is surprising?

sims is now a list that contains 1 element called length with a
numeric value of 100.
Then seq(along=sims) is exactly 1, because sims has length 1.
Hence i is printed once (1 iteration of the loop) and is 1 in the  
first

(and only) iteration.

Uwe


I should have added that you probably want

sims - vector(mode=list, length=100)

Uwe






Kjetil

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


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

__
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] Incorrect p value for binom.test?

2009-02-05 Thread Michael Grant
I believe the binom.test procedure is producing one tailed p values
rather than the two tailed value implied by the alternative hypothesis
language.  A textbook and SAS both show 2*9.94e-07 = 1.988e-06 as the
two tailed value.  As does the R summation syntax from R below.  It
looks to me like the alternative hypothesis language should be revised
to something like  ... greater than or equal to ...  Am I mistaken?

 

M.C.Grant

 

 2*sum(dbinom(c(10:25),25,0.061))

[1] 1.987976e-06

 

 binom.test(10,25,0.061)

 

Exact binomial test

 

data:  10 and 25 

number of successes = 10, number of trials = 25, p-value = 9.94e-07

alternative hypothesis: true probability of success is not equal to
0.061 

95 percent confidence interval:

 0.2112548 0.6133465 

sample estimates:

probability of success 

   0.4


[[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] pdata.frame for panel data

2009-02-05 Thread ele . fanti
Hi there,

as a newbie in R I have a question on the plm package for panel data:

How do I actually manage to get data into the pdata.frame format?
i.e. how do I declare id and time? I already tried various things and got even 
more error messages. for example

 country - 
 c(AGO,BWA,DRC,LSO,MDG,MWI,MUS,MOZ,NAM,SYC,ZAF,SWZ,TZA,ZMB,ZWE)
 time1 - c(1991:2006)
 pdata.frame(EMPR1,id=country,time=time1)
serie SYC  is NA and has been removed
Fehler in (function(x, i) if (is.matrix(i)) as.matrix(x)[[i]] else .subset2(x,  
: 
rekursives Indizieren auf Level 2 fehlgeschlagen

where EMPR is a data.frame with 16 rows (time) and 15 columns (countries).

Thank you,
Kirsten
--

__
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] R system command on windows

2009-02-05 Thread Aurelie Labbe, Dr.
Hi,
 
I am trying to use the R command system  under windows (XP). If I try the 
simple command system(mkdir toto) to create a directory toto, it tells me 
that it cannot find the command mkdir...
Does anybody knows how  it works ? Is it a path problem ? Maybe the answer is 
simple: I am a R user under Unix/Linux and I don't know well R under windows.
 
Thanks !
Aurelie

__
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] R command system under Windows

2009-02-05 Thread Aurelie Labbe, Dr.
Hi,
 
I am trying to use the R command system  under windows (XP). If I try the 
simple command system(mkdir toto) to create a directory toto, it tells me 
that it cannot find the command mkdir...
Does anybody knows how  it works ? Is it a path problem ? Maybe the answer is 
simple: I am a R user under Unix/Linux and I don't know well R under windows.
 
Thanks !
Aurelie

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


Re: [R] R system command on windows

2009-02-05 Thread Uwe Ligges



Aurelie Labbe, Dr. wrote:

Hi,
 
I am trying to use the R command system  under windows (XP). If I try the simple command system(mkdir toto) to create a directory toto, it tells me that it cannot find the command mkdir...

Does anybody knows how  it works ? Is it a path problem ? Maybe the answer is 
simple: I am a R user under Unix/Linux and I don't know well R under windows.




See ?system which tells you to execute the Windows command shell 
(cmd.exe) which is required to run mkdir or easier, just use the wrapper 
function shell() as in:

shell(mkdir toto)

Uwe Ligges





Thanks !
Aurelie

__
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] R system command on windows

2009-02-05 Thread Stephan Kolassa

?shell

HTH,
Stephan

Aurelie Labbe, Dr. schrieb:

Hi,
 
I am trying to use the R command system  under windows (XP). If I try the simple command system(mkdir toto) to create a directory toto, it tells me that it cannot find the command mkdir...

Does anybody knows how  it works ? Is it a path problem ? Maybe the answer is 
simple: I am a R user under Unix/Linux and I don't know well R under windows.
 
Thanks !

Aurelie

__
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] lattice key inside panel

2009-02-05 Thread Deepayan Sarkar
On Thu, Feb 5, 2009 at 11:28 AM, Dieter Menne
dieter.me...@menne-biomed.de wrote:
 Deepayan Sarkar deepayan.sarkar at gmail.com writes:

  One other thing that has so far eluded me is how to specify two
  different kinds of symbols on a single column. The key above shows
 
  text line text rectangle
 
  but I would really like to get
 
  text line
  text rectangle
 
  but this did not seem possible to me. Am I wrong?

 Not possible with draw.key(), but legends can be arbitrary grobs, so
 you could construct a suitable one.

 I would have guessed that columns=2 would work, but you are right,
 it given an error message (Not enough rows for columns). Why?

It's a warning, not an error. 'columns' are meant to spread out
multiple rows into several column blocks, but there is only one row
here.

-Deepayan


 Dieter

 xyplot(1~1,
   panel = function(...) {
   require(grid)
   panel.xyplot(...)
   draw.key(list(text=list(lab='catch'),
 columns=2,
 lines=list(lwd=c(2)),
 text=list(lab='landings'),
 rectangles=list(col=rgb(0.1, 0.1, 0, 0.1))),
  draw = TRUE,
  vp = viewport(x = unit(0.75, npc), y = unit(0.9, npc)))
   })

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


  1   2   >