[R] how to run Fleming-Harrington weighted log-rank test in R

2014-09-12 Thread Man Photo
Hi,
I am looking for an R package that allows one to run the Fleming-Harrington
weighted log-rank test with varying Rho and Gamma. Any help is appreciated.
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] how to run Fleming-Harrington weighted log-rank test in R

2014-09-12 Thread David Winsemius


On Sep 11, 2014, at 8:39 PM, Man Photo wrote:


Hi,
I am looking for an R package that allows one to run the Fleming- 
Harrington
weighted log-rank test with varying Rho and Gamma. Any help is  
appreciated.

Thanks.


install.packages(sos)
library(sos)
findFn(Fleming-Harrington)



[[alternative HTML version deleted]]


Learn to search and learn to post in plain text.



PLEASE do read the posting guide http://www.R-project.org/posting-guide.html


--

David Winsemius, MD
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] Lines instead of points in a scatterplot

2014-09-12 Thread Angel Rodriguez


Dear subscribers,

I have the following dataframe:

 aggr
   child65$decedad   logit
1  [65,67)  0.
10  67  0.
2  [68,70) -0.06669137
3  [70,72) -0.71294981
4  [72,74) -0.59783700
5  [74,77) -1.08334482
6  [77,79) -1.88273125
7  [79,81) -1.21924028
8  [81,84) -1.94591015
9  [84,98] -1.65822808

When I write:

 plot(aggr)

I get the correct scatterplot, but points are substituted by horizontal lines. 
I prefer points.

If I write:

 plot(aggr, pch=1)

nothing changes

 plot(aggr[,1],aggr[,2])

nothing changes

 plot(aggr, type=p)

nothing changes


Any idea?

Best regards,

Angel Rodr�guez-Laso

[[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] Lines instead of points in a scatterplot

2014-09-12 Thread Vivek Das
HI,

Try to change with

plot(aggr, type=l)

see what happens?

This should work

--

Vivek Das


On Fri, Sep 12, 2014 at 10:32 AM, Angel Rodriguez 
angel.rodrig...@matiainstituto.net wrote:



 Dear subscribers,

 I have the following dataframe:

  aggr
child65$decedad   logit
 1  [65,67)  0.
 10  67  0.
 2  [68,70) -0.06669137
 3  [70,72) -0.71294981
 4  [72,74) -0.59783700
 5  [74,77) -1.08334482
 6  [77,79) -1.88273125
 7  [79,81) -1.21924028
 8  [81,84) -1.94591015
 9  [84,98] -1.65822808

 When I write:

  plot(aggr)

 I get the correct scatterplot, but points are substituted by horizontal
 lines. I prefer points.

 If I write:

  plot(aggr, pch=1)

 nothing changes

  plot(aggr[,1],aggr[,2])

 nothing changes

  plot(aggr, type=p)

 nothing changes


 Any idea?

 Best regards,

 Angel Rodríguez-Laso

 [[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] Lines instead of points in a scatterplot

2014-09-12 Thread Angel Rodriguez
Thank you, Vivek, but it hasn�t worked. I've tryed type=o and type=h to no 
avail.

Angel




-Mensaje original-
De: Vivek Das [mailto:vd4mm...@gmail.com]
Enviado el: vie 12/09/2014 10:50
Para: Angel Rodriguez
CC: R help
Asunto: Re: [R] Lines instead of points in a scatterplot
 
HI,

Try to change with

plot(aggr, type=l)

see what happens?

This should work

--

Vivek Das


On Fri, Sep 12, 2014 at 10:32 AM, Angel Rodriguez 
angel.rodrig...@matiainstituto.net wrote:



 Dear subscribers,

 I have the following dataframe:

  aggr
child65$decedad   logit
 1  [65,67)  0.
 10  67  0.
 2  [68,70) -0.06669137
 3  [70,72) -0.71294981
 4  [72,74) -0.59783700
 5  [74,77) -1.08334482
 6  [77,79) -1.88273125
 7  [79,81) -1.21924028
 8  [81,84) -1.94591015
 9  [84,98] -1.65822808

 When I write:

  plot(aggr)

 I get the correct scatterplot, but points are substituted by horizontal
 lines. I prefer points.

 If I write:

  plot(aggr, pch=1)

 nothing changes

  plot(aggr[,1],aggr[,2])

 nothing changes

  plot(aggr, type=p)

 nothing changes


 Any idea?

 Best regards,

 Angel Rodr�guez-Laso

 [[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] using pdf(file=) encount a Chinese garbled

2014-09-12 Thread PO SU


Tks, it works now , just needing some extra ajustment.



--

PO SU
mail: desolato...@163.com 
Majored in Statistics from SJTU




At 2014-09-12 12:33:19, Jinsong Zhao jsz...@yeah.net wrote:
On 2014/9/11 21:10, PO SU wrote:

 Dear expeRts,
  When i use the following codes:
  pdf(file=1.pdf,width=15)
  plot(1:3,main=你好)
  dev.off()
 #There were 12 warnings (use warnings() to see them)
I find that 你好 can't show correctly in pdf file, but  i just  
 plot(1:3,main=你好) to R plot viewer, it's ok .
Is there anyone happen to know the solution? BTW, i explore the encoding 
 argument in ?pdf ,but still can't solve the problem.


please refer to:
Paul Murrell and Brian Ripley (2006) Non-standard fonts in PostScript 
and PDF graphics. R News, 6(2):41–47. 
http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf

if you can read Chinese, you also can refer to:
http://www.newsmth.net/bbscon.php?bid=1039id=3924

HTH,
Jinsong




 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] Lines instead of points in a scatterplot

2014-09-12 Thread peter dalgaard
The root cause is that column 1 is a factor. So what you get is really a set of 
parallel boxplots each based on one observation. 

plot.default() is one way out, but you may need to generate the x-axis labels 
yourself.

I.e.,

x - factor(LETTERS[1:10])
y - rnorm(10)
plot(x,y)
plot.default(x,y)

For full control, recode the factor to a numeric variable. 


On 12 Sep 2014, at 10:32 , Angel Rodriguez angel.rodrig...@matiainstituto.net 
wrote:

 
 
 Dear subscribers,
 
 I have the following dataframe:
 
 aggr
   child65$decedad   logit
 1  [65,67)  0.
 10  67  0.
 2  [68,70) -0.06669137
 3  [70,72) -0.71294981
 4  [72,74) -0.59783700
 5  [74,77) -1.08334482
 6  [77,79) -1.88273125
 7  [79,81) -1.21924028
 8  [81,84) -1.94591015
 9  [84,98] -1.65822808
 
 When I write:
 
 plot(aggr)
 
 I get the correct scatterplot, but points are substituted by horizontal 
 lines. I prefer points.
 
 If I write:
 
 plot(aggr, pch=1)
 
 nothing changes
 
 plot(aggr[,1],aggr[,2])
 
 nothing changes
 
 plot(aggr, type=p)
 
 nothing changes
 
 
 Any idea?
 
 Best regards,
 
 Angel Rodr�guez-Laso
 
   [[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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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] Lines instead of points in a scatterplot

2014-09-12 Thread Angel Rodriguez
Thank you Peter. plot.default works perfectly.

I'm puzzled now with the first column of the dataframe aggr. 

aggr comes from:

aggr-summarize(child65$benvii, by=child65$decedad, FUN=mean, na.rm=TRUE)

If I write:

 aggr[,1]
 [1] [65,67) 67  [68,70) [70,72) [72,74) [74,77) [77,79) [79,81) [81,84) 
[84,98]
attr(,label)
[1] child65$decedad
Levels: [65,67) 67 [68,70) [70,72) [72,74) [74,77) [77,79) [79,81) [81,84) 
[84,98]
 aggr[,2]
[65,67)  67 [68,70) [70,72) [72,74) [74,77) 
[77,79) [79,81) [81,84) 
 0.  0. -0.06669137 -0.71294981 -0.59783700 -1.08334482 
-1.88273125 -1.21924028 -1.94591015 
[84,98] 
-1.65822808 
attr(,label)
[1] child65$benvii
attr(,class)
[1] labelled array   


So, it's like if the first column does not exist. It does not even have a name.

Angel




-Mensaje original-
De: peter dalgaard [mailto:pda...@gmail.com]
Enviado el: vie 12/09/2014 11:07
Para: Angel Rodriguez
CC: R-help@r-project.org
Asunto: Re: [R] Lines instead of points in a scatterplot
 
The root cause is that column 1 is a factor. So what you get is really a set of 
parallel boxplots each based on one observation. 

plot.default() is one way out, but you may need to generate the x-axis labels 
yourself.

I.e.,

x - factor(LETTERS[1:10])
y - rnorm(10)
plot(x,y)
plot.default(x,y)

For full control, recode the factor to a numeric variable. 


On 12 Sep 2014, at 10:32 , Angel Rodriguez angel.rodrig...@matiainstituto.net 
wrote:

 
 
 Dear subscribers,
 
 I have the following dataframe:
 
 aggr
   child65$decedad   logit
 1  [65,67)  0.
 10  67  0.
 2  [68,70) -0.06669137
 3  [70,72) -0.71294981
 4  [72,74) -0.59783700
 5  [74,77) -1.08334482
 6  [77,79) -1.88273125
 7  [79,81) -1.21924028
 8  [81,84) -1.94591015
 9  [84,98] -1.65822808
 
 When I write:
 
 plot(aggr)
 
 I get the correct scatterplot, but points are substituted by horizontal 
 lines. I prefer points.
 
 If I write:
 
 plot(aggr, pch=1)
 
 nothing changes
 
 plot(aggr[,1],aggr[,2])
 
 nothing changes
 
 plot(aggr, type=p)
 
 nothing changes
 
 
 Any idea?
 
 Best regards,
 
 Angel Rodr?guez-Laso
 
   [[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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@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.


Re: [R] Lines instead of points in a scatterplot

2014-09-12 Thread PIKAL Petr
Hi

look at str(aggr)

I bet you will find that your first column is factor and lines you see are from 
making a boxplot with your plot command.

You can change it by various ways but I would prefer to change factor to 
numeric, which requires some regular expression.
Here is one but I believe that other experts can come with easier one.

dat - gsub(^.*([[:digit:]]{2}),([[:digit:]]*).*$, \\1, 
aggr$child65$decedad)

Then plot
plot(dat, aggr[,2])

shall produce points.

Another option can be

plot(as.numeric(aggr[,1], aggr[,2], axes=FALSE)

and then you need to ad axes labels, see ?axis

Regards
Petr

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Vivek Das
 Sent: Friday, September 12, 2014 10:50 AM
 To: Angel Rodriguez
 Cc: R help
 Subject: Re: [R] Lines instead of points in a scatterplot

 HI,

 Try to change with

 plot(aggr, type=l)

 see what happens?

 This should work

 --

 Vivek Das


 On Fri, Sep 12, 2014 at 10:32 AM, Angel Rodriguez 
 angel.rodrig...@matiainstituto.net wrote:

 
 
  Dear subscribers,
 
  I have the following dataframe:
 
   aggr
 child65$decedad   logit
  1  [65,67)  0.
  10  67  0.
  2  [68,70) -0.06669137
  3  [70,72) -0.71294981
  4  [72,74) -0.59783700
  5  [74,77) -1.08334482
  6  [77,79) -1.88273125
  7  [79,81) -1.21924028
  8  [81,84) -1.94591015
  9  [84,98] -1.65822808
 
  When I write:
 
   plot(aggr)
 
  I get the correct scatterplot, but points are substituted by
  horizontal lines. I prefer points.
 
  If I write:
 
   plot(aggr, pch=1)
 
  nothing changes
 
   plot(aggr[,1],aggr[,2])
 
  nothing changes
 
   plot(aggr, type=p)
 
  nothing changes
 
 
  Any idea?
 
  Best regards,
 
  Angel Rodríguez-Laso
 
  [[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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on 

Re: [R] Lines instead of points in a scatterplot

2014-09-12 Thread Angel Rodriguez
Thank you, Petr.

I understand now. I thought the first column Peter was referring to in his 
email was 

1 
10 
2 
3 
4  
5  
6  
7  
8  
9  

that appears when I write  aggr. In facti, it is:

[65,67) 
67  
[68,70) 
[70,72)
...

There is no need to change this column if one uses plot.default

Angel



-Mensaje original-
De: PIKAL Petr [mailto:petr.pi...@precheza.cz]
Enviado el: vie 12/09/2014 11:40
Para: Vivek Das; Angel Rodriguez
CC: R help
Asunto: RE: [R] Lines instead of points in a scatterplot
 
Hi

look at str(aggr)

I bet you will find that your first column is factor and lines you see are from 
making a boxplot with your plot command.

You can change it by various ways but I would prefer to change factor to 
numeric, which requires some regular expression.
Here is one but I believe that other experts can come with easier one.

dat - gsub(^.*([[:digit:]]{2}),([[:digit:]]*).*$, \\1, 
aggr$child65$decedad)

Then plot
plot(dat, aggr[,2])

shall produce points.

Another option can be

plot(as.numeric(aggr[,1], aggr[,2], axes=FALSE)

and then you need to ad axes labels, see ?axis

Regards
Petr

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Vivek Das
 Sent: Friday, September 12, 2014 10:50 AM
 To: Angel Rodriguez
 Cc: R help
 Subject: Re: [R] Lines instead of points in a scatterplot

 HI,

 Try to change with

 plot(aggr, type=l)

 see what happens?

 This should work

 --

 Vivek Das


 On Fri, Sep 12, 2014 at 10:32 AM, Angel Rodriguez 
 angel.rodrig...@matiainstituto.net wrote:

 
 
  Dear subscribers,
 
  I have the following dataframe:
 
   aggr
 child65$decedad   logit
  1  [65,67)  0.
  10  67  0.
  2  [68,70) -0.06669137
  3  [70,72) -0.71294981
  4  [72,74) -0.59783700
  5  [74,77) -1.08334482
  6  [77,79) -1.88273125
  7  [79,81) -1.21924028
  8  [81,84) -1.94591015
  9  [84,98] -1.65822808
 
  When I write:
 
   plot(aggr)
 
  I get the correct scatterplot, but points are substituted by
  horizontal lines. I prefer points.
 
  If I write:
 
   plot(aggr, pch=1)
 
  nothing changes
 
   plot(aggr[,1],aggr[,2])
 
  nothing changes
 
   plot(aggr, type=p)
 
  nothing changes
 
 
  Any idea?
 
  Best regards,
 
  Angel Rodr�guez-Laso
 
  [[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.


Tento e-mail a jak�koliv k nemu pripojen� dokumenty jsou duvern� a jsou urceny 
pouze jeho adres�tum.
Jestlize jste obdrzel(a) tento e-mail omylem, informujte laskave neprodlene 
jeho odes�latele. Obsah tohoto emailu i s pr�lohami a jeho kopie vymazte ze 
sv�ho syst�mu.
Nejste-li zam�slen�m adres�tem tohoto emailu, nejste opr�vneni tento email 
jakkoliv uz�vat, rozsirovat, kop�rovat ci zverejnovat.
Odes�latel e-mailu neodpov�d� za eventu�ln� skodu zpusobenou modifikacemi ci 
zpozden�m prenosu e-mailu.

V pr�pade, ze je tento e-mail souc�st� obchodn�ho jedn�n�:
- vyhrazuje si odes�latel pr�vo ukoncit kdykoliv jedn�n� o uzavren� smlouvy, a 
to z jak�hokoliv duvodu i bez uveden� duvodu.
- a obsahuje-li nab�dku, je adres�t opr�vnen nab�dku bezodkladne prijmout; 
Odes�latel tohoto e-mailu (nab�dky) vylucuje prijet� nab�dky ze strany pr�jemce 
s dodatkem ci odchylkou.
- trv� odes�latel na tom, ze pr�slusn� smlouva je uzavrena teprve v�slovn�m 
dosazen�m shody na vsech jej�ch n�lezitostech.
- odes�latel tohoto emailu informuje, ze nen� opr�vnen uzav�rat za spolecnost 
z�dn� smlouvy s v�jimkou pr�padu, kdy k tomu byl p�semne zmocnen nebo p�semne 
poveren a takov� poveren� nebo pln� moc byly adres�tovi tohoto emailu pr�padne 
osobe, kterou adres�t zastupuje, predlozeny nebo jejich existence je adres�tovi 
ci osobe j�m zastoupen� zn�m�.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this 

[R] Error with RJDBC when trying dbUnloadDriver()

2014-09-12 Thread julian . bothe
Hello everyone, Hello Simon, 

 

I am starting to use RJDBC. When trying to unload the driver, I get an
Error message - even when not connecting to any database. 

This issue has been reported before in 2011
(https://stat.ethz.ch/pipermail/r-sig-db/2011q4/001103.html ), and it was
said that it's possibly a bug. But it seems that it's still there. 

 

Any hints?

 

---

library(RJDBC)

Postgres_drv - JDBC(driverClass = 'org.postgresql.Driver',

 classPath=
'PATH/TO/JAR/postgresql-9.3-1102.jdbc4.jar')

dbUnloadDriver(Postgres_drv)

 

#Error in .valueClassTest(standardGeneric(dbUnloadDriver), logical,  :


#  invalid value from generic function 'dbUnloadDriver', class NULL,
expected logical

--

All the best 

Julian


[[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] Parliament Seats Graph

2014-09-12 Thread Jim Lemon
On Mon, 8 Sep 2014 10:22:03 PM Stefan Petersson wrote:
 Hi,
 
 Is there any package (or homegrown function) that can produce
 Parliament Seats Graph? I'm referring to the nice looking concentric
 half circles of colored seats as seen on Wikipedia (for example).
 
 I can pretty easily plot the points and color them. But I can't group
 the colored points in sectors, as seen on the example.
 
 Example:
 
http://en.wikipedia.org/wiki/Verkhovna_Rada#mediaviewer/File:Fractions_of_th
 e_Parliament_of_Ukraine.svg
 
 Found here (on the right, a bit down):
 http://en.wikipedia.org/wiki/Verkhovna_Rada
 
Hi Stefan,
I can see how you would plot the points going from right to left (the easy 
way), by plotting the next point on the arc with the least increase in 
angle from the last point plotted. If this is the way you have worked out, I 
think all that you have to do is to turn the party affiliation into a factor 
(if 
it is not already) and plot the points by the sorted numeric value of the 
factor. You will probably want to adjust the levels to some political 
dimensions before doing the sort.

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Parliament Seats Graph

2014-09-12 Thread Barry Rowlingson
On Fri, Sep 12, 2014 at 11:25 AM, Jim Lemon j...@bitwrit.com.au wrote:

 I can see how you would plot the points going from right to left (the easy
 way), by plotting the next point on the arc with the least increase in
 angle from the last point plotted. If this is the way you have worked out, I
 think all that you have to do is to turn the party affiliation into a factor 
 (if
 it is not already) and plot the points by the sorted numeric value of the
 factor. You will probably want to adjust the levels to some political
 dimensions before doing the sort.

 I'm interested in how you get exactly N seats in M rows that look as
neat as that. My eyes are going funny trying to count the dots in each
arc but there must be some nice algorithm for generating a sequence
that sums to N, has M elements, and has a small variable difference
between the row sizes to constrain the sum...

 Or am I overthinking this?

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Parliament Seats Graph

2014-09-12 Thread Stefan Petersson
Yes. That's correct. The main problem is to solve a matrix where the
colSums and rowSums are known. Credits to dwinsem...@comcast.net for
pointing out the function r2dtable to me. Just feed it with the
known margins and the number of matrices You want. And Bob is Your
uncle!

Look at the thread Margins to fill matrix that I started on the subject.




2014-09-12 13:18 GMT+02:00 Barry Rowlingson b.rowling...@lancaster.ac.uk:
 On Fri, Sep 12, 2014 at 11:25 AM, Jim Lemon j...@bitwrit.com.au wrote:

 I can see how you would plot the points going from right to left (the easy
 way), by plotting the next point on the arc with the least increase in
 angle from the last point plotted. If this is the way you have worked out, I
 think all that you have to do is to turn the party affiliation into a factor 
 (if
 it is not already) and plot the points by the sorted numeric value of the
 factor. You will probably want to adjust the levels to some political
 dimensions before doing the sort.

  I'm interested in how you get exactly N seats in M rows that look as
 neat as that. My eyes are going funny trying to count the dots in each
 arc but there must be some nice algorithm for generating a sequence
 that sums to N, has M elements, and has a small variable difference
 between the row sizes to constrain the sum...

  Or am I overthinking this?

 Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Parliament Seats Graph

2014-09-12 Thread Duncan Murdoch
On 12/09/2014, 7:18 AM, Barry Rowlingson wrote: On Fri, Sep 12, 2014 at
11:25 AM, Jim Lemon j...@bitwrit.com.au wrote:

 I can see how you would plot the points going from right to left (the
easy
 way), by plotting the next point on the arc with the least increase in
 angle from the last point plotted. If this is the way you have worked
out, I
 think all that you have to do is to turn the party affiliation into a
factor (if
 it is not already) and plot the points by the sorted numeric value of the
 factor. You will probably want to adjust the levels to some political
 dimensions before doing the sort.

  I'm interested in how you get exactly N seats in M rows that look as
 neat as that. My eyes are going funny trying to count the dots in each
 arc but there must be some nice algorithm for generating a sequence
 that sums to N, has M elements, and has a small variable difference
 between the row sizes to constrain the sum...

  Or am I overthinking this?

I would guess it's something like this:

1.  Set the radii of each arc.  Since the spacing of the dots looks
even, the number of dots in each arc should be proportional to the radius.

2.  Using the proportions above find the number of dots in the largest
arc by rounding the proportion times total to an integer.

3.  Repeat for each arc moving inwards, subtracting the number of dots
already shown from the grand total.

The same scheme can be used to set the number of dots of each colour in
each arc.

For example:

radii - seq(2.5, 1, len=11)
N - 449
counts - numeric(11)
plot(c(-2.5, 2.5), c(0, 2.5), type=n, axes=FALSE, asp=1)
for (i in 1:11) {
  counts[i] - round(N*radii[i]/sum(radii[i:11]))
  theta - seq(0, pi, len = counts[i])
  points(radii[i]*cos(theta), radii[i]*sin(theta))
  N - N - counts[i]
}

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] Parliament Seats Graph

2014-09-12 Thread Barry Rowlingson
I've generalised Duncan's code:

seats - function(N,M, r0=2.5){
radii - seq(r0, 1, len=M)

counts - numeric(M)
pts = do.call(rbind,
lapply(1:M, function(i){
counts[i] - round(N*radii[i]/sum(radii[i:M]))
theta - seq(0, pi, len = counts[i])
N - N - counts[i]
data.frame(x=radii[i]*cos(theta), y=radii[i]*sin(theta), r=i,
theta=theta)
}  )
)
pts = pts[order(-pts$theta,-pts$r),]
pts
}


and written this:

election - function(seats, counts){
stopifnot(sum(counts)==nrow(seats))
seats$party = rep(1:length(counts),counts)
seats
}


sample usage:

 layout = seats(449,16)
 result = election(layout, c(200,200,49)) # no overall majority!!!
 plot(result$x, result$y, col=result$party,pch=19, asp=1)

Looks like a start...


On Fri, Sep 12, 2014 at 12:41 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
 On 12/09/2014, 7:18 AM, Barry Rowlingson wrote: On Fri, Sep 12, 2014 at
 11:25 AM, Jim Lemon j...@bitwrit.com.au wrote:

 I can see how you would plot the points going from right to left (the
 easy
 way), by plotting the next point on the arc with the least increase in
 angle from the last point plotted. If this is the way you have worked
 out, I
 think all that you have to do is to turn the party affiliation into a
 factor (if
 it is not already) and plot the points by the sorted numeric value of the
 factor. You will probably want to adjust the levels to some political
 dimensions before doing the sort.

  I'm interested in how you get exactly N seats in M rows that look as
 neat as that. My eyes are going funny trying to count the dots in each
 arc but there must be some nice algorithm for generating a sequence
 that sums to N, has M elements, and has a small variable difference
 between the row sizes to constrain the sum...

  Or am I overthinking this?

 I would guess it's something like this:

 1.  Set the radii of each arc.  Since the spacing of the dots looks
 even, the number of dots in each arc should be proportional to the radius.

 2.  Using the proportions above find the number of dots in the largest
 arc by rounding the proportion times total to an integer.

 3.  Repeat for each arc moving inwards, subtracting the number of dots
 already shown from the grand total.

 The same scheme can be used to set the number of dots of each colour in
 each arc.

 For example:

 radii - seq(2.5, 1, len=11)
 N - 449
 counts - numeric(11)
 plot(c(-2.5, 2.5), c(0, 2.5), type=n, axes=FALSE, asp=1)
 for (i in 1:11) {
   counts[i] - round(N*radii[i]/sum(radii[i:11]))
   theta - seq(0, pi, len = counts[i])
   points(radii[i]*cos(theta), radii[i]*sin(theta))
   N - N - counts[i]
 }

 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] Error with RJDBC when trying dbUnloadDriver()

2014-09-12 Thread Simon Urbanek
Julian,

On Sep 12, 2014, at 6:03 AM, julian.bo...@elitepartner.de wrote:

 Hello everyone, Hello Simon,
  
 I am starting to use RJDBC. When trying to unload the driver, I get an Error 
 message – even when not connecting to any database.
 This issue has been reported before in 2011 
 (https://stat.ethz.ch/pipermail/r-sig-db/2011q4/001103.html ), and it was 
 said that it’s possibly a bug. But it seems that it’s still there.
  
 Any hints?

This issue has been never raised with me or the RJDBC issue tracker (it's 
beyond me why people don't ask the package maintainers).

In principle, it's bug that it returns NULL instead of FALSE (now fixed), but 
note that dbUnloadDriver() is will always fail with JDBC, because Java has no 
provision to unload classes. This is legal, since dbUnloadDriver() is declared 
as optional.

Cheers,
Simon



  
 ---
 library(RJDBC)
 Postgres_drv - JDBC(driverClass = 'org.postgresql.Driver',
  classPath= ‘PATH/TO/JAR/postgresql-9.3-1102.jdbc4.jar')
 dbUnloadDriver(Postgres_drv)
  
 #Error in .valueClassTest(standardGeneric(dbUnloadDriver), logical,  : 
 #  invalid value from generic function ‘dbUnloadDriver’, class “NULL”, 
 expected “logical”
 --
 All the best
 Julian

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Parliament Seats Graph

2014-09-12 Thread Barry Rowlingson
Note if you are trying to compare parliament diagrams created with
this code with images from wikipedia, the wikipedia images I tried are
wrong.

The Ukrainian one: http://en.wikipedia.org/wiki/Verkhovna_Rada  shows
two groups in red but the legend only has one red party, and the
French Senate: http://en.wikipedia.org/wiki/French_Parliament has 21
red Communist dots but the text says 20. It also has 10 green
(Green) dots but the text says 12.

Maybe wikipedia would like to use this code to generate these diagrams
from the data!





On Fri, Sep 12, 2014 at 1:01 PM, Rowlingson, Barry
b.rowling...@lancaster.ac.uk wrote:
 I've generalised Duncan's code:

 seats - function(N,M, r0=2.5){
 radii - seq(r0, 1, len=M)

 counts - numeric(M)
 pts = do.call(rbind,
 lapply(1:M, function(i){
 counts[i] - round(N*radii[i]/sum(radii[i:M]))
 theta - seq(0, pi, len = counts[i])
 N - N - counts[i]
 data.frame(x=radii[i]*cos(theta), y=radii[i]*sin(theta), r=i,
 theta=theta)
 }  )
 )
 pts = pts[order(-pts$theta,-pts$r),]
 pts
 }


 and written this:

 election - function(seats, counts){
 stopifnot(sum(counts)==nrow(seats))
 seats$party = rep(1:length(counts),counts)
 seats
 }


 sample usage:

 layout = seats(449,16)
 result = election(layout, c(200,200,49)) # no overall majority!!!
 plot(result$x, result$y, col=result$party,pch=19, asp=1)

 Looks like a start...


 On Fri, Sep 12, 2014 at 12:41 PM, Duncan Murdoch
 murdoch.dun...@gmail.com wrote:
 On 12/09/2014, 7:18 AM, Barry Rowlingson wrote: On Fri, Sep 12, 2014 at
 11:25 AM, Jim Lemon j...@bitwrit.com.au wrote:

 I can see how you would plot the points going from right to left (the
 easy
 way), by plotting the next point on the arc with the least increase in
 angle from the last point plotted. If this is the way you have worked
 out, I
 think all that you have to do is to turn the party affiliation into a
 factor (if
 it is not already) and plot the points by the sorted numeric value of the
 factor. You will probably want to adjust the levels to some political
 dimensions before doing the sort.

  I'm interested in how you get exactly N seats in M rows that look as
 neat as that. My eyes are going funny trying to count the dots in each
 arc but there must be some nice algorithm for generating a sequence
 that sums to N, has M elements, and has a small variable difference
 between the row sizes to constrain the sum...

  Or am I overthinking this?

 I would guess it's something like this:

 1.  Set the radii of each arc.  Since the spacing of the dots looks
 even, the number of dots in each arc should be proportional to the radius.

 2.  Using the proportions above find the number of dots in the largest
 arc by rounding the proportion times total to an integer.

 3.  Repeat for each arc moving inwards, subtracting the number of dots
 already shown from the grand total.

 The same scheme can be used to set the number of dots of each colour in
 each arc.

 For example:

 radii - seq(2.5, 1, len=11)
 N - 449
 counts - numeric(11)
 plot(c(-2.5, 2.5), c(0, 2.5), type=n, axes=FALSE, asp=1)
 for (i in 1:11) {
   counts[i] - round(N*radii[i]/sum(radii[i:11]))
   theta - seq(0, pi, len = counts[i])
   points(radii[i]*cos(theta), radii[i]*sin(theta))
   N - N - counts[i]
 }

 Duncan Murdoch


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] mice - undefined columns selected

2014-09-12 Thread David L Carlson
I'm copying the package maintainer who can probably give a more definite 
answer. I'm getting the same error on your data. I can get a subset of your 
data to run, eg:

d.imp - mice(d[,c(1:2, 5:6)]) works, but
d.imp - mice(d[,c(3:4, 7:8)]) fails. 

That suggests to me that the problem is with your data. There are some very 
high correlations between variables. Looking at pairwise complete observations, 
C1 has correlations of .998, .999, and .998 with C2, C3, and C4 while M1 has 
correlations of .999, .999, and .999 with M2, M3, and M4. The correlations 
between the C variables and the M variables are also high (consistently greater 
than .80). You really have only two variables C and M. This is probably the 
reason function mice() is failing, but the error message could be more 
informative. Since you are only imputing single values, you might be better off 
with simpler imputation methods. Package VIM has a number of options of which 
nearest neighbor and hot deck might work well with your data.

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Jeremy Miles
Sent: Thursday, September 11, 2014 7:49 PM
To: r-help
Subject: [R] mice - undefined columns selected

I've got a problem with the mice package that I don't understand.

Here's the code:
library(mice)
d - read.csv(https://dl.dropboxusercontent.com/u/24381951/employment.csv;,
 as.is=TRUE, row.names=1)d.imp - mice(data=d, m=1)

Result is:
Error in `[.data.frame`(data, , jj) : undefined columns selected

I hope I'm doing something foolish,

thanks,

Jeremy

[[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] 8 fast or 4 very fast cores?

2014-09-12 Thread Leif Ruckman
I am going to buy a new computer ( Dell workstation T5810 - Windows 8) 
to work with simulatons in R.


Now I am asked what kind of processor I like and I was given two choices.

1. Intel Xeon E5-1620 v3 - 4 cores 3.7 GHz Turbo
2. Intel Xeon E5-2640 v3 - 8 cores 2.6 GHz Turbo

I don't know what is better in simulations studies in R, a few very fast 
cores or many cores at normal speed.


Can you please give me help about this?

Warm regards

Leif Ruckman

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] mice - undefined columns selected

2014-09-12 Thread Buuren, S. (Stef) van
Dear David, mice eliminates variables that are linearly dependent. Type 
 imp$log
To see which are removed, and why.

 You have three options:
1 forget about those remove variables since they don't carry additional 
information
2 don't use them as predictors, and they will be imputed (although not 
preserving linear relations)
3 use passive imputation to impute them

I cannot see which one is best for you, but you have a choice.

Hope this helps. Stef.

Verstuurd vanaf mijn iPad

 Op 12 sep. 2014 om 16:18 heeft David L Carlson dcarl...@tamu.edu het 
 volgende geschreven:
 
 I'm copying the package maintainer who can probably give a more definite 
 answer. I'm getting the same error on your data. I can get a subset of your 
 data to run, eg:
 
 d.imp - mice(d[,c(1:2, 5:6)]) works, but
 d.imp - mice(d[,c(3:4, 7:8)]) fails. 
 
 That suggests to me that the problem is with your data. There are some very 
 high correlations between variables. Looking at pairwise complete 
 observations, C1 has correlations of .998, .999, and .998 with C2, C3, and C4 
 while M1 has correlations of .999, .999, and .999 with M2, M3, and M4. The 
 correlations between the C variables and the M variables are also high 
 (consistently greater than .80). You really have only two variables C and M. 
 This is probably the reason function mice() is failing, but the error message 
 could be more informative. Since you are only imputing single values, you 
 might be better off with simpler imputation methods. Package VIM has a number 
 of options of which nearest neighbor and hot deck might work well with your 
 data.
 
 -
 David L Carlson
 Department of Anthropology
 Texas AM University
 College Station, TX 77840-4352
 
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf Of Jeremy Miles
 Sent: Thursday, September 11, 2014 7:49 PM
 To: r-help
 Subject: [R] mice - undefined columns selected
 
 I've got a problem with the mice package that I don't understand.
 
 Here's the code:
 library(mice)
 d - read.csv(https://dl.dropboxusercontent.com/u/24381951/employment.csv;,
 as.is=TRUE, row.names=1)d.imp - mice(data=d, m=1)
 
 Result is:
 Error in `[.data.frame`(data, , jj) : undefined columns selected
 
 I hope I'm doing something foolish,
 
 thanks,
 
 Jeremy
 
[[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.



Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u niet 
de geadresseerde bent of dit bericht abusievelijk aan u is toegezonden, wordt u 
verzocht dat aan de afzender te melden en het bericht te verwijderen. TNO 
aanvaardt geen aansprakelijkheid voor de inhoud van deze e-mail, de wijze 
waarop u deze gebruikt en voor schade, van welke aard ook, die verband houdt 
met risico's verbonden aan het elektronisch verzenden van berichten.

 

This message may contain information that is not intended for you. If you are 
not the addressee or if this message was sent to you by mistake, you are 
requested to inform the sender and delete the message. TNO accepts no liability 
for the content of this e-mail, for the manner in which you use it and for 
damage of any kind resulting from the risks inherent to the electronic 
transmission of messages.

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


Re: [R] How to test for open pdf file on Windows before calling cairo_pdf ?

2014-09-12 Thread Kevin Wright
What I finally ended up doing was using the file() command to see if I
could open a writeable connection to a pdf, then closing the connection
before opening the file with cairo_pdf.

However, my whole effort may be pointless.  The cairo_pdf() device is
crashing R on Windows so often as to be mostly useless.

Kevin


On Thu, Sep 11, 2014 at 3:56 PM, Henrik Bengtsson h...@biostat.ucsf.edu
wrote:

 A poor mans solution would be to try to temporarily delete or move the
 file, depending exactly what you wish to do. You can also try:

 library(R.utils)
 pathname - Arguments$getWritablePathname(file2.pdf, mustNotExist=FALSE)

 which does lots of assertions of write permissions of new and existing
 file, in the target directory etc. and tries to give an informative
 error if it fails.  However, it does not have a particular
 test/message for locked PDF files.  This is the error message I get
 when I view a PDF in Adobe Reader on Windows:

  pathname - Arguments$getWritablePathname(file2.pdf,
 mustNotExist=FALSE)
 [2014-09-11 13:42:14] Exception: No permission to modify existing file:
 file2.pd
 f

   at #03. getWritablePathname.Arguments(static, ...)
   - getWritablePathname.Arguments() is in environment 'R.utils'

   at #02. getWritablePathname(static, ...)
   - getWritablePathname() is in environment 'R.utils'
   - originating from 'text'

   at #01. Arguments$getWritablePathname(file2.pdf, mustNotExist = FALSE)
   - Arguments$getWritablePathname() is local of the calling
 function

 Error: No permission to modify existing file: file2.pdf
 In addition: Warning message:
 In fileAccess.default(pathname, mode = 2) :
   file.access(..., mode=2) and file(..., open=ab) gives different
 results (0 != -1). Will use the file() results: file2.pdf


 Note that it is not all PDF viewers that lock/prevent files from being
 overwritten.  For instance, when I view the same file using Foxit
 Reader, I don't get an error, e.g.

 library(R.utils)
 pathname - Arguments$getWritablePathname(file2.pdf, mustNotExist=FALSE)
 pdf(pathname)
 plot(1:10)
 dev.off()


 Better yet, just use the R.devices package
 [http://cran.r-project.org/web/packages/R.devices/index.html] and
 it'll all be take care of for you:

 library(R.devices)
 devEval(png, name=file1, {
   plot(1:10)
 })

 library(R.devices)
 devEval(cairo_pdf, name=file2, {
   plot(1:10)
 }, ext=pdf)

 You'll get the above error message if, say, Adobe Reader is preventing
 the file from being overwritten.  This approach will make sure to
 close any opened graphics devices, not to leave incomplete image files
 behind if there is an errors and so on.  There are plenty of option
 for it, e.g. the default output directory is ./figures/, which can
 be changed.  (The need for argument ext=pdf is due to a minor bug
 that will be fixed in the next release.)


 Hope this helps,

 Henrik
 (author of R.utils and R.devices)

 On Thu, Sep 11, 2014 at 1:06 PM, Kevin Wright kw.s...@gmail.com wrote:
  On Windows:
 
  The pdf(file1.pdf) command will throw an error if the file1.pdf is open
  in a viewer.  For example:
 
  pdf(file1.pdf)
  plot(1:10)
  dev.off()
  shell.exec(file1.pdf)
  pdf(file1.pdf) # Causes an error
 
  As suggested by the help page for file.access(), I normally use
  try(pdf(file1.pdf)) to test if file1.pdf is open.
 
  Oddly, I cannot do the same using cairo_pdf.  For example:
 
  cairo_pdf(file2.pdf)
  plot(1:10)
  dev.off()
  shell.exec(file2.pdf)
  cairo_pdf(file2.pdf) # No error
 
  It is not until a plotting command is called that an error is generated.
 
  Is there a way to test if a pdf file can be written to by cairo_pdf ?
 
  I'd rather not wrap all plotting commands with try()I have many such
  commands in my script and the choice of which one is first depends on
 user
  input.
 
  Kevin Wright
 
  [[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.




-- 
Kevin Wright

[[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] cairo_pdf crashing R on Windows

2014-09-12 Thread Kevin Wright
I'm having trouble with cairo_pdf crashing R on Windows.

How can I debug this?  This is a exited abnormally type crash, so I can't
drop into the browser and look at the call stack.

Kevin


-- 
Kevin Wright

[[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] cairo_pdf crashing R on Windows

2014-09-12 Thread Henrik Bengtsson
First try a newer version of R, e.g. most recent patched and/or devel
version.  If that doesn't help, record sessionInfo() before calling
cairo_pdf() and before the crash. Try to find a minimal example and a
minimal figure for which you can reproduce this on your setup.  If it
only occurs occasional still try to identify an example where it
happens if you call it, say 100 times.  When you've done that share
you experience here for others to try to reproduce it.

/Henrik
(not using cairo_pdf() on a regular basis so haven't had any problems)

On Fri, Sep 12, 2014 at 11:12 AM, Kevin Wright kw.s...@gmail.com wrote:
 I'm having trouble with cairo_pdf crashing R on Windows.

 How can I debug this?  This is a exited abnormally type crash, so I can't
 drop into the browser and look at the call stack.

 Kevin


 --
 Kevin Wright

 [[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] cairo_pdf crashing R on Windows

2014-09-12 Thread Duncan Murdoch

On 12/09/2014 2:12 PM, Kevin Wright wrote:

I'm having trouble with cairo_pdf crashing R on Windows.

How can I debug this?  This is a exited abnormally type crash, so I can't
drop into the browser and look at the call stack.


This is getting into R-devel territory, but if Henrik's suggestions 
aren't enough, here are some more:


1.  Make the crash reproducible, and the trigger code as simple as 
possible.  If you can succeed in this and submit a bug report on 
bugs.r-project.org and someone in R Core can use your code to trigger a 
crash, that alone will be very helpful.


2.  Run under a debugger.  gdb is available for Windows, although it's 
not the easiest debugger in the world to use.  It's a lot easier if you 
can do a build of R with debugging information (not the default in 
Windows).  You do this by setting the environment variable DEBUG to T, 
and rebuilding R.  If you're lucky, gdb will identify which source line 
triggered the crash, and that might be enough (if you examine the source 
code carefully) to find the cause.


You might want to trigger the bug on a different platform; generally the 
debugging tools that work with R work better on Unix-alikes than on Windows.


3.  At this point you're rebuilding R, so if gdb wasn't enough to tell 
you what's going on, start sticking Rprintf() calls into the R source to 
see if you can find where things start to go wrong.  It's slow work, 
because you'll do a lot of rebuilds until you track down the bug.


I hope that helps.  Remember, even completing step 1 will be very 
helpful for others.  Actually tracking down and fixing the bug would be 
wonderful.


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-es] Fwd: SpatialPolygonsDataFrame

2014-09-12 Thread Francisco Rodríguez
Isabel, no s� si entiendo bien tu pregunta porque no s� como tienes los datos 
(si est�n en tablas distintas o en una misma tabla)
En principio cuando creas pol�gonos, estos deben de estar identificados por un 
id o por un separador, hay varias formas de hacer esto. Para un problema que me 
hizo falta, hice una sintaxis que no s� si te ayudar� o no. Para un problema en 
concreto segu� los siguientes pasos:
library(sp)library(maptools)
#Leo el .shp en el directorio en el que est�
shape1 
-readShapePoly(D:\\PROYECTOS\\2014\\GEOMARKETING\\GRANADA\\MUNICIPIO.shp)
#Monto un vector de pol�gonos usando poygons
Poligonos_Granada - polygons(shape1)
#Puedo dibujar todos los pol�gonos a la vez
plot(Poligonos_Granada)
#Puedo seleccionar un �nico pol�gono o varios (como es el caso)
plot(Poligonos_Granada[1:3])
--
En este caso part�a de un fichero estructurado con sus pol�gonos y lo que hac�a 
era hacer selecciones para posteriormente asociar colores, situaciones, ...
Por otro lado, en tu caso puede que sea al rev�s, t� tienes lo pol�gonos en 
distintos ficheros (o vectores o data frames, ...) y lo que parece ser que 
quieres es unificarlos en uno. Si este es tu caso puede que tu problema est� en 
que tu ID de identificaci�n es de tipo texto y no num�rico, si asocias un 
n�mero del 1 al 26 quiz�s con un bucle y unas pocas l�neas podr�as resolverlo
Un saludo
PD En todo caso me har�a falta saber un poco m�s que est�s haciendo y te digo 
algo m�s en concreto si se me ocurre
Francisco J.



 Date: Thu, 11 Sep 2014 10:45:43 -0300
 From: economylil...@gmail.com
 To: r-help-es@r-project.org
 Subject: [R-es] Fwd: SpatialPolygonsDataFrame
 
 Estimados, estoy creando un SpatialPolygonsDataFrame para crear el
 polygons, debo crear de a uno los polygon, tengo 26 poligonos y quiero
 saber si puedo escribir esto de una sola vez sin hacerlo uno para cada uno,
 
 Ejemplo:
 Sr1= Polygon(Calamuchita[,1:2])
 Sr2= Polygon(Capital[,1:2])
 Sr3=Polygon(Cdel.Eje[,1:2])
 ..
 
 Para luego:
 SrC= Polygons(list(SrC), Calamuchita)
 SrCa= Polygons(list(SrCa), Capital)
 SrCD=Polygons(list(SrCD), Cruz del Eje)
 ..
 
 
 Laura
 
 
 
 
 -- 
 *LIL*
 
   [[alternative HTML version deleted]]
 
 ___
 R-help-es mailing list
 R-help-es@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-help-es
  
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es