Re: [R] how to draw paired mosaic plot?

2015-02-08 Thread Michael Friendly
You are looking for the pairs plot for table and other objects in the 
vcd package:


 ?vcd::pairs.table

It allows you to use various panel functions for the diagonal and 
off-diagonal plots


On 2/7/2015 9:50 AM, meng wrote:

If there are many character variables,and I want to get the mosaic plot of 
every pair of each variable,how to do then?


If the variables are numeric, I can use pairs to get paired scatter plot.
But as to the character variables, how to get the paired mosaic plot?


Many thanks.





--
QQ: 1733768559





At 2015-02-07 17:04:26,Jim Lemon drjimle...@gmail.com wrote:

Hi meng,
It's not too hard to get a mosaic plot of two character variables:

x-sample(LETTERS[1:3],20,TRUE)
y-sample(LETTERS[24:26],20,TRUE)
mosaicplot(table(x,y))

If you could tell us how the above is not what you want, perhaps a
better suggestion will appear.

Jim


On Sat, Feb 7, 2015 at 6:29 PM, meng laomen...@163.com wrote:

If both x and y are all character, paired scatter plot is a little bit strange 
I think.






--
QQ: 1733768559





At 2015-02-06 23:52:34,Duncan Murdoch murdoch.dun...@gmail.com wrote:

On 06/02/2015 6:46 AM, meng wrote:

Hi all:
If there are two numeric variable:x,y, and I can get paired scatter plot by function 
pairs.But if x and y are character, and I want to get paired mosaic 
plot,which function should be used then?


Why not pairs, with a custom panel function?  There are examples on the
help page, though I don't think a mosaic plot is there.

Duncan Murdoch



Many thanks!
My best.






--
QQ: 1733768559


  [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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]]




--
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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Unable to use `eval(parse(text))' in nlme::lme

2015-02-08 Thread Duncan Murdoch
On 08/02/2015 3:49 PM, Rolf Turner wrote:
 On 09/02/15 06:46, Ravi Varadhan wrote:
 Hi,

 I would like to run lme() on a number of response variables in a
 dataframe in an automatic manner.  Bu, when I use
 eval(parse(text=yname)) to denote the LHS of the formula in lme(), I
 get the following error message:



 require(nlme)



 mod2 - with(subset(labdata2, Transplant_type!=0  time 0),
 lme(eval(parse(text=yname)) ~ time +  as.factor(gvhd), random =
 ~1|Patient, correlation = corAR1(), method=ML,
 na.action=na.omit))
 Error in model.frame.default(formula = ~Patient + yname + time +
 gvhd,  : variable lengths differ (found for 'yname')

 The same usage works well in lme4::lmer without any problems.



 It seems that there is a problem in how the formula object is
 evaluated in lme().  Is there an alternative way to do this?
 
 What about trying some'at lahk:
 
 fmla - as.formula(paste(yname,~ time + as.factor(gvhd)))
 mod2 - with(, lme(fmla, random = ))
 
 Also you would probably be better off using the data argument rather 
 then using with(); this could have some impact on the environment in 
 which the formula is evaluated.

Formulas are a little tricky:  effectively they are evaluated twice.  If
you type something like

y ~ x

(or eval(parse(text=y ~ x)), or as.formula(y ~ x)) then a formula
object is created.  That object remembers the environment in which it
was created, so later when the modelling function uses it, the x and y
variables are evaluated in the original context.

In your example, as.formula() will convert the string to a formula, and
attach the current environment.  So you'd better hope that whatever
variable yname names, as well as time and gvhd, are all available there.

Duncan Murdoch

 
 Just stabbing in the dark here since you did not provide a reproducible 
 example.
 
 cheers,
 
 Rolf Turner


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Package build help

2015-02-08 Thread Glenn Schultz

Hello All,

I am in the final stages of building my first package BondLab and the check 
throughs the following warning.  I think this is namespace thing.  I have not done 
anything with the namespace at this point.  I am turning my attention to the namespace 
now.  Am I correct this can be a handled by the namespace?

Thanks,
Glenn

Found the following significant warnings:
  Warning: replacing previous import by ‘lubridate::duration’ when loading 
‘BondLab’
  Warning: replacing previous import by ‘plyr::here’ when loading ‘BondLab’
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Unable to use `eval(parse(text))' in nlme::lme

2015-02-08 Thread Ravi Varadhan
Hi,

I would like to run lme() on a number of response variables in a dataframe in 
an automatic manner.  Bu, when I use eval(parse(text=yname)) to denote the LHS 
of the formula in lme(), I get the following error message:



 require(nlme)



 mod2 - with(subset(labdata2, Transplant_type!=0  time 0), 
 lme(eval(parse(text=yname)) ~ time +  as.factor(gvhd), random = ~1|Patient, 
 correlation = corAR1(), method=ML, na.action=na.omit))
Error in model.frame.default(formula = ~Patient + yname + time + gvhd,  :
  variable lengths differ (found for 'yname')

The same usage works well in lme4::lmer without any problems.



It seems that there is a problem in how the formula object is evaluated in 
lme().  Is there an alternative way to do this?



Thank you,

Ravi

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 draw paired mosaic plot?

2015-02-08 Thread meng
Many thanks.





--
QQ: 1733768559





At 2015-02-08 23:01:09,Michael Friendly frien...@yorku.ca wrote:
You are looking for the pairs plot for table and other objects in the 
vcd package:

  ?vcd::pairs.table

It allows you to use various panel functions for the diagonal and 
off-diagonal plots

On 2/7/2015 9:50 AM, meng wrote:
 If there are many character variables,and I want to get the mosaic plot of 
 every pair of each variable,how to do then?


 If the variables are numeric, I can use pairs to get paired scatter plot.
 But as to the character variables, how to get the paired mosaic plot?


 Many thanks.





 --
 QQ: 1733768559





 At 2015-02-07 17:04:26,Jim Lemon drjimle...@gmail.com wrote:
 Hi meng,
 It's not too hard to get a mosaic plot of two character variables:

 x-sample(LETTERS[1:3],20,TRUE)
 y-sample(LETTERS[24:26],20,TRUE)
 mosaicplot(table(x,y))

 If you could tell us how the above is not what you want, perhaps a
 better suggestion will appear.

 Jim


 On Sat, Feb 7, 2015 at 6:29 PM, meng laomen...@163.com wrote:
 If both x and y are all character, paired scatter plot is a little bit 
 strange I think.






 --
 QQ: 1733768559





 At 2015-02-06 23:52:34,Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 06/02/2015 6:46 AM, meng wrote:
 Hi all:
 If there are two numeric variable:x,y, and I can get paired scatter plot 
 by function pairs.But if x and y are character, and I want to get 
 paired mosaic plot,which function should be used then?

 Why not pairs, with a custom panel function?  There are examples on the
 help page, though I don't think a mosaic plot is there.

 Duncan Murdoch


 Many thanks!
 My best.






 --
 QQ: 1733768559


   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/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]]



-- 
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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Unable to use `eval(parse(text))' in nlme::lme

2015-02-08 Thread Rolf Turner

On 09/02/15 06:46, Ravi Varadhan wrote:

Hi,

I would like to run lme() on a number of response variables in a
dataframe in an automatic manner.  Bu, when I use
eval(parse(text=yname)) to denote the LHS of the formula in lme(), I
get the following error message:




require(nlme)





mod2 - with(subset(labdata2, Transplant_type!=0  time 0),
lme(eval(parse(text=yname)) ~ time +  as.factor(gvhd), random =
~1|Patient, correlation = corAR1(), method=ML,
na.action=na.omit))

Error in model.frame.default(formula = ~Patient + yname + time +
gvhd,  : variable lengths differ (found for 'yname')

The same usage works well in lme4::lmer without any problems.



It seems that there is a problem in how the formula object is
evaluated in lme().  Is there an alternative way to do this?


What about trying some'at lahk:

fmla - as.formula(paste(yname,~ time + as.factor(gvhd)))
mod2 - with(, lme(fmla, random = ))

Also you would probably be better off using the data argument rather 
then using with(); this could have some impact on the environment in 
which the formula is evaluated.


Just stabbing in the dark here since you did not provide a reproducible 
example.


cheers,

Rolf Turner

--
Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] specifying dimensions of a graphic (not the window...)

2015-02-08 Thread Evan Cooch
Greetings --

Graphics newbie (I generally don't use R for graphics, so if the 
question is 'obvious', point that out gently ;-)

I'm trying to use levelplot in the lattice package, to generate what 
I'll call a 'decision table', where optimal decisions (discrete, on the 
interval [0.0,0.5] by increments of 0.1) from a dynamic programming 
problem are plotted as a function of time since the time horizon. The 
'matrix' I'm trying to plot is 100 rows x 10 columns. While using the 
following works, more or less...

rgb.palette - colorRampPalette(c(red, green), space = rgb)
levelplot(t(results$policy), main=optimal harvest, xlab=time from 
end, ylab=state (N), col.regions=rgb.palette(6), cuts=6, 
at=seq(0,0.5,0.1))


the rendered figure is way too narrow. I want to make the 
proportions of the 'levelplot' (what I usually call a 'heat map') square 
(or something else that I specify). I'm used to dedicated graphics 
applications wherew I simply grab the figure and resize it to whatever 
aspect ratio I want. Obviously, with R, I need to invoke some sort of 
command line argument.

In my searches, I've found a fair number of queries/answers about how to 
change the size of the graphics windows, but I could care lerss what the 
graphics window sizing is (presumably, it should adjust to whatever the 
size of the underlying graphic is). I want to 'hard code' the dimensions 
of the graphic itself, not the window it's rendered in.

I'm sure the answer is out there, but I've been unsuccessful at finding 
the magic keywords in my searches.

Thanks in advance.





[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] problema con RInterface.StartRServer

2015-02-08 Thread javier.ruben.marcuzzi
Estimad Juanjo Fdez


No probé su ejemplo, pero antes de realizarlo, justo el vienes me compre una 
computadora con Windows 8.1, y algunas cosas de Windows 8 no andan, el mismo 
visual studio tiene una guía para actualizar las aplicaciones desde Windows 8 a 
8.1, incluso sqlite3 funciona de otra forma que hace “incompatible”, el código 
fuente viejo con el nuevo.


Se me ocurre que si actualiza su sistema operativo de 8 a 8.1, más lo necesario 
en R, si es que no esta al día, posiblemente su problema desaparece, pero tena 
en cuenta que no miré su código de R ni el problema en particular, simplemente 
es una observación que puede estar ajena a su problema, pero que es lo que me 
encontré hace 5 minutos. 






Javier Rubén Marcuzzi





De: Juanjo Fdez
Enviado el: ‎domingo‎, ‎08‎ de ‎febrero‎ de ‎2015 ‎12‎:‎31‎ ‎p.m.
Para: R-help-es@r-project.org





Buenas tardes,


Con un Windows 8 he instalado R, Rexcel y Statconn de acuerdo a las 
instrucciones de la siguiente página:





http://homepage.univie.ac.at/erich.neuwirth/php/rcomwiki/doku.php?id=wiki:how_to_install

Posteriormente intento ejecutar una macro de VSB pero enseguida el código se 
para en la línea de RInterface.StartRServer con el siguiente mensaje de error: 



“No se puede cargar un objeto porque no está disponible en este equipo

 

Error de compilación

 

No se puede encontrar el proyecto o la biblioteca”



Adicionalmente, tras instalar RExcel y Statconn obtengo el siguiente mensaje en 
Excel cuando lo abro


“Se ha producido el error “48” en tiempo de ejecución

No se encontró el archivo: bbloader”


Este mensaje NO lo obtenía antes de instalar RExcel y Statconn.


La macro funcionaba antes en un Excel 2003 sin problemas (con Windows xp)


He desinstalado varias veces todo y probado con Excel 2003 y 2007 con 
exactamente los mismos resultados


¿qué puedo estar haciendo mal?


Muchas gracias







 

 


Enviado desde Surface
 [[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


[R] Zero length data block in hexView?

2015-02-08 Thread Jeff Newmiller
The JPG data format uses something like the markedBlock defined in the 
hexView package, but some of the blocks are just markers with no data. Is there 
some simple way that I might have missed to explain this concept to hexView so 
the readFormat function can handle this? I have cobbled together some code to 
read part of the header but it doesn't parallel the format definition very well.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

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


[R] confidence interval for wilcox_test

2015-02-08 Thread RomanGelzhaeuser
Hello,
When using wilcox_test from coin I got a sample estimator which does not lie
in the confidence interval.(see below) How is that possible? (The
documentation said that both referre to some kind of pseudo median but it
seems to be the same for both the confidence interval and the samplle
estimator)

 wilcox_test(ErgebnisBefragung~V,daten,conf.int=T)

Asymptotic Wilcoxon Mann-Whitney Rank Sum Test

data:  ErgebnisBefragung by V (Burch, TVT)
Z = -2.0157, p-value = 0.04383
alternative hypothesis: true mu is not equal to 0
95 percent confidence interval:
 -2.056811e-05 -4.179582e-06
sample estimates:
difference in location 
 -3.251934e-05 

 



--
View this message in context: 
http://r.789695.n4.nabble.com/confidence-interval-for-wilcox-test-tp4702950.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Superscript in legend without using expression function

2015-02-08 Thread Gabor Grothendieck
On Sat, Feb 7, 2015 at 4:57 PM, jgui001 j.guilb...@auckland.ac.nz wrote:
 I am plotting three sets of data on a single graph, and doing around 100+
 graphs.
 I can use the expression function to superscript the 2 but that seems to
 force me to manually put in the R squared values. Is there away around this?

 This code will show what it should look like this but with the 2
 superscripted

 r1-c(0.59,0.9,0.6)
 plot(1:6)
 legend(topleft,
 legend=c(paste(G1 r=,r1[1]), paste(G2 r=,r1[2]), paste(G3 r=,r1[3])))

Replace the legend statement with:

leg - as.list(parse(text = sprintf(G%d~r^2=%.2f, 1:3, r1)))
legend(topleft, legend = leg)



-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Unable to use `eval(parse(text))' in nlme::lme

2015-02-08 Thread Ben Bolker
Ravi Varadhan ravi.varadhan at jhu.edu writes:
 
 I would like to run lme() on a number of response variables 
 in a dataframe in an automatic manner.  Bu, when I
 use eval(parse(text=yname)) to denote the LHS of the formula in lme(), 
 I get the following error message:
 
  require(nlme)
 
  mod2 - with(subset(labdata2, Transplant_type!=0  time 0), 
 lme(eval(parse(text=yname)) ~ time + 
 as.factor(gvhd), random = ~1|Patient, correlation = corAR1(), 
 method=ML, na.action=na.omit))
 Error in model.frame.default(formula = ~Patient + yname + time + gvhd,  :
   variable lengths differ (found for 'yname')
 
 The same usage works well in lme4::lmer without any problems.

 It seems that there is a problem in 
 how the formula object is evaluated in lme().  Is there an alternative way
 to do this?
 
  
  While I'm pleased that lmer is more robust, I would say that the
safest/most robust way to do this would be:

ff - reformulate(time,as.factor(gvhd),response=yname)
dd - subset(labdata2, Transplant_type!=0  time 0)
lme(ff, random=~1|Patient, data=dd, ...)

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] specifying dimensions of a graphic (not the window...)

2015-02-08 Thread Evan Cooch

On 2/8/2015 7:41 PM, Evan Cooch wrote:
 Greetings --

 Graphics newbie (I generally don't use R for graphics, so if the 
 question is 'obvious', point that out gently ;-)

 I'm trying to use levelplot in the lattice package, to generate what 
 I'll call a 'decision table', where optimal decisions (discrete, on 
 the interval [0.0,0.5] by increments of 0.1) from a dynamic 
 programming problem are plotted as a function of time since the time 
 horizon. The 'matrix' I'm trying to plot is 100 rows x 10 columns. 
 While using the following works, more or less...

 rgb.palette - colorRampPalette(c(red, green), space = rgb)
 levelplot(t(results$policy), main=optimal harvest, xlab=time from 
 end, ylab=state (N), col.regions=rgb.palette(6), cuts=6, 
 at=seq(0,0.5,0.1))



Sufficient solution to the problem for now -- adding the option 
aspect=fill fills the window, and if I specify the size of the window, 
then this amounts to the same thing, more or less.

Seems kind of a backward way to do it. I'd have thought setting size of 
the graphic, and then having the window size change dynamically around 
said graphic, would have been more intuitive.




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Package build help

2015-02-08 Thread Duncan Murdoch
On 08/02/2015 4:06 PM, Glenn Schultz wrote:
 Hello All,
 
 I am in the final stages of building my first package BondLab and the check 
 throughs the following warning.  I think this is namespace thing.  I have not 
 done anything with the namespace at this point.  I am turning my attention to 
 the namespace now.  Am I correct this can be a handled by the namespace?
 

I would guess you have imported the lubridate and plyr packages, and
also defined your own duration() and here() functions, hiding theirs.

Duncan Murdoch

 Thanks,
 Glenn
 
 Found the following significant warnings:
   Warning: replacing previous import by ‘lubridate::duration’ when loading 
 ‘BondLab’
   Warning: replacing previous import by ‘plyr::here’ when loading ‘BondLab’
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.