Re: [R] Factored ARMA models

2013-09-19 Thread Pascal Oettli
Hello,

Please have a look at:
http://cran.r-project.org/web/views/TimeSeries.html

Regards,
Pascal



2013/9/20 Indrajit Sengupta 

> I am trying to replicate ARIMA models in R from SAS. Specifically -
> Factored ARMA models, which I can do very easily in SAS (
> http://v8doc.sas.com/sashtml/ets/chap7/sect11.htm).
>
> I would like to know if there is a way to do this in any of the R packages.
>
> Thanks in advance,
> Indrajit
>
>
> [[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.
>



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

[[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] Factored ARMA models

2013-09-19 Thread Indrajit Sengupta
I am trying to replicate ARIMA models in R from SAS. Specifically -
Factored ARMA models, which I can do very easily in SAS (
http://v8doc.sas.com/sashtml/ets/chap7/sect11.htm).

I would like to know if there is a way to do this in any of the R packages.

Thanks in advance,
Indrajit


[[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] Download data

2013-09-19 Thread Jeff Newmiller
I am sorry to hear that you are having difficulty, but your automation task is 
one that requires operating-system-specific knowledge that would be off-topic 
for this list, and web-scraping of forms really requires knowledge of web 
protocols and (in this case) Java and JavaScript that are also off-topic here. 
There exist packages in CRAN that may be helpful in your endeavor, but likely 
only if you study the appropriate subject areas outside of R first so that you 
know what you need to accomplish in detail. My quick estimation is that the 
aeso web site will be unusually difficult to extract data from, so you may need 
to pay a consultant to help you with this and/or ask the website developers if 
they support an automation mechanism that you can use.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

jcrosbie  wrote:
>Thank you for all your help. I'm still not able to figure out how
>automate
>downloads from online websites.
>
>This is a daily function to download the needed data. I would also like
>to
>be able to do this on other websites such as: 
>
>http://ets.aeso.ca/ets_web/docroot/Market/Reports/HistoricalReportsStart.html
>
>and
>
>http://www.ngx.com/?page_id=561
>
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Download-data-tp4668138p4676465.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] Averate memory usage trend

2013-09-19 Thread mohan . radhakrishnan
Hi,

I would like to understand how to draw a graph to find out the 
average memory used by a single httpd process given these details 
collected over a period of
several days. I code R but this is about a method to find an average 
memory utilization. I believe I have enough data.

How should I statistically calculate this ? 

The figures inside braces are the total httpd processes at that time. Will 
there be an error  margin if I have combined totals like this ?

Sample data :

  Private Shared RAM used   Program 
  4.0 MiB3.3 MiB7.2 MiB httpd (11)
  3.3 MiB3.0 MiB   6.3 MiB  httpd (9)
  4.2 MiB3.3 MiB  7.5 MiB   httpd (12)


Thanks,
Mohan



This e-Mail may contain proprietary and confidential information and is sent 
for the intended recipient(s) only.  If by an addressing or transmission error 
this mail has been misdirected to you, you are requested to delete this mail 
immediately. You are also hereby notified that any use, any form of 
reproduction, dissemination, copying, disclosure, modification, distribution 
and/or publication of this e-mail message, contents or its attachment other 
than by its intended recipient/s is strictly prohibited.

Visit us at http://www.polarisFT.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.


Re: [R] CRAN mirror for R in India: new one at WBUT, how do we get listed in the CRAN website?

2013-09-19 Thread David Winsemius


>From the first hit on a google search for : cran mirrors:

(Which appears to be the listing to which you aspire...)

"If you want to host a new mirror at your institution, please have a look at 
the CRAN Mirror HOWTO."

There is a link in the webpage.

And please post in plain text to Rhelp.

On Sep 19, 2013, at 2:40 PM, Abhinav Kashyap wrote:

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

David Winsemius
Alameda, CA, 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.


Re: [R] Need help to find out the name of my columns and rows in a data file

2013-09-19 Thread David Winsemius

On Sep 19, 2013, at 3:59 PM, ivanc010 wrote:

> I've been assigned homework to analyze a file. The R package is "car". The
> specific data file is "Florida."
> 
> So, I did the usual stuff:
> library(car)
> data(Florida)
> summary(Florida)
> 
> My specific assignment is to run a t-test between GORE and BUSH. (This file
> has information on the 2000 election.) 
> 
> To run my t-test, my code must be something analogues to:
> 
> t.test(case0102$Salary[case0102$Sex=="Female"],case0102$Salary[case0102$Sex=="Male"])
> 
> Unfortunately, for my Florida data I can't find the analogues titles of the
> rows and columns (i.e. Sex and Salary).

Please read the Posting Guide. Many of the participants in R-Help are academics 
and they are asking _their_ students not to post howmework questions here. The 
Posting Guide lays out the reasoning. Please read it, ... and don't expect 
replies.

> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Need-help-to-find-out-the-name-of-my-columns-and-rows-in-a-data-file-tp4676534.html
> Sent from the R help mailing list archive at Nabble.com.
> 

Nabble is NOT the archive for R-help.

-- 

David Winsemius
Alameda, CA, 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.


Re: [R] ggplot legend formatting

2013-09-19 Thread David Winsemius

On Sep 19, 2013, at 4:44 PM, Robert Lynch wrote:

> I am having trouble getting my legend to format correctly in ggplot2. A
> full description and pictures are in the ggplot google
> group.
> but the short description is that in guides(fill = guide_legend(nrow =
> 3),bycol = TRUE) changing the call to have byrow=TRUE does not change the
> plot.
> 

So this is just a crossposting? You are asked not to crosspost on the R mailing 
lists.

-- 

David Winsemius
Alameda, CA, 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.


[R] Need help to find out the name of my columns and rows in a data file

2013-09-19 Thread ivanc010
I've been assigned homework to analyze a file. The R package is "car". The
specific data file is "Florida."

So, I did the usual stuff:
library(car)
data(Florida)
summary(Florida)

My specific assignment is to run a t-test between GORE and BUSH. (This file
has information on the 2000 election.) 

To run my t-test, my code must be something analogues to:

t.test(case0102$Salary[case0102$Sex=="Female"],case0102$Salary[case0102$Sex=="Male"])
  
Unfortunately, for my Florida data I can't find the analogues titles of the
rows and columns (i.e. Sex and Salary).

Please help.



--
View this message in context: 
http://r.789695.n4.nabble.com/Need-help-to-find-out-the-name-of-my-columns-and-rows-in-a-data-file-tp4676534.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] (no subject)

2013-09-19 Thread tony toca
Many thanks, guys.

Tony


On Thu, Sep 19, 2013 at 11:28 PM, Richard Kwock wrote:

> Hi Tony,
>
> The dimnames parameter is only in the matrix() function, not in the
> as.matrix() function.
>
> #So you can do:
> A <- matrix(rbind(Fert,M), nrow = nrow(rbind(Fert,M)))
> A
>
> #This for example will allow you to name your row and colums.
> B <- matrix(rbind(Fert,M), nrow = nrow(rbind(Fert,M)), dimnames =
> list(c("r1" , "r2", "r3"), c("c1", "c2", "c3")))
> B
>
> Richard
>
>
>
> On Thu, Sep 19, 2013 at 5:39 AM, tony toca  wrote:
>
>> Dear R sages,
>>
>> I used the function rbind to combine a matrix (M) and a vector (Fert) to
>> get a new matrix (A). This was fine.
>>
>> The issue is however, that the new matrix A has as its row names the name
>> of the vector Fert, even though I set teh new vector A to have
>> dimnames=NULL. See short code below fyi.
>>
>> *Fert<-c(0,1,5)
>> *
>> *M <- matrix(0, 2, 3)
>> diag(M) <- c(0.3,0.5)
>> *
>> *A<- as.matrix(rbind(Fert,M),dimnames=NULL)
>> A*
>>
>>
>> Any insights as to how to remove the row names from the new vector would
>> be
>> greatly appreciated.
>>
>> Many thanks,
>> Tony
>>
>> [[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] (no subject)

2013-09-19 Thread Richard Kwock
Hi Tony,

The dimnames parameter is only in the matrix() function, not in the
as.matrix() function.

#So you can do:
A <- matrix(rbind(Fert,M), nrow = nrow(rbind(Fert,M)))
A

#This for example will allow you to name your row and colums.
B <- matrix(rbind(Fert,M), nrow = nrow(rbind(Fert,M)), dimnames =
list(c("r1" , "r2", "r3"), c("c1", "c2", "c3")))
B

Richard



On Thu, Sep 19, 2013 at 5:39 AM, tony toca  wrote:

> Dear R sages,
>
> I used the function rbind to combine a matrix (M) and a vector (Fert) to
> get a new matrix (A). This was fine.
>
> The issue is however, that the new matrix A has as its row names the name
> of the vector Fert, even though I set teh new vector A to have
> dimnames=NULL. See short code below fyi.
>
> *Fert<-c(0,1,5)
> *
> *M <- matrix(0, 2, 3)
> diag(M) <- c(0.3,0.5)
> *
> *A<- as.matrix(rbind(Fert,M),dimnames=NULL)
> A*
>
>
> Any insights as to how to remove the row names from the new vector would be
> greatly appreciated.
>
> Many thanks,
> Tony
>
> [[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] CRAN mirror for R in India: new one at WBUT, how do we get listed in the CRAN website?

2013-09-19 Thread Abhinav Kashyap


[[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] ggplot: stat_smooth(method='glm', ...) - plot linear predictor?

2013-09-19 Thread Michael Friendly

On 19/09/2013 6:29 PM, Ista Zahn wrote:

You need to map obs to the y axis:

p + geom_point(aes(y=obs), position=position_jitter(height=0.02, width=0))

Great. that's the magic I was missing

--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

__
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] ggplot legend formatting

2013-09-19 Thread Robert Lynch
I am having trouble getting my legend to format correctly in ggplot2. A
full description and pictures are in the ggplot google
group.
but the short description is that in guides(fill = guide_legend(nrow =
3),bycol = TRUE) changing the call to have byrow=TRUE does not change the
plot.

Thanks
Robert

[[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] Polynomial of Degree 4

2013-09-19 Thread rwnahhas
Try solve.polynomial in package polynom

Ramzi



--
View this message in context: 
http://r.789695.n4.nabble.com/Polynomial-of-Degree-4-tp4676481p4676515.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 ensure that the polygon in spatstat::owin(poly=) does not have “negative area”

2013-09-19 Thread Rolf Turner


You were nearly there.  No need to muck about with the shapefile 
business which

introduces a whole lot of sub-polygons (counties or townships I guess).

The polygon for the border of Massachusetts provided in "maps" has its 
vertices
in clockwise order and its first and last vertices identical to each 
other.  You need
to (a) reverse the direction (as you have done) and (b) remove the 
duplication.

Easiest to do (b) first:

mass.df <- with(mass.map,data.frame(x=rev(x),y=rev(y)))
mass.df <- unique(mass.df)
mass.win  <- owin(poly=mass.df)
plot(mass.win) # OM!

cheers,

Rolf Turner

P.S.  It is inadvisable to use "T" when you mean "TRUE".  Write out 
"TRUE" in
full.  (The name "T" can be over-written, leading to dangers. E.g. "T <- 
FALSE" !!!

The name "TRUE" cannot be over-written.)

R. T.

On 09/19/13 16:07, Jeff Marcus wrote:

I am a new user of the R spatstat package and am having problems creating a
polygonal observation window with owin(). Code follows:

library("maps")
library ("sp")
library("spatstat")
mass.map <- map("state", "massachusetts:main", fill=T) # This returns
a data frame includding x and y components that form a polygon of
massachusetts mainland`

mass.win <- owin(poly=data.frame(x=mass.map$x, y=mass.map$y)

  Error in if (w.area < 0) stop(paste("Area of polygon is negative -",
"maybe traversed in >wrong direction?")) : missing value where TRUE/FALSE
needed

I tried things like reversing the order of the polygon and got same error.

  mass.win <- owin(poly=data.frame(x=rev(mass.map$x), y=rev(mass.map$y)))

  Polygon contains duplicated vertices

  Polygon is self-intersecting Error in owin(poly = data.frame(x =
rev(mass.map$x), y = rev(mass.map$y))) : Polygon data contain duplicated
vertices and self-intersection

Then I figured that maybe the polygon returned by map() is not meant to be
fed to owin(). So I tried loading a massachusetts shape file (I am totally
taking guesses at this point).:

x <- readShapePoly("../Geog/OUTLINE25K_POLY") ## The shape file for
MASS, loaded from MassGIS website
mass.poly <- x <- readShapePoly("../Geog/OUTLINE25K_POLY",
force_ring=T, delete_null_obj=T) ## I got following error whether or
not I used force_ring

  mass.owin <- as(mass.poly, "owin") Checking 1006 polygons...1, Polygon 1
contains duplicated vertices [Checking polygon with 91844 edges...] 2, 3,
.. [etd 1:21:52] 10 [etd 36:12] . [etd 23:10] 20 [etd 16:59]
. [etd 13:22] 30 [etd 11:01] . [etd 9:21] 40 [etd 8:06]
. [etd 7:09] 50 [etd 6:23] . [etd 5:46] 60 [etd 5:15]
...[Checking polygon with 2449 edges...] .. [etd 4:49] 70 [etd 4:27]
. [etd 4:07] 80 [etd 3:50] . [etd 3:36] 90 [etd 3:22] .
[etd 3:11] 100 [ etc.

I got messages complaining about intersecting vertices, etc. and it failed
to build the polygon.

Some context on problem: I am trying to use functions in spatstat for
spatial relative risk calculations, i.e, the spatial ratio of denstity of
cases vs. controls. For that I need an observation window and point plot
within that window. I could cheat and make the observation window a
rectangle around massachusetts but that would presumably distort values
near the coast. In any case, I'd like to learn how to do this right for any
future work I do with this package. Thanks for any help you can provide.

Note: I cross-posted this to STack Overflow and then realized that r-help
is probably a better forum.


__
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-3.0.1 g77 errors

2013-09-19 Thread Prigot, Jonathan
Sadly, I am limited to the Solaris 10 system. I wish that I could use
Linux, the world uses it.
-- 
Jonathan M. Prigot 
Partners Healthcare Systems

On Wed, 2013-09-18 at 17:20 +0200, Simon Zehnder wrote:
> On my systems Linux Scientific and Mac OS X I use as well for the F77 the 
> gfortran compiler and this works. You could give it a trial.
> 
> Best
> 
> Simon
> 
> On Sep 18, 2013, at 3:14 PM, "Prigot, Jonathan"  wrote:
> 
> > I am trying to build R-3.0.1 on our SPARC Solaris 10 system, but it
> > fails part way through with g77 errors. Has anyone run into this? Any
> > suggestions? For what it's worth, R-2.15.1 is the last one to build
> > error free for us.
> > ===
> > Jon Prigot
> > 
> > R is now configured for sparc-sun-solaris2.10
> > 
> > Source directory:  .
> > Installation directory:/usr/local
> > 
> > C compiler:gcc -std=gnu99  -g -O2
> > Fortran 77 compiler:   g77  -g -O2
> > 
> > C++ compiler:  g++  -g -O2
> > Fortran 90/95 compiler:gfortran 
> > Obj-C compiler: 
> > 
> > Interfaces supported:  X11, tcltk
> > External libraries:readline, ICU
> > Additional capabilities:   PNG, JPEG, TIFF, NLS
> > Options enabled:   shared BLAS, R profiling
> > 
> > Recommended packages:  yes
> > 
> > make 
> > ...
> > 
> > g77 -fPIC  -g -O2 -ffloat-store -c dlamch.f -o dlamch.o
> > dlamch.f: In function `dlamch':
> > dlamch.f:89: warning:
> >   INTRINSIC  DIGITS, EPSILON, HUGE, MAXEXPONENT,
> >  ^
> > Reference to unimplemented intrinsic `DIGITS' at (^) (assumed EXTERNAL)
> > dlamch.f:89: 
> >   INTRINSIC  DIGITS, EPSILON, HUGE, MAXEXPONENT,
> >  ^
> > Invalid declaration of or reference to symbol `digits' at (^) [initially
> > seen at (^)]
> > dlamch.f:89: warning:
> >   INTRINSIC  DIGITS, EPSILON, HUGE, MAXEXPONENT,
> >  ^
> > Reference to unimplemented intrinsic `EPSILON' at (^) (assumed EXTERNAL)
> > 
> > -- 
> > Jonathan M. Prigot 
> > Partners Healthcare Systems
> > 
> > 
> > 
> > The information in this e-mail is intended only for th...{{dropped:18}}
> 
> 


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.
__
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] (no subject)

2013-09-19 Thread arun
Hi,
You can either use:
A<-as.matrix(rbind(M,Fert))
dimnames(A)<- list(NULL,NULL)
 A
# [,1] [,2] [,3]
#[1,]  0.3  0.0    0
#[2,]  0.0  0.5    0
#[3,]  0.0  1.0    5


#or
matrix(rbind(M,Fert),3,3)
A.K.

 



- Original Message -
From: tony toca 
To: r-help@r-project.org
Cc: 
Sent: Thursday, September 19, 2013 8:39 AM
Subject: [R] (no subject)

Dear R sages,

I used the function rbind to combine a matrix (M) and a vector (Fert) to
get a new matrix (A). This was fine.

The issue is however, that the new matrix A has as its row names the name
of the vector Fert, even though I set teh new vector A to have
dimnames=NULL. See short code below fyi.

*Fert<-c(0,1,5)
*
*M <- matrix(0, 2, 3)
diag(M) <- c(0.3,0.5)
*
*A<- as.matrix(rbind(Fert,M),dimnames=NULL)
A*


Any insights as to how to remove the row names from the new vector would be
greatly appreciated.

Many thanks,
Tony

    [[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] binary symmetric matrix combination

2013-09-19 Thread supernovartis
Hi Arun,

Worked perfectly, one last question how to read the matrices which have the
dollar sign?

Thanks again.


On Thu, Sep 19, 2013 at 3:46 PM, arun kirshna [via R] <
ml-node+s789695n4676510...@n4.nabble.com> wrote:

> Hi Elio,
> Try this:
> library(stringr)
>  lines1<-str_trim(gsub("\t"," ",readLines("elio.txt")))
>  lst1<-lapply(split(lines1,cumsum(lines2=="")),function(x) x[x!=""])
>
> lst2<- lapply(lst1[lapply(lst1,length)>0],function(x)
> as.matrix(read.table(text=x,row.names=1)))
> names(lst2)<- paste0("m",seq_along(lst2))
>
> lst2[1:2]
> #$m1
>  #aa5 aa10 b253 b254
> #aa50111
> #aa10   1011
> #b253   1101
> #b254   1110
> #
> #$m2
>  #   aa5 aa9 b27 b29
> #aa5   0   1   1   1
> #aa9   1   0   1   1
> #b27   1   1   0   1
> #b29   1   1   1   0
>
>
> A.K.
>
> 
> From: Elio Shijaku <[hidden 
> email]>
>
> To: arun <[hidden 
> email]>
>
> Sent: Thursday, September 19, 2013 3:27 AM
> Subject: Re: binary symmetric matrix combination
>
>
>
> Hi Arun,
>
> Please find attached the text file. Let me know if anything else is
> needed. Thanks a lot for your continuous help.
>
> Best,
>
> Elio
>
> __
> [hidden email] 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.
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://r.789695.n4.nabble.com/binary-symmetric-matrix-combination-tp4675440p4676510.html
>  To unsubscribe from binary symmetric matrix combination, click 
> here
> .
> NAML
>




--
View this message in context: 
http://r.789695.n4.nabble.com/binary-symmetric-matrix-combination-tp4675440p4676522.html
Sent from the R help mailing list archive at Nabble.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] Fitting some data to a two-exponential expression

2013-09-19 Thread Espen Hagen Blokkdal
Hi,

I have some data that should fit to a two-exponential expression, so that

I/I[1] = a1*exp(-k1*x) + a2*exp(-k2*x)

where I have scaled by the initial value of the signal, so that a1 + a2 =1.

Using the nls-function, the nls bit of the code looks like
--
# guess-values:
T2_guess = 0.4 #[s]

# Declaring input and model for NLS-fitting

rhs <- function(T2){
exp(1)**(-tau/T2)
}
frame <- data.frame(x = tau, y = Upsilon)

# non-linear square fit.
fit = nls(Upsilon~I(rhs(T2)), data = frame, start = list(T2 = T2_guess)
)

this yields the error message:
Error in nls(Upsilon ~ I(rhs(T2)), data = frame, start = list(T2 =
T2_guess)) :
  singular gradient
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

-

I have no clue what this means. Anyone who can help?

-- 
Mvh.
Espen H. Blokkdal

[[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] (no subject)

2013-09-19 Thread arun
Hi,
You don't even need as.matrix() in this case:
 A<- rbind(M,Fert)
is.matrix(A)
#[1] TRUE
 dimnames(A)<- list(NULL,NULL)
A.K.



- Original Message -
From: arun 
To: tony toca 
Cc: R help 
Sent: Thursday, September 19, 2013 5:18 PM
Subject: Re: [R] (no subject)

Hi,
You can either use:
A<-as.matrix(rbind(M,Fert))
dimnames(A)<- list(NULL,NULL)
 A
# [,1] [,2] [,3]
#[1,]  0.3  0.0    0
#[2,]  0.0  0.5    0
#[3,]  0.0  1.0    5


#or
matrix(rbind(M,Fert),3,3)
A.K.

 



- Original Message -
From: tony toca 
To: r-help@r-project.org
Cc: 
Sent: Thursday, September 19, 2013 8:39 AM
Subject: [R] (no subject)

Dear R sages,

I used the function rbind to combine a matrix (M) and a vector (Fert) to
get a new matrix (A). This was fine.

The issue is however, that the new matrix A has as its row names the name
of the vector Fert, even though I set teh new vector A to have
dimnames=NULL. See short code below fyi.

*Fert<-c(0,1,5)
*
*M <- matrix(0, 2, 3)
diag(M) <- c(0.3,0.5)
*
*A<- as.matrix(rbind(Fert,M),dimnames=NULL)
A*


Any insights as to how to remove the row names from the new vector would be
greatly appreciated.

Many thanks,
Tony

    [[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] (no subject)

2013-09-19 Thread tony toca
Dear R sages,

I used the function rbind to combine a matrix (M) and a vector (Fert) to
get a new matrix (A). This was fine.

The issue is however, that the new matrix A has as its row names the name
of the vector Fert, even though I set teh new vector A to have
dimnames=NULL. See short code below fyi.

*Fert<-c(0,1,5)
*
*M <- matrix(0, 2, 3)
diag(M) <- c(0.3,0.5)
*
*A<- as.matrix(rbind(Fert,M),dimnames=NULL)
A*


Any insights as to how to remove the row names from the new vector would be
greatly appreciated.

Many thanks,
Tony

[[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] SAR: nonlinear and linear mixed model comparison using mmSAR - package

2013-09-19 Thread Bernd Lenzner

Hello,
I have a problem trying to compare model-fit between linear and 
non-linear mixed models. I am using the mmSAR-package from Guilhaumon 
(Version 1.0) to fit different models (power, exponential, lomolino, 
weibull etc.) to my data. Besides that I am as well fitting a linear 
model to the data.

My dataset looks like this:

  as
1  21.28038 2.944439
2  21.22179 3.091042
3  22.09917 3.526361
4  21.66947 2.197225
5  21.66702 3.713572
6  21.58499 3.044522
7  22.03311 3.465736
8  22.03289 2.397895
9  22.16306 3.610918
.
.
.

with a = area estimate and s = species richness. Both variabels are log 
- transformed to reach normality and variance homogeneity.


Now I want to compare the model fit of the linear model with the fit of 
the non-linear models by using information theory. I use corrected AIC 
values to estimate model fit but when I use the "multiSAR" function from 
the mmSAR package to genereate non-linear model fit I obtain negative 
AICc values:


>mod.selection <- multiSAR(MODELS,DATA)

>mod.selection$filtOptimRes

p1 p2   p3AICc
power 1.349178e-01  9.999853e-01 0. -55.64722
expo  -1.201421e+014.856363e+000. -56.93415
negexpo 1.063781e+081.268287e-09  0. -55.64728
logist  3.762325e+003.364975e-01  6.02467719 -54.79978
ratio  -2.427444e-02 8.295920e-02  -0.01806225 -54.56568
lomolino 3.925678e+005.436657e+02 18.23351785 -54.79876
weibull3.550748e+00   2.352926e-06  4.39606412 -54.81074

on the other hand I get a positive AICc value for the linear model

>lin <- lm(log(s) ~ log(a))
>AICc(lin)

> 181.50


How do I interpret these results? Visually inspecting the regressions 
shows that the exponential regression line is almost identical to the 
linear one so I would expect that the AICc value should be somewhere in 
the same range.


Thanks for the help or suggestions.

__
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] CRAN mirror for R in India: new one at WBUT, how do we get listed in the CRAN website?

2013-09-19 Thread abhinav kashyap


[[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] lattice: double y - problem changing axis color after doubleYScale

2013-09-19 Thread Anna Zakrisson Braeunlich
Hi,

I have had some troubles using doubleYScale. No matter what I try, I cant 
manage to change the color of the y-axis in the end. I have to produce a black 
and white plot. There is also something I do not understand regarding 
fontfamilyj="serif" when using it in:
strip=strip.custom()

Maybe someone has a better idea for defining which line and dots belong to 
which y-axis when not using a colorcode than the one I had.

I have annotated my questions in the code below.

Thank you for your time!


Here is some dummy data:

Ndata <- data.frame(
  Ncellpercent = rnorm(400, mean = rep(c(14, 18, 65), each = 40),
   sd = rep(c(1, 3, 6), each = 40)),
  fyear = rep(c('2007', '2008'), each = 100*2),
  Station = sample(c('B1', 'H2', 'H3', 'H4'), 400, replace = TRUE),
  Week = sample(c('19', '21', '23', '25'), 400, replace = TRUE))

Pdata <- data.frame(
  Ppercentcell = rnorm(400, mean = rep(c(4, 17, 22), each = 40),
   sd = rep(c(0.1, 0.2, 0.4), each = 40)),
  fyear = rep(c('2007', '2008'), each = 100*2),
  Station = sample(c('B1', 'H2', 'H3', 'H4'), 400, replace = TRUE),
  Week = sample(c('19', '21', '23', '25'), 400, replace = TRUE))

SummNdata <- ddply(Ndata, .(Week, fyear, Station), summarise,
   mean = mean(Ncellpercent),
   sd = sd(Ncellpercent))
names(Pdata)
SummPdata <- ddply(Pdata, .(Week, fyear, Station), summarise,
   mean = mean(Ppercentcell),
   sd = sd(Ppercentcell))
library(lattice)
library(latticeExtra)
library(HH)

font.settings <- list( font = 1, cex = 1.2, fontfamily = "serif")

my.theme <- list(
  par.xlab.text = font.settings,
  par.ylab.text = font.settings,
  axis.text = font.settings,
  par.sub=font.settings)

plotN <- xyplot(mean ~ Week | Station*fyear,
col="black",
pch=1,
cex=1.1,
lty=1,
strip = strip.custom(bg = 'white', style=1), # why can I not 
use fontfamily="serif" here ???
key=list(text=list(c(""),
   col=c("black")),
 points=list(pch=1, lty=1, cex=1.5,
 col=c("black")),
 columns=1, border=F,
 x = 0.02, y = 0.55, corner = c(2, 2),
 title="", cex.title=1.3),
ylab = ("Nc"),
xlab="Week",
data= SummNdata,type="o",
par.settings = my.theme)
plotN
# I would like to add the standard deviations (sd) to the plot. I have tried 
some stuff,
# but for some reason, it does not seem to work. How would I go about this?


plotP <- xyplot(mean ~ Week | Station*fyear,
col="black",
pch=2,
cex=1.1,
lty=2,
strip = strip.custom(bg = 'white', style=1), # why can I not 
use fontfamily="serif" here ???
key=list(text=list(c(""),
   col=c("black")),
 points=list(pch=1, lty=1, cex=1.5,
 col=c("black")),
 columns=1, border=F,
 x = 0.2, y = 0.2, corner = c(2, 2),
 title="", cex.title=1.3),
ylab = ("Pc"),
xlab="Week",
data= SummPdata,type="o",
par.settings = my.theme)
plotP

doubleYScale(plotN, plotP, add.ylab2 = TRUE)  #Why can I not change the axis 
color by adding to this argument?

# I want the y1 and y2 axes to be defined not by color, but by shape and 
linetype.
# I have managed to draw the shapes (defined by Nc and Pc) by the y1 and y2 
axes, but I do not manage to get the lines
# though the shape - ideas?
# Alternative ways that are not based on color (I have to do this black and 
white).
# Is there possible to add shapes to the axis text? such as:
# --O-- Nc  on the left y-axis (but with lty=1: I could not do a non-dotted 
line on the keybord).

with kind regards

Anna Zakrisson Braeunlich
PhD student

Department of Ecology, Environment and Plant Sciences
Stockholm University
Svante Arrheniusv. 21A
SE-106 91 Stockholm
Sweden/Sverige

Lives in Berlin.
For paper mail:
Katzbachstr. 21
D-10965, Berlin - Kreuzberg
Germany/Deutschland

E-mail: anna.zakris...@su.se
Tel work: +49-(0)3091541281
Mobile: +49-(0)15777374888
LinkedIn: http://se.linkedin.com/pub/anna-zakrisson-braeunlich/33/5a2/51b

><º>`•. . • `•. .• `•. . ><º>`•. . • `•. .• `•. .><º>`•. . • `•. .• 
>`•. .><º>

[[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] making a wider, shorter, 4-column table instead of the narrower, longer, 2-column table I get with tm, Hmisc, and Sweave

2013-09-19 Thread Christopher W. Ryan
I think my question sort of straddles two mailing lists, texhax and
r-help. Response so far on texhax has been scant.

Using the tm package, I am tabulating the frequencies of words used by
respondents to several survey questions. I use Sweave and the Hmisc
latex() command to produce the output report. running R 2.15.2, MikTeX
2.9, on WinXP.

Here is some Rnw code to replicate the problem:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{Sweave}

\begin{document}

<>=
options(SweaveSyntax="SweaveSyntaxNoweb")
library(tm)
library(Hmisc)
@

<>=
tags <- sample(1:40, 110, replace=TRUE)
words <- paste("word", tags, sep="")
words2 <- paste(words, tags, sep="")
n <- length(words)
words3 <- paste(words2[1:(n/2)], words2[(n/2 + 1):n], sep=" ")
docs <- data.frame(words3)
# the data.frame part isn't really needed for
# this minimal example, but I include it to
# mimic my operational code
@

<>=
docs2 <- Corpus(DataframeSource(docs))
@

<>=
docs3 <- TermDocumentMatrix(docs2)
@

<>=
word.freq <- rowSums(inspect(docs3))
@

<>=
latex(sort(word.freq, decreasing=TRUE), file="", caption="Frequencies of
words", label="qol" )
@

\end{document}

The output consists, of course, of a very long two-column table, with
wide swaths of empty white space on either side. I'd like to use the
page width more efficiently, by making a shorter, wider table of 4
columns (2 pairs of columns), with the rows  "flowing" from the bottom
of the left-hand pair to the top of the right-hand pair.

I know I could modify the intermediate .tex file "by hand," after
R/Sweave/HMisc generates it, splitting it at some row roughly halfway
down. But is there a way to do this programmatically in the Rnw file?
All I can think of is using two separate chunks to generate two separate
tables, one for elements 1:(length(word.freq)/2) of word.freq and one
for the remaining elements. Is there a better way?

Thanks.

--Chris
-- 
Christopher W. Ryan, MD, MS
SUNY Upstate Medical University Clinical Campus at Binghamton
425 Robinson Street, Binghamton, NY  13904
cryanatbinghamtondotedu

"Once we recognize that we do not err out of laziness, stupidity, or
evil intent, we can liberate ourselves from the impossible burden of
trying to be permanently right. We can take seriously the proposition
that we could be in error, without deeming ourselves idiotic or
unworthy." [Karen Schulz, in Being Wrong: Adventures in the Margin of Error]

__
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] Dose-response relationship using metafor?

2013-09-19 Thread Viechtbauer Wolfgang (STAT)
Can you provide a minimal and self-contained example showing/illustrating what 
you have done and would like to test? Based on the information provided, I 
could only make a vague suggestion along the lines of: You could include dose 
in an appropriate meta-regression model and then examine whether polynomial 
versions of the dose variable are significant (which would suggest a non-linear 
relationship).

Best,
Wolfgang

--   
Wolfgang Viechtbauer, Ph.D., Statistician   
Department of Psychiatry and Psychology   
School for Mental Health and Neuroscience   
Faculty of Health, Medicine, and Life Sciences   
Maastricht University, P.O. Box 616 (VIJV1)   
6200 MD Maastricht, The Netherlands   
+31 (43) 388-4170 | http://www.wvbauer.com   


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Ross, Stephanie
> Sent: Wednesday, September 18, 2013 21:41
> To: r-help@r-project.org
> Subject: [R] Dose-response relationship using metafor?
> 
> I am currently working a meta-analysis that is exploring the effect of a
> drug on plasma lipid levels. However, I am primarily interested in
> assessing the overall dose-response relationship with mean change in
> lipids. I have used the metafor package to conduct a meta-regression but
> is there a way to determine if this relationship is linear? Something like
> a p-value for trend?
> Thanks so much!
> 
> 
> PHRI DISCLAIMER This information is directed in confidence solely to the
> person named above and may not otherwise be distributed, copied or
> disclosed. Therefore, this information should be considered strictly
> confidential. If you have received this email in error, please notify the
> sender immediately via a return email for further direction. Thank you for
> your assistance.
> 
>   [[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] can you explain the cov2cor function

2013-09-19 Thread David Winsemius

On Sep 19, 2013, at 1:48 AM, Kenn Konstabel wrote:

> On Wed, Sep 18, 2013 at 12:14 PM, Pascal Oettli  wrote:
> 
>> It's a function of package "sos", quite useful to find functions in R.
>> 
>> 
>> It is interesting to note that neither RSiteSearch("cov2cor") nor
> findFn("cov2cor") seem to be able to find cov2cor (from the stats package!
> so it's there on every machine that has R installed) but find lots of other
> answeres (e.g., cor2cov). It is thus perhaps too simple-minded to assume
> that when I search for foobar, and if there is a function with exactly that
> name, it would appear as the first answer.  You can find cov2cor by
> searching for "Correlation, Variance and Covariance (Matrices)" (an
> unlikely search string:).

That's not exactly true.  does find the help page on which that function is 
described:

http://finzi.psych.upenn.edu/R/library/stats/html/cor.html

It just doesn't list it as the name of the page. And it's buried in a welter of 
other potential hits:

 findFn("cov2cor")
found 74 matches;  retrieving 4 pages
2 3 4 
Downloaded 65 links in 37 packages.

-- 
David Winsemius
Alameda, CA, 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.


Re: [R] ggplot: stat_smooth(method='glm', ...) - plot linear predictor?

2013-09-19 Thread Ista Zahn
You need to map obs to the y axis:

p + geom_point(aes(y=obs), position=position_jitter(height=0.02, width=0))

Best,
Ista

On Thu, Sep 19, 2013 at 9:19 AM, Michael Friendly  wrote:
> Thanks for the very helpful reply. Some comments inline.
>
> On 9/18/2013 8:53 PM, Dennis Murphy wrote:
>> Hi Michael:
>>
>
>> Some questions:
>>
>> - Is it possible, and if so, how, to plot the same data and fitted smooths
>> on the logit
>> scale, i.e., the linear predictor for the binomial glm?
>> Yes, but not through stat/geom_smooth directly - the geom only
>> provides a simple default mechanism. You can create a data frame using
>> predict.glm() with the default type, set se.fit = TRUE and then use
>> geom_line() and geom_ribbon() in ggplot2. See below.
>
> Hmm.  I thought that ggplot had the facility to apply a transformation,
> and found coord_trans,
> which I think does what I want, more or less (except that geom_point
> doesn't work).
>
> logit <- function(x) log(x)/log(1-x)
>
> ggplot(Titanicp, aes(age, as.numeric(survived)-1, color=sex)) +
>stat_smooth(method="glm", family=binomial, formula=y~x,
>alpha=0.2, size=2, aes(fill=sex)) +
> #  geom_point(position=position_jitter(height=0.02, width=0), size=1.5) +
>coord_trans(y="logit") + labs(x = "Age", y = "Estimated logit")
>
>> . We first need to get the predicted logits with corresponding SE
>> estimates into a data frame along with age and sex, and we should be
>> ready to go:
>...
>
> With this setup, I'd be happy to plot the observations on the logit
> scale jittered around
> some reasonable values, say \pm 1.5.  However my attempt to do this
> doesn't work
> and I'm not sure why.
>
> mod <- glm(survived ~ age*sex, family=binomial, data=Titanicp)
> modp <- cbind(Titanicp[, c("survived", "sex", "age")],
>predict(mod, se.fit = TRUE))
> modp$obs <- c(-1.5, 1.5)[modp$survived]
>
> # Plot predicted logits with corresponding Wald CIs
> p <- ggplot(modp, aes(x = age, y = fit, color = sex)) +
>geom_line(size = 2) +
>geom_ribbon(aes(ymin = fit - 1.96 * se.fit,
>ymax = fit + 1.96 * se.fit,
>fill = sex), alpha = 0.2,
>color = "transparent") +
>labs(x = "Age", y = "Estimated logit")
> p + geom_point(y=modp$obs, position=position_jitter(height=0.02, width=0))
>
>
>>p + geom_point(y=modp$obs, position=position_jitter(height=0.02, width=0))
> Error: position_jitter requires the following missing aesthetics: y
>
>>p + geom_point(y=modp$obs, position=position_jitter(y=modp$obs, height=0.02, 
>>width=0))
> Error in position_jitter(y = modp$obs, height = 0.02, width = 0) :
>unused argument (y = modp$obs)
>
>>
>> Dennis
>>
>>> i.e., glm() is quite happy to fit the model survived ~ age+sex
>>> in the binomial family, and gives the same predicted probabilities and
>>> logits.
>>>
>>> install.packages("vcdExtra")# data from the most recent version,
>>> vcdExtra_0.5-11
>>> data(Titanicp, package="vcdExtra")
>>> str(Titanicp)
>>>
>>> 'data.frame':   1309 obs. of  6 variables:
>>>   $ pclass  : Factor w/ 3 levels "1st","2nd","3rd": 1 1 1 1 1 1 1 1 1 1 ...
>>>   $ survived: Factor w/ 2 levels "died","survived": 2 2 1 1 1 2 2 1 2 1 ...
>>>   $ sex : Factor w/ 2 levels "female","male": 1 2 1 2 1 2 1 2 1 2 ...
>>>   $ age : num  29 0.917 2 30 25 ...
>>>   $ sibsp   : num  0 1 1 1 1 0 1 0 2 0 ...
>>>   $ parch   : num  0 2 2 2 2 0 0 0 0 0 ...
>>>
>>> require(ggplot2)
>>> # remove missings on age
>>> Titanicp <- Titanicp[!is.na(Titanicp$age),]
>>>
>>> ggplot(Titanicp, aes(age, as.numeric(survived)-1, color=sex)) +
>>>  stat_smooth(method="glm", family=binomial, formula=y~x, alpha=0.2,
>>> size=2, aes(fill=sex)) +
>>>  geom_point(position=position_jitter(height=0.02, width=0), size=1.5)
>>>
>>> # equivalent logistic regression model, survived as a factor
>>> mod <- glm(survived ~ age+sex, family=binomial, data=Titanicp)
>>> summary(mod)
>>>
>
>
> --
> Michael Friendly Email: friendly AT yorku DOT ca
> Professor, Psychology Dept. & Chair, Quantitative Methods
> York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
> 4700 Keele StreetWeb:   http://www.datavis.ca
> Toronto, ONT  M3J 1P3 CANADA
>
>
> [[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] Warning in gamlss function centiles.pred

2013-09-19 Thread rwnahhas
Hello,

I am getting a warning message in GAMLSS and have not been able to figure
out what the problem is, or if
 it is something I should be concerned about.

I fit the following 4 models and find that fit2.bcpe is the one with the
lowest AIC

fit1.bcpe  = gamlss(y~pb(x),
 
data=DAT, family=BCPE)
fit2.bcpe  = gamlss(y~pb(x), sigma.formula=~pb(x),  
data=DAT, family=BCPE)
fit3.bcpe  = gamlss(y~pb(x), sigma.formula=~pb(x), nu.formula=~pb(x),   
data=DAT, family=BCPE)
fit4.bcpe  = gamlss(y~pb(x), sigma.formula=~pb(x), nu.formula=~pb(x),
tau.formula=~pb(x), data=DAT, family=BCPE)
AIC(fit1.bcpe,  fit2.bcpe,  fit3.bcpe,  fit4.bcpe)
#   dfAIC
# fit2.bcpe 23.67571 15802.37
# fit3.bcpe 24.67868 15803.90
# fit4.bcpe 25.67313 15805.56
# fit1.bcpe 20.60762 15823.97

Then I use centiles.pred() to get predictions:

centiles.pred(fit2.bcpe, type=c("centiles"), xname="x", xvalues=18,
cent=c(3,15,50,85,97))

# new prediction 
# new prediction 
# x  C3 C15   C50 C85C97
# 1 18 100.3498 105.4568 111.4948 117.7682 123.4695
# Warning message:
#   In predict.gamlss(obj, what = "mu", newdata = newx, type = "response", 
:
#   There is a discrepancy  between the original and the
re-fit 
# used to achieve 'safe' predictions 

I thought perhaps that I am getting this error because of the use of the
pb() function. In the example
 below, using x+I(x^2)+I(x^3) instead of poly(x,3) solves the problem,
although the exact same 
predictions are produced making me wonder if the warning is something I can
just ignore.

data(aids)
a   = gamlss(y~poly(x,3), family=PO, data=aids)
newaids = data.frame(x=c(45,46,47))
centiles.pred(a, type=c("centiles"), xname="x", xvalues=c(45,46,47),
cent=c(3,15,50,85,97))
#x  C3 C15 C50 C85 C97
# 1 45 420 438 460 483 501
# 2 46 442 461 483 506 525
# 3 47 468 487 510 533 553
# Warning message:
#   In predict.gamlss(obj, what = "mu", newdata = newx, type = "response", 
:
#   There is a discrepancy  between the original and the
re-fit 
# used to achieve 'safe' predictions 
a = gamlss(y~x+I(x^2)+I(x^3), family=PO, data=aids)
centiles.pred(a, type=c("centiles"), xname="x", xvalues=c(45,46,47),
cent=c(3,15,50,85,97))
#x  C3 C15 C50 C85 C97
# 1 45 420 438 460 483 501
# 2 46 442 461 483 506 525
# 3 47 468 487 510 533 553
# No warning, but same predictions.

So I thought perhaps the problem was the use of pb(), but I do NOT get the
warning if I make predictions
 for any of the other 3 models:
  
centiles.pred(fit1.bcpe, type=c("centiles"), xname="x", xvalues=18,
cent=c(3,15,50,85,97), plot=T)
# x  C3 C15   C50 C85C97
# 1 18 100.1979 105.4092 111.4645 117.7477 123.547
centiles.pred(fit3.bcpe, type=c("centiles"), xname="x", xvalues=18,
cent=c(3,15,50,85,97), plot=T)
# x  C3 C15   C50 C85C97
# 1 18 100.4709 105.4202 111.3888 117.729 123.6178
centiles.pred(fit4.bcpe, type=c("centiles"), xname="x", xvalues=18,
cent=c(3,15,50,85,97), plot=T)
# x  C3 C15   C50 C85C97
# 1 18 100.3045 105.3596 111.2794 117.5696 123.5994

(1) If the warning is not because of pb(), then what is causing it?
(2) Can I ignore the warning? At least in the poly() example, the
predictions are the same after I fix the 
problem causing the warning. And in my data, the predictions are similar
across the 4 models.

Thanks!
  
Ramzi



--
View this message in context: 
http://r.789695.n4.nabble.com/Warning-in-gamlss-function-centiles-pred-tp4676513.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] binary symmetric matrix combination

2013-09-19 Thread arun
Hi Elio,
Try this:
library(stringr)
 lines1<-str_trim(gsub("\t"," ",readLines("elio.txt")))
 lst1<-lapply(split(lines1,cumsum(lines2=="")),function(x) x[x!=""])

lst2<- lapply(lst1[lapply(lst1,length)>0],function(x) 
as.matrix(read.table(text=x,row.names=1)))
names(lst2)<- paste0("m",seq_along(lst2))

lst2[1:2]
#$m1
 #    aa5 aa10 b253 b254
#aa5    0    1    1    1
#aa10   1    0    1    1
#b253   1    1    0    1
#b254   1    1    1    0
#
#$m2
 #   aa5 aa9 b27 b29
#aa5   0   1   1   1
#aa9   1   0   1   1
#b27   1   1   0   1
#b29   1   1   1   0


A.K.


From: Elio Shijaku 
To: arun  
Sent: Thursday, September 19, 2013 3:27 AM
Subject: Re: binary symmetric matrix combination



Hi Arun,

Please find attached the text file. Let me know if anything else is needed. 
Thanks a lot for your continuous help.

Best,

Elio

__
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 ensure that the polygon in spatstat::owin(poly=) does not have ³negative area²

2013-09-19 Thread MacQueen, Don
I suggest taking this question to r-sig-geo, if you haven't already.
-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 9/18/13 9:07 PM, "Jeff Marcus"  wrote:

>I am a new user of the R spatstat package and am having problems creating
>a
>polygonal observation window with owin(). Code follows:
>
>library("maps")
>library ("sp")`
>library("spatstat")
>mass.map <- map("state", "massachusetts:main", fill=T) # This returns
>a data frame includding x and y components that form a polygon of
>massachusetts mainland`
>
>mass.win <- owin(poly=data.frame(x=mass.map$x, y=mass.map$y)
>
> Error in if (w.area < 0) stop(paste("Area of polygon is negative -",
>"maybe traversed in >wrong direction?")) : missing value where TRUE/FALSE
>needed
>
>I tried things like reversing the order of the polygon and got same error.
>
> mass.win <- owin(poly=data.frame(x=rev(mass.map$x), y=rev(mass.map$y)))
>
> Polygon contains duplicated vertices
>
> Polygon is self-intersecting Error in owin(poly = data.frame(x =
>rev(mass.map$x), y = rev(mass.map$y))) : Polygon data contain duplicated
>vertices and self-intersection
>
>Then I figured that maybe the polygon returned by map() is not meant to be
>fed to owin(). So I tried loading a massachusetts shape file (I am totally
>taking guesses at this point).:
>
>x <- readShapePoly("../Geog/OUTLINE25K_POLY") ## The shape file for
>MASS, loaded from MassGIS website
>mass.poly <- x <- readShapePoly("../Geog/OUTLINE25K_POLY",
>force_ring=T, delete_null_obj=T) ## I got following error whether or
>not I used force_ring
>
> mass.owin <- as(mass.poly, "owin") Checking 1006 polygons...1, Polygon 1
>contains duplicated vertices [Checking polygon with 91844 edges...] 2, 3,
>.. [etd 1:21:52] 10 [etd 36:12] . [etd 23:10] 20 [etd 16:59]
>. [etd 13:22] 30 [etd 11:01] . [etd 9:21] 40 [etd 8:06]
>. [etd 7:09] 50 [etd 6:23] . [etd 5:46] 60 [etd 5:15]
>...[Checking polygon with 2449 edges...] .. [etd 4:49] 70 [etd 4:27]
>. [etd 4:07] 80 [etd 3:50] . [etd 3:36] 90 [etd 3:22]
>.
>[etd 3:11] 100 [ etc.
>
>I got messages complaining about intersecting vertices, etc. and it failed
>to build the polygon.
>
>Some context on problem: I am trying to use functions in spatstat for
>spatial relative risk calculations, i.e, the spatial ratio of denstity of
>cases vs. controls. For that I need an observation window and point plot
>within that window. I could cheat and make the observation window a
>rectangle around massachusetts but that would presumably distort values
>near the coast. In any case, I'd like to learn how to do this right for
>any
>future work I do with this package. Thanks for any help you can provide.
>
>Note: I cross-posted this to STack Overflow and then realized that r-help
>is probably a better forum.
>
>
> Jeff
>
>   [[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] ggplot: stat_smooth(method='glm', ...) - plot linear predictor?

2013-09-19 Thread Michael Friendly
Thanks for the very helpful reply. Some comments inline.

On 9/18/2013 8:53 PM, Dennis Murphy wrote:
> Hi Michael:
>

> Some questions:
>
> - Is it possible, and if so, how, to plot the same data and fitted smooths
> on the logit
> scale, i.e., the linear predictor for the binomial glm?
> Yes, but not through stat/geom_smooth directly - the geom only
> provides a simple default mechanism. You can create a data frame using
> predict.glm() with the default type, set se.fit = TRUE and then use
> geom_line() and geom_ribbon() in ggplot2. See below.

Hmm.  I thought that ggplot had the facility to apply a transformation, 
and found coord_trans,
which I think does what I want, more or less (except that geom_point 
doesn't work).

logit <- function(x) log(x)/log(1-x)

ggplot(Titanicp, aes(age, as.numeric(survived)-1, color=sex)) +
   stat_smooth(method="glm", family=binomial, formula=y~x,
   alpha=0.2, size=2, aes(fill=sex)) +
#  geom_point(position=position_jitter(height=0.02, width=0), size=1.5) +
   coord_trans(y="logit") + labs(x = "Age", y = "Estimated logit")

> . We first need to get the predicted logits with corresponding SE 
> estimates into a data frame along with age and sex, and we should be 
> ready to go: 
   ...

With this setup, I'd be happy to plot the observations on the logit 
scale jittered around
some reasonable values, say \pm 1.5.  However my attempt to do this 
doesn't work
and I'm not sure why.

mod <- glm(survived ~ age*sex, family=binomial, data=Titanicp)
modp <- cbind(Titanicp[, c("survived", "sex", "age")],
   predict(mod, se.fit = TRUE))
modp$obs <- c(-1.5, 1.5)[modp$survived]

# Plot predicted logits with corresponding Wald CIs
p <- ggplot(modp, aes(x = age, y = fit, color = sex)) +
   geom_line(size = 2) +
   geom_ribbon(aes(ymin = fit - 1.96 * se.fit,
   ymax = fit + 1.96 * se.fit,
   fill = sex), alpha = 0.2,
   color = "transparent") +
   labs(x = "Age", y = "Estimated logit")
p + geom_point(y=modp$obs, position=position_jitter(height=0.02, width=0))


>p + geom_point(y=modp$obs, position=position_jitter(height=0.02, width=0))
Error: position_jitter requires the following missing aesthetics: y

>p + geom_point(y=modp$obs, position=position_jitter(y=modp$obs, height=0.02, 
>width=0))
Error in position_jitter(y = modp$obs, height = 0.02, width = 0) :
   unused argument (y = modp$obs)

>
> Dennis
>
>> i.e., glm() is quite happy to fit the model survived ~ age+sex
>> in the binomial family, and gives the same predicted probabilities and
>> logits.
>>
>> install.packages("vcdExtra")# data from the most recent version,
>> vcdExtra_0.5-11
>> data(Titanicp, package="vcdExtra")
>> str(Titanicp)
>>
>> 'data.frame':   1309 obs. of  6 variables:
>>   $ pclass  : Factor w/ 3 levels "1st","2nd","3rd": 1 1 1 1 1 1 1 1 1 1 ...
>>   $ survived: Factor w/ 2 levels "died","survived": 2 2 1 1 1 2 2 1 2 1 ...
>>   $ sex : Factor w/ 2 levels "female","male": 1 2 1 2 1 2 1 2 1 2 ...
>>   $ age : num  29 0.917 2 30 25 ...
>>   $ sibsp   : num  0 1 1 1 1 0 1 0 2 0 ...
>>   $ parch   : num  0 2 2 2 2 0 0 0 0 0 ...
>>
>> require(ggplot2)
>> # remove missings on age
>> Titanicp <- Titanicp[!is.na(Titanicp$age),]
>>
>> ggplot(Titanicp, aes(age, as.numeric(survived)-1, color=sex)) +
>>  stat_smooth(method="glm", family=binomial, formula=y~x, alpha=0.2,
>> size=2, aes(fill=sex)) +
>>  geom_point(position=position_jitter(height=0.02, width=0), size=1.5)
>>
>> # equivalent logistic regression model, survived as a factor
>> mod <- glm(survived ~ age+sex, family=binomial, data=Titanicp)
>> summary(mod)
>>


-- 
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA


[[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] glmer vs glmmadmb

2013-09-19 Thread Ben Bolker
kenny xu  hotmail.com> writes:

> 
> Dear All
>
> I have fitted the following glmm:
> 
> cmai ~ time.f * intrv.f + (1 | nhome.f/Res_Code.f)
> 
> with poisson distribution, using both glmer and glmmadmb.
> 
> But the estimation for the fixed and random effects were different, i.e.

  This is a surprising set of differences.  I'm going to suggest
you send follow-ups to r-sig-mixed-mod...@r-project.org, which is
specialized for mixed models

> > summary(lmer.AGGREG.cmai.out3)
> 
> Call:
> glmmadmb(formula = cmai ~ time.f * intrv.f + (1 | nhome.f/Res_Code.f), 
> data = beam.AGGREG.cmai.long, family = "poisson", link = "log", 
> zeroInflation = F, admb.opts = admbControl(impSamp = 0, run = F), 
> save.dir = "tmp")

   Is there a particular reason you're using 'run=FALSE'?  This specification
will tell glmmADMB not to run the model, but to collect the results of
a previous run from the working directory -- not necessarily wrong,
but very easy to make a mistake this way and pick up the results
from a model run with a *different* specification (which might???
be what happened here)  (Also, just as a matter of practice, it's
strongly advised to use FALSE instead of F, just in case someone
decided to assign a value to 'F' ...)

> AIC: 1032.2 
> 
> Coefficients:
>  Estimate Std. Error z value Pr(>|z|)
> (Intercept) 0.542  3.1050.17 0.86
> time.f2 0.104  5.1770.02 0.98
> time.f3-0.526  3.230   -0.16 0.87
> intrv.f10.929  2.7120.34 0.73
> time.f2:intrv.f1   -0.416  5.302   -0.08 0.94
> time.f3:intrv.f10.177  3.2610.05 0.96
> 
> Number of observations: total=1032, nhome.f=35, nhome.f:Res_Code.f=344 
> Random effect variance(s):
> Group=nhome.f
> Variance StdDev
> (Intercept)   0.7118 0.8437
> Group=nhome.f:Res_Code.f
> Variance StdDev
> (Intercept)1.454  1.206
> Log-likelihood: -508.108 
> 
> > summary(lmer.AGGREG.cmai.out2)
> Generalized linear mixed model fit by the Laplace approximation 
> Formula: cmai ~ time.f * intrv.f + (1 | nhome.f/Res_Code.f) 
>Data: beam.AGGREG.cmai.long 
>   AIC  BIC logLik deviance
>  1835 1874 -909.5 1819
> Random effects:
>  Groups NameVariance Std.Dev.
>  Res_Code.f:nhome.f (Intercept) 0.040125 0.20031 
>  nhome.f(Intercept) 0.033702 0.18358 
> Number of obs: 1032, groups: Res_Code.f:nhome.f, 344; nhome.f, 35
> 
> Fixed effects:
>  Estimate Std. Error z value Pr(>|z|)
> (Intercept)   3.620400.04749   76.23   <2e-16 ***
> time.f2  -0.019640.01706   -1.15   0.2496
> time.f3   0.016430.016910.97   0.3310
> intrv.f1  0.075400.068191.11   0.2689
> time.f2:intrv.f1  0.021480.023950.90   0.3698
> time.f3:intrv.f1 -0.048350.02394   -2.02   0.0435 *  

  Otherwise I'm stumped.  The numbers of observations etc. etc.
seem consistent. It's hard to compare AIC/log-likelihood between
glmmADMB and glmer because (at present) they use different
additive offsets ...

   You could send me the data if it's not too sensitive.

  Ben Bolker

__
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] v3.0.1 issue

2013-09-19 Thread PIKAL Petr
Hi

or install missing packages to new R version before starting R with workspace.

Regards
Petr

> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Jannis
> Sent: Thursday, September 19, 2013 11:29 AM
> To: r-help@r-project.org
> Cc: s.tsiropoulo...@research.gla.ac.uk
> Subject: Re: [R] v3.0.1 issue
> 
> I only guess, but this message may hint to the cause:
> 
> [Previously saved workspace restored]
> 
> 
> R automatically starts some .RData files with images of the workspaces
> you used before. Try to start R with the
> 
> --no-restore
> 
> argument (R --no-restore in the command line or added to the properties
> of the symbol you click to start R in the Windows case).
> 
> Perhaps this solves the issue.
> 
> 
> Jannis
> 
> 
> 
> 
> On 18.09.2013 17:54, SOPHIA TSIROPOULOU wrote:
> > [Previously saved workspace restored]
> 
> __
> 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] Replacement function using grouping variable

2013-09-19 Thread PIKAL Petr
Hi

> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Alecia M Moser
> Sent: Thursday, September 19, 2013 7:01 AM
> To: r-help@r-project.org
> Subject: [R] Replacement function using grouping variable
> 
> Hello -
> 
> I am looking for a function that would allow me to replace specific
> columns in one data frame with columns in another data frame using a
> grouping variable.
> 
> df <- read.csv("data.csv", header=T)
> df1 <- aggregate(df[, c(8,9,10,11,12,27,28)], by=list(df$ID),
> FUN=function(x) sub("(.*):", "\\1.", x))
> 
> How do I replace columns (8,9,10,11,12,27,28) in df with those from df1
> using the ID column?

Maybe ?merge.

Petr

> 
> Thank you,
> 
> Alecia
> 
>   [[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] why does system() truncates stdout output from large files? (SOLUTION)

2013-09-19 Thread Andrew Beckerman
Dear all -  

Should anyone be interested - using  

paste(system(paste("awk 'NR==2'", file.genepop), intern = TRUE), collapse="")

pulls together the pieces (list elements) of the returned values.

--  
Andrew Beckerman
University of Sheffield


On Tuesday, 17 September 2013 at 12:36, Andrew Beckerman wrote:

> Dear listers  
>  
> I am using a system() call to my machine (OSX 10.8, R 3.0.1. 32GB memory 
> available):
>  
> system(paste("awk 'NR==2'", file.genepop), intern = TRUE)
>  
> and when processing big files, getting numerous helpful error messages
>  
> system(paste("awk 'NR==2'", file.genepop), intern = TRUE,  ... :
>   line 1 may be truncated in call to system(, intern = TRUE)
>  
> I understand what is happening, and can see the truncations, but is there any 
> way to prevent the truncation?  Or is there a read-limit in system() [I can't 
> see anything in the help file… but I am probably missing something]?
>  
> Many thanks
> Andrew
>  
>  
> --  
> Andrew Beckerman
> University of Sheffield
>  
>  


[[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-ACSII characters in R on Windows

2013-09-19 Thread Duncan Murdoch

On 13-09-19 5:06 AM, Maxim Linchits wrote:

Have any of the thread participants sent a bug report to R? If not,
let me know if you intend to so so. Otherwise, I'll send a report
myself.


There's no bug, as far as I know.  The issue is that various functions 
(by design) convert strings to the local encoding, and in the example 
you were trying, the local encoding can't represent all the characters, 
so they are shown using the hex codes, and things get messed up.


I'm currently looking into changing the design, so that there is more 
use of UTF-8 internally.  This is likely to have side effects, which 
need to be investigated carefully.


Duncan Murdoch



thanks

On Tue, Sep 17, 2013 at 5:01 PM, Duncan Murdoch
 wrote:

On 13-09-17 8:15 AM, Milan Bouchet-Valat wrote:


Le lundi 16 septembre 2013 à 20:04 +0400, Maxim Linchits a écrit :


Here is that old post:

http://r.789695.n4.nabble.com/read-csv-and-FileEncoding-in-Windows-version-of-R-2-13-0-td3567177.html

A taste: "Again, the issue is that opening this UTF-8 encoded file
under R 2.13.0 yields an error, but opening it under R 2.12.2 works
without any issues. (...)"


I have tried with R 2.12.2 both 32 and 64 bit on Windows Server 2008
with the French (CP1252) locale, and I still experience an error with
the test case I provided in previous messages. So it does not sound like
it is the same issue.




I can reproduce the error with a file sent to me by Maxim.  From a quick
look, I suspect that changes will be needed to read.table to handle this,
and they'll be large enough that they won't make it into 3.0.2, but
hopefully will go into R-patched after the release.

Duncan Murdoch


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


Re: [R] callNextMethod with dots argument

2013-09-19 Thread Simon Zehnder
Kien,

if you want to add variables in a function definition that is predefined by a 
Generic and calls CallNextMethod you have to add the '…' argument as well.

> setMethod("do",signature(a="Achild"),
>  function(a,msg,...)  {
>print("do Achild")
>callNextMethod()
>  })

Best

Simon

On Sep 19, 2013, at 8:58 AM, Kiên Kiêu  wrote:

> Hi,
> 
> I met a problem when invoking callNextMethod within a method associated with 
> a generic function taking ... as an argument.
> 
> Here is the code
> 
> setClass("Aparent",representation(x="numeric",y="numeric"))
> setClass("Achild",contains="Aparent")
> 
> setGeneric("do",def=function(a,...) standardGeneric("do"))
> setMethod("do",signature(a="Aparent"),
>  function(a,msg) {
>print("do Aparent")
>  })
> setMethod("do",signature(a="Achild"),
>  function(a,msg)  {
>print("do Achild")
>callNextMethod()
>  })
> 
> myA <- new("Achild")
> buf <- do(a=myA)   # works
> buf <- do(a=myA,msg="bonjour") # error
> 
> The last call yields the following error message:
> 
> Error in callNextMethod() :
>  in processing 'callNextMethod', found a '...' in the matched call, but no 
> corresponding '...' argument
> 
> which I do not understand. Replacing "..." by "msg" in setGeneric makes it 
> work. But I don't like this limitation so much (unless I understand it).
> 
> Regards.
> 
> Kien
> 
> __
> 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] v3.0.1 issue

2013-09-19 Thread Jannis

I only guess, but this message may hint to the cause:

[Previously saved workspace restored]


R automatically starts some .RData files with images of the workspaces you used 
before. Try to start R with the

--no-restore

argument (R --no-restore in the command line or added to the properties of the 
symbol you click to start R in the Windows case).

Perhaps this solves the issue.


Jannis




On 18.09.2013 17:54, SOPHIA TSIROPOULOU wrote:

[Previously saved workspace restored]


__
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] can you explain the cov2cor function

2013-09-19 Thread Kenn Konstabel
On Wed, Sep 18, 2013 at 12:14 PM, Pascal Oettli  wrote:

> It's a function of package "sos", quite useful to find functions in R.
>
>
> It is interesting to note that neither RSiteSearch("cov2cor") nor
findFn("cov2cor") seem to be able to find cov2cor (from the stats package!
so it's there on every machine that has R installed) but find lots of other
answeres (e.g., cor2cov). It is thus perhaps too simple-minded to assume
that when I search for foobar, and if there is a function with exactly that
name, it would appear as the first answer.  You can find cov2cor by
searching for "Correlation, Variance and Covariance (Matrices)" (an
unlikely search string:).

Regards,
Kenn

[[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] callNextMethod with dots argument

2013-09-19 Thread Kiên Kiêu

Hi,

I met a problem when invoking callNextMethod within a method associated 
with a generic function taking ... as an argument.


Here is the code

setClass("Aparent",representation(x="numeric",y="numeric"))
setClass("Achild",contains="Aparent")

setGeneric("do",def=function(a,...) standardGeneric("do"))
setMethod("do",signature(a="Aparent"),
  function(a,msg) {
print("do Aparent")
  })
setMethod("do",signature(a="Achild"),
  function(a,msg)  {
print("do Achild")
callNextMethod()
  })

myA <- new("Achild")
buf <- do(a=myA)   # works
buf <- do(a=myA,msg="bonjour") # error

The last call yields the following error message:

Error in callNextMethod() :
  in processing 'callNextMethod', found a '...' in the matched call, 
but no corresponding '...' argument


which I do not understand. Replacing "..." by "msg" in setGeneric makes 
it work. But I don't like this limitation so much (unless I understand it).


Regards.

Kien

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