[R] draw a circle with a gradient fill

2017-10-24 Thread Alaios via R-help
Hi all,I would like to draw a simple circle where the color gradient follows 
the rule color = 1/(r^2) where r is the distance from the circle. I would also 
like to add a color bar with values going from -40 to -110 (and associate those 
with the color gradient that fills the circle).
So far I experiemented with draw circle 
install.packages('plotrix')require(plotrix)colors<-c('#fef0d9','#fdcc8a','#fc8d59','#e34a33','#b3')plot(c(-15,15),c(-15,15),type='n')draw.circle(0,
 0, 10, nv = 1000, border = NULL, col = colors[1], lty = 1, lwd = 
1)draw.circle(0, 0, 8, nv = 1000, border = NULL, col = colors[2], lty = 1, lwd 
= 1)draw.circle(0, 0, 6, nv = 1000, border = NULL, col = colors[3], lty = 1, 
lwd = 1)draw.circle(0, 0, 4, nv = 1000, border = NULL, col = colors[4], lty = 
1, lwd = 1)draw.circle(0, 0, 2, nv = 1000, border = NULL, col = colors[5], lty 
= 1, lwd = 1)

but this package does not give easily color gradients and so my solutions 
contains 5 same colors filled rings.
Will there be any suggested improvements on my code above?
Thanks a lotAlex
[[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.


[R] add a color bar

2017-07-10 Thread Alaios via R-help
Hi all,the code you will find at the bottom of the screen creates a 3d diagram 
of antenna measurements. I am adding also to this Figure a color bar,and I 
wanted to ask you if I can add a color bar (which package?) that will scale as 
the windows is maximized. My current color bar is a bit too rought and gets 
pixelized each time I maximize the window.
Any suggestions?I would like to thank you for your replyRegardsAlex
[[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.


[R] scalable and dynamic color bar

2017-07-08 Thread Alaios via R-help
Hi,I am using rgl to plot 3d graphics. You can find below some executable code.
I would like to add a color bar that scales as the window size scale. The 
solution I currently have gives a color bar that gets pixelated once you 
maximize the window.
Can you suggest of alternatives?
ThanksAlex
[[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] Writing my 3D plot function

2017-06-26 Thread Alaios via R-help
Thanks a lot for this. I never realized that my yahoo mail does not send plain 
text. So this is the code I have 

require("rgls") 

degreeToRadian<-function(degree){ 
return   (0.01745329252*degree) 
} 

turnPolarToX<-function(Amplitude,Coordinate){ 
return (Amplitude*cos(degreeToRadian(Coordinate))) 
} 

turnPolarToY<-function(Amplitude,Coordinate){ 
return (Amplitude*sin(degreeToRadian(Coordinate))) 
} 

X1<-turnPolarToX(1,1:360) 
Y1<-turnPolarToY(1,1:360) 
Z1<-rep(0,360) 


X2<-turnPolarToX(1,1:360) 
Y2<-rep(0,360) 
Z2<-turnPolarToY(1,1:360) 

test3<-runif(360) 
X3<-rep(0,360) 
Y3<-turnPolarToX(1,1:360) 
Z3<-turnPolarToY(1,1:360) 

Min<-min(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3) 
Max<-max(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3) 
plot3d(X1,Y1,Z1,xlim=c(Min,Max),ylim=c(Min,Max),zlim=c(Min,Max),box=TRUE,axe=FALSE,add=TRUE,col="red",type="l")
 
plot3d(X2,Y2,Z2,xlim=c(Min,Max),ylim=c(Min,Max),zlim=c(Min,Max),box=TRUE,axe=FALSE,add=TRUE,col="green",type="l")
 
plot3d(X3,Y3,Z3,xlim=c(Min,Max),ylim=c(Min,Max),zlim=c(Min,Max),box=TRUE,axe=TRUE,add=FALSE,col="blue",type="l")



I hope this helps
Regards
Alex
On Monday, June 26, 2017 1:46 AM, Jeff Newmiller <jdnew...@dcn.davis.ca.us> 
wrote:



Please look at what I see in your code below (run-on code mush) to understand 
part of why it is important for you to send your email as plain text as the 
Posting Guide indicates.  You might find [1] helpful. 

[1] https://wiki.openstack.org/wiki/MailingListEtiquette
-- 
Sent from my phone. Please excuse my brevity.


On June 25, 2017 2:42:26 PM EDT, Alaios via R-help <r-help@r-project.org> wrote:
>Hi all,I had a question last week on asking for a function that will
>help me draw three different circles on x,y,z axis based on polar
>coordinates (Each X,Y,Z circle are coming from three independent
>measurements of 1-360 polar coordinates). It turned out that there  is
>no such function in R and thus I am trying to write my own piece of
>code that hopefully I will be able to share. I have spent some time to
>write some code based on the rgl library (Still not 100% sure that this
>was the best option).
>My input are three polar circles X,Y,Z with a good example being the
>image
>belowhttps://www.mathworks.com/help/examples/antenna/win64/xxpolarpattern_helix.png
>
>So for X axis my input is a 2D matrix [360,2] including a single
>measurement per each polar coordinate. The first thing I tried was to
>turn my polar coordinates to cartesian ones by writing two simple
>functions. This works so far and I was able to print three simple
>circles on 3d spaceb but the problem now are the legends I need to put
>that remain on cartesian coordinates. As you can see from the code
>below all circles should have radius 1 (in terms of simplicity) but
>unfortunately I have the cartesian coordinates legends that do not help
>on reading my Figure. You can help me by executing the code below 
>
>require("rgls")
>degreeToRadian<-function(degree){  return   (0.01745329252*degree)}
>turnPolarToX<-function(Amplitude,Coordinate){  return
>(Amplitude*cos(degreeToRadian(Coordinate)))}
>turnPolarToY<-function(Amplitude,Coordinate){  return
>(Amplitude*sin(degreeToRadian(Coordinate)))}
># Putting the first circle on 3d space. Circle of radius
>1X1<-turnPolarToX(1,1:360)Y1<-turnPolarToY(1,1:360)Z1<-rep(0,360)
># Putting the second circle on 3d space. Circle of radius
>1X2<-turnPolarToX(1,1:360)Y2<-rep(0,360)Z2<-turnPolarToY(1,1:360)
># Putting the third circle on 3d space. Circle of radius
>1X3<-rep(0,360)Y3<-turnPolarToX(1,1:360)Z3<-turnPolarToY(1,1:360)
>Min<-min(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3)Max<-max(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3)plot3d(X1,Y1,Z1,xlim=c(Min,Max),ylim=c(Min,Max),zlim=c(Min,Max),box=TRUE,axe=FALSE,add=TRUE,col="red",type="l")plot3d(X2,Y2,Z2,xlim=c(Min,Max),ylim=c(Min,Max),zlim=c(Min,Max),box=TRUE,axe=FALSE,add=TRUE,col="green",type="l")plot3d(X3,Y3,Z3,xlim=c(Min,Max),ylim=c(Min,Max),zlim=c(Min,Max),box=TRUE,axe=TRUE,add=FALSE,col="blue",type="l")
>Would it be also possible to include an jpeg image file on a rgls plot?
>Thanks a lotRegardsAlex
>[[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.

__
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] Writing my 3D plot function

2017-06-25 Thread Alaios via R-help
Hi all,I had a question last week on asking for a function that will help me 
draw three different circles on x,y,z axis based on polar coordinates (Each 
X,Y,Z circle are coming from three independent measurements of 1-360 polar 
coordinates). It turned out that there  is no such function in R and thus I am 
trying to write my own piece of code that hopefully I will be able to share. I 
have spent some time to write some code based on the rgl library (Still not 
100% sure that this was the best option).
My input are three polar circles X,Y,Z with a good example being the image 
belowhttps://www.mathworks.com/help/examples/antenna/win64/xxpolarpattern_helix.png

So for X axis my input is a 2D matrix [360,2] including a single measurement 
per each polar coordinate. The first thing I tried was to turn my polar 
coordinates to cartesian ones by writing two simple functions. This works so 
far and I was able to print three simple circles on 3d spaceb but the problem 
now are the legends I need to put that remain on cartesian coordinates. As you 
can see from the code below all circles should have radius 1 (in terms of 
simplicity) but unfortunately I have the cartesian coordinates legends that do 
not help on reading my Figure. You can help me by executing the code below 

require("rgls")
degreeToRadian<-function(degree){  return   (0.01745329252*degree)}
turnPolarToX<-function(Amplitude,Coordinate){  return 
(Amplitude*cos(degreeToRadian(Coordinate)))}
turnPolarToY<-function(Amplitude,Coordinate){  return 
(Amplitude*sin(degreeToRadian(Coordinate)))}
# Putting the first circle on 3d space. Circle of radius 
1X1<-turnPolarToX(1,1:360)Y1<-turnPolarToY(1,1:360)Z1<-rep(0,360)
# Putting the second circle on 3d space. Circle of radius 
1X2<-turnPolarToX(1,1:360)Y2<-rep(0,360)Z2<-turnPolarToY(1,1:360)
# Putting the third circle on 3d space. Circle of radius 
1X3<-rep(0,360)Y3<-turnPolarToX(1,1:360)Z3<-turnPolarToY(1,1:360)
Min<-min(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3)Max<-max(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3)plot3d(X1,Y1,Z1,xlim=c(Min,Max),ylim=c(Min,Max),zlim=c(Min,Max),box=TRUE,axe=FALSE,add=TRUE,col="red",type="l")plot3d(X2,Y2,Z2,xlim=c(Min,Max),ylim=c(Min,Max),zlim=c(Min,Max),box=TRUE,axe=FALSE,add=TRUE,col="green",type="l")plot3d(X3,Y3,Z3,xlim=c(Min,Max),ylim=c(Min,Max),zlim=c(Min,Max),box=TRUE,axe=TRUE,add=FALSE,col="blue",type="l")
Would it be also possible to include an jpeg image file on a rgls plot?
Thanks a lotRegardsAlex
[[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] 3D plot with coordinates

2017-06-22 Thread Alaios via R-help
Thanks. So after searching 4 hours last night it looks like that there is no R 
package that can do this right now. Any other ideas or suggestions might be 
helpful.RegardsAlex 

On Wednesday, June 21, 2017 3:21 PM, Alaios via R-help 
<r-help@r-project.org> wrote:
 

 Thanks Duncan for the replyI can not suppress anything these are radiation 
pattern measurements that are typically are taken at X,Y and Z planes. See an 
example here, where I want to plot the measurements for the red, green and blue 
planes (so the image below withouth the 3d green structure 
inside)https://www.researchgate.net/publication/258391165/figure/fig7/AS:322947316240401@1454008048835/Radiation-pattern-of-Archimedean-spiral-antenna-a-3D-and-b-elevation-cuts-at-phi.png
 

I am quite confident that there is a tool in R to help me do this 3D plot, and 
even better rotatable.
Thanks for the reply to allAlex 

    On Wednesday, June 21, 2017 1:07 PM, Duncan Murdoch 
<murdoch.dun...@gmail.com> wrote:
 

 On 21/06/2017 5:23 AM, Alaios via R-help wrote:
> Thanks a lot for the reply.After  looking at different parts of the code 
> today I was able to start with simple 2D polar plots as the attached pdf 
> file.  In case the attachment is not visible I used the plot.polar function 
> to create something like 
> that.https://vijaybarve.files.wordpress.com/2013/04/polarplot-05.png
> Now the idea now will be to put three of those (for X,Y,Z) in a 3d rotatable 
> plane. I tried the rgl function but is not clear how I can use directly polar 
> coordinates to draw the points at the three different planes.
> Any ideas on that?

You can't easily do what you're trying to do.  You have 6 coordinates to 
display:  the 3 angles and values corresponding to each of them.  You 
need to suppress something.

If the values for matching angles correspond to each other (e.g. x=23 
degrees and y=23 degrees and z=23 degrees all correspond to the same 
observation), then I'd suggest suppressing the angles.  Just do a 
scatterplot of the 3 corresponding values.  It might make sense to join 
them (to make a path as the angles change), and perhaps to colour the 
path to indicate the angle (or plot text along the path to show it).

Duncan Murdoch

> Thanks a lot.RegardsAlex
>
>    On Tuesday, June 20, 2017 9:49 PM, Uwe Ligges 
><lig...@statistik.tu-dortmund.de> wrote:
>
>
>  package rgl.
>
> Best,
> Uwe Ligges
>
>
> On 20.06.2017 21:29, Alaios via R-help wrote:
>> HelloI have three x,y,z vectors (lets say each is set as  rnorm(360)). So 
>> each one is having 360 elements each one correpsonding to angular 
>> coordinates (1 degree, 2 degrees, 3 degrees, 360 degrees) and I want to 
>> plot those on the xyz axes that have degress.
>> Is there a function or library to look at R cran? The ideal will be that 
>> after plotting I will be able to rotate the shape.
>> I would like to thank you in advance for your helpRegardsAlex
>>    [[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.
>>
>
>
>
>
>
>
> __
> 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]]

__
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] 3D plot with coordinates

2017-06-21 Thread Alaios via R-help
Thanks Duncan for the replyI can not suppress anything these are radiation 
pattern measurements that are typically are taken at X,Y and Z planes. See an 
example here, where I want to plot the measurements for the red, green and blue 
planes (so the image below withouth the 3d green structure 
inside)https://www.researchgate.net/publication/258391165/figure/fig7/AS:322947316240401@1454008048835/Radiation-pattern-of-Archimedean-spiral-antenna-a-3D-and-b-elevation-cuts-at-phi.png
 

I am quite confident that there is a tool in R to help me do this 3D plot, and 
even better rotatable.
Thanks for the reply to allAlex 

On Wednesday, June 21, 2017 1:07 PM, Duncan Murdoch 
<murdoch.dun...@gmail.com> wrote:
 

 On 21/06/2017 5:23 AM, Alaios via R-help wrote:
> Thanks a lot for the reply.After  looking at different parts of the code 
> today I was able to start with simple 2D polar plots as the attached pdf 
> file.  In case the attachment is not visible I used the plot.polar function 
> to create something like 
> that.https://vijaybarve.files.wordpress.com/2013/04/polarplot-05.png
> Now the idea now will be to put three of those (for X,Y,Z) in a 3d rotatable 
> plane. I tried the rgl function but is not clear how I can use directly polar 
> coordinates to draw the points at the three different planes.
> Any ideas on that?

You can't easily do what you're trying to do.  You have 6 coordinates to 
display:  the 3 angles and values corresponding to each of them.  You 
need to suppress something.

If the values for matching angles correspond to each other (e.g. x=23 
degrees and y=23 degrees and z=23 degrees all correspond to the same 
observation), then I'd suggest suppressing the angles.  Just do a 
scatterplot of the 3 corresponding values.  It might make sense to join 
them (to make a path as the angles change), and perhaps to colour the 
path to indicate the angle (or plot text along the path to show it).

Duncan Murdoch

> Thanks a lot.RegardsAlex
>
>    On Tuesday, June 20, 2017 9:49 PM, Uwe Ligges 
><lig...@statistik.tu-dortmund.de> wrote:
>
>
>  package rgl.
>
> Best,
> Uwe Ligges
>
>
> On 20.06.2017 21:29, Alaios via R-help wrote:
>> HelloI have three x,y,z vectors (lets say each is set as  rnorm(360)). So 
>> each one is having 360 elements each one correpsonding to angular 
>> coordinates (1 degree, 2 degrees, 3 degrees, 360 degrees) and I want to 
>> plot those on the xyz axes that have degress.
>> Is there a function or library to look at R cran? The ideal will be that 
>> after plotting I will be able to rotate the shape.
>> I would like to thank you in advance for your helpRegardsAlex
>>    [[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.
>>
>
>
>
>
>
>
> __
> 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.

Re: [R] 3D plot with coordinates

2017-06-21 Thread Alaios via R-help
Thanks a lot for the reply.After  looking at different parts of the code today 
I was able to start with simple 2D polar plots as the attached pdf file.  In 
case the attachment is not visible I used the plot.polar function to create 
something like 
that.https://vijaybarve.files.wordpress.com/2013/04/polarplot-05.png
Now the idea now will be to put three of those (for X,Y,Z) in a 3d rotatable 
plane. I tried the rgl function but is not clear how I can use directly polar 
coordinates to draw the points at the three different planes. 
Any ideas on that?
Thanks a lot.RegardsAlex

On Tuesday, June 20, 2017 9:49 PM, Uwe Ligges 
<lig...@statistik.tu-dortmund.de> wrote:
 

 package rgl.

Best,
Uwe Ligges


On 20.06.2017 21:29, Alaios via R-help wrote:
> HelloI have three x,y,z vectors (lets say each is set as  rnorm(360)). So 
> each one is having 360 elements each one correpsonding to angular coordinates 
> (1 degree, 2 degrees, 3 degrees, 360 degrees) and I want to plot those on 
> the xyz axes that have degress.
> Is there a function or library to look at R cran? The ideal will be that 
> after plotting I will be able to rotate the shape.
> I would like to thank you in advance for your helpRegardsAlex
>     [[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.
> 


   

XNoSink.pdf
Description: Adobe PDF document
__
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] 3D plot with coordinates

2017-06-20 Thread Alaios via R-help
HelloI have three x,y,z vectors (lets say each is set as  rnorm(360)). So each 
one is having 360 elements each one correpsonding to angular coordinates (1 
degree, 2 degrees, 3 degrees, 360 degrees) and I want to plot those on the 
xyz axes that have degress.
Is there a function or library to look at R cran? The ideal will be that after 
plotting I will be able to rotate the shape.
I would like to thank you in advance for your helpRegardsAlex
[[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 these Plots are called? Which package

2017-01-14 Thread Alaios via R-help
can you see it now? I have uploaded it on my dropbox
https://www.dropbox.com/s/9eikpabu6xflasa/Figure.jpg?dl=0
 

On Saturday, January 14, 2017 12:57 PM, John Kane <jrkrid...@yahoo.ca> 
wrote:
 

 No sign of attachment. 
 

On Saturday, January 14, 2017 5:42 AM, Alaios via R-help 
<r-help@r-project.org> wrote:
 

 Hello,how I can try something like that in R (in the attachment I am providing 
a sketch).Which packages would you try to use?I would like to thank you in 
advance for your helpRegardsAlex
__
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.


[R] How these Plots are called? Which package

2017-01-14 Thread Alaios via R-help
Hello,how I can try something like that in R (in the attachment I am providing 
a sketch).Which packages would you try to use?I would like to thank you in 
advance for your helpRegardsAlex
__
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] why data.frame, mutate package and not lists

2016-09-14 Thread Alaios via R-help
thanks for all the answers. I think also ggplot2 requires data.frames.If you 
want to add variable to data.frame you have to use attach, detach. Right?Any 
more links that discuss thoe two different approaches?Alex 

On Wednesday, September 14, 2016 5:34 PM, Bert Gunter 
<bgunter.4...@gmail.com> wrote:
 

 This is partially a matter of subjectve opinion, and so pointless; but
I would point out that data frames are the canonical structure for a
great many of R's modeling and graphics functions, e.g. lm, xyplot,
etc.

As for mutate() etc., that's about UI's and user friendliness, and
imho my ho is meaningless.

Best,
Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Sep 14, 2016 at 6:01 AM, Alaios via R-help <r-help@r-project.org> wrote:
> Hi all,I have seen data.frames and operations from the mutate package getting 
> really popular. In the last years I have been using extensively lists, is 
> there any reason to not use lists and use other data types for data 
> manipulation and storage?
> Any article that describe their differences? I would like to thank you for 
> your replyRegardsAlex
>        [[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.

[R] why data.frame, mutate package and not lists

2016-09-14 Thread Alaios via R-help
Hi all,I have seen data.frames and operations from the mutate package getting 
really popular. In the last years I have been using extensively lists, is there 
any reason to not use lists and use other data types for data manipulation and 
storage?
Any article that describe their differences? I would like to thank you for your 
replyRegardsAlex
[[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.

[R] moran's I visualization example

2016-05-05 Thread Alaios via R-help
Hi there,in case one has found a nice and easy reproducible example of a 
Morans'I example where neighborhoods are depicted and their calculated 
correlations are visible as well.Point is to make some examples that I can 
share with students that want to understand fast what is the notion about.
RegardsAlex
[[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] greek characters in Figures

2016-05-04 Thread Alaios via R-help
> install.packages("latex2exp")Installiere Paket nach 
> ‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’(da ‘lib’ nicht 
> spezifiziert)Warnung: kann nicht auf den Index für das Repository 
> https://cran.cnr.Berkeley.edu/src/contrib zugreifen:  nicht unterstütztes URL 
> SchemaWarnmeldung:Paket ‘latex2exp’ ist nicht verfügbar (for R version 3.2.4 
> Revised) > install.packages("latex2expr")Installiere Paket nach 
> ‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’(da ‘lib’ nicht 
> spezifiziert)Warnung: kann nicht auf den Index für das Repository 
> https://cran.cnr.Berkeley.edu/src/contrib zugreifen:  nicht unterstütztes URL 
> SchemaWarnmeldung:Paket ‘latex2expr’ ist nicht verfügbar (for R version 3.2.4 
> Revised) 
 

On Monday, May 2, 2016 9:39 PM, David Winsemius <dwinsem...@comcast.net> 
wrote:
 

 
> On May 2, 2016, at 10:32 AM, Alaios via R-help <r-help@r-project.org> wrote:
> 
> Dear all,I am trying to write in my Figure labels short equations that 
> contain greek characters
> 
> For example:  C(h) = sigma^2 * rho(h).  
> 
> I am googling it and there are many packages available but unfortunately they 
> do not look available for my 3.2.4 latex version
> 
> install.packages("latex2expr")

My efforts found a 'latex2exp' but no 'latex2expr'. Are you sure you are not 
missplelling the package name?


> Installiere Paket nach ‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’(da ‘lib’ 
> nicht spezifiziert)Warnung: kann nicht auf den Index für das Repository 
> https://cran.cnr.Berkeley.edu/src/contrib zugreifen:  nicht unterstütztes URL 
> SchemaWarnmeldung:Paket ‘latex2expr’ ist nicht verfügbar (for R version 3.2.4 
> Revised) 
> 
> Any ideas what else I can try?I would like to thank you in advance for your 
> replyRegardsAlex
>     [[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.

David Winsemius
Alameda, CA, USA


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

[R] greek characters in Figures

2016-05-02 Thread Alaios via R-help
Dear all,I am trying to write in my Figure labels short equations that contain 
greek characters

For example:  C(h) = sigma^2 * rho(h).   

I am googling it and there are many packages available but unfortunately they 
do not look available for my 3.2.4 latex version

install.packages("latex2expr")Installiere Paket nach 
‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’(da ‘lib’ nicht 
spezifiziert)Warnung: kann nicht auf den Index für das Repository 
https://cran.cnr.Berkeley.edu/src/contrib zugreifen:  nicht unterstütztes URL 
SchemaWarnmeldung:Paket ‘latex2expr’ ist nicht verfügbar (for R version 3.2.4 
Revised) 

Any ideas what else I can try?I would like to thank you in advance for your 
replyRegardsAlex
[[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] Data structure to hold the following

2016-02-15 Thread Alaios via R-help
The tables and vectors storing the data will be used for accessing the data 
(sequentially is also fine) to do calculations as needed.
RegardsAlex 

On Monday, February 15, 2016 7:17 PM, Bert Gunter <bgunter.4...@gmail.com> 
wrote:
 

 I would say that it depends on what you want to do with the data.
Bert


On Monday, February 15, 2016, Alaios via R-help <r-help@r-project.org> wrote:

Dear all,I am using R to emulate radio propagation dynamics.
I have 90 antennas in a region and each of these 90 antennas hold information 
about 36 points (these are all exactly the same and there is no need to 
differentiate them further)
Each of these antennas now should keep information about the distances from the 
36 points (each of the 90 antennas have a different distance for each of the 
unique 36 points), which gives use in total 90 times a 36 elements vector.
Each antenna should also keep a [36,600] matrix (each matrix describes in 
details the relation between one of the 90 antennas and one of the 36 points 
and 600 elements are needed for doing that). In total that mines 90 times 
[36,600] matrices

What is an appropriate data structure for doing that in R ? I am giving fixed 
numbers here but in reality the 90,36 and 600 are just examples. Variable 
should be used here and thus we do not talk about fixed data structures before 
hand.

I would like to thank you for your replyRegardsAlex


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



-- 
Bert Gunter

"The trouble with having an open mind is that people keep coming along and 
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )



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

[R] Data structure to hold the following

2016-02-15 Thread Alaios via R-help
Dear all,I am using R to emulate radio propagation dynamics.
I have 90 antennas in a region and each of these 90 antennas hold information 
about 36 points (these are all exactly the same and there is no need to 
differentiate them further)
Each of these antennas now should keep information about the distances from the 
36 points (each of the 90 antennas have a different distance for each of the 
unique 36 points), which gives use in total 90 times a 36 elements vector.
Each antenna should also keep a [36,600] matrix (each matrix describes in 
details the relation between one of the 90 antennas and one of the 36 points 
and 600 elements are needed for doing that). In total that mines 90 times 
[36,600] matrices

What is an appropriate data structure for doing that in R ? I am giving fixed 
numbers here but in reality the 90,36 and 600 are just examples. Variable 
should be used here and thus we do not talk about fixed data structures before 
hand. 

I would like to thank you for your replyRegardsAlex


[[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] [FORGED] find numbers that fall in a region or the next available.

2016-02-03 Thread Alaios via R-help
Thanks. I am using distm of the geoshere package.I still wonder if there is a 
package that can tell me if a gps coordinate or not falls inside my area that 
is defined as:
bbox <- c(min(PlotPoints[, 1])-0.001, min(PlotPoints[, 2])-0.001, 
max(PlotPoints[, 1])+0.001, max(PlotPoints[, 2])+0.001)

PlotPoints are gps coordinates.
That would make it sure that I have no mistakes in my code.
Any ideas?Alex 

On Tuesday, February 2, 2016 11:33 PM, Rolf Turner 
<r.tur...@auckland.ac.nz> wrote:
 

 On 03/02/16 11:04, Alaios via R-help wrote:
> Dear all,I have GPS coordinates (one vector for longitude and one for
> latitude: GPSLong and GPSLat) of small are that is around 300meters X
> 300 meters (location falls inside UK).At the same time I have two
> more vectors (Longitude and Latitude) that include position of food
> stores again the UK I would like to find within my 300x300 square
> area which as the food stores that fall inside.I thought to try to
> find which of the Longitude of the food stores fall inside my area. I
> tried something the below
>
> Longitude[Longitude>(min(GPSLong)-0.001)&<(max(GPSLong)+0.001)]
> but this returned me zero results.The next option would be the code
> to return me at least the place that falls outside but still is close
> to that region.'Do you have any idea how to do that and not fall back
> in the time consuming look at each element iteration?
> I would like to thank you for your reply


You could make use of the distfun() function from the spatstat package. 
  Represent your "small area" as an object of class "owin".  The 
longitude and latitude coordinates will be treated as if they were 
Euclidean coordinates, but over distances of the order of 300 metres 
this should not matter much.  You could of course convert your long and 
lat coordinates to metres, using some appropriate projection, which 
might make more sense in your context.

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276


  
[[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] [FORGED] find numbers that fall in a region or the next available.

2016-02-03 Thread Alaios via R-help
That is a great tip thanks.That would indeed bring me points that are the 
closes to my area.. but if I am not wront that returns points that are part of 
a circle surface. It might be that I get a point that is just 50 meters outside 
of my map area. Is not that true? I would need after I find closest point to 
confirm which ones fall inside my map region.
Alex
 

On Wednesday, February 3, 2016 8:36 PM, David L Carlson <dcarl...@tamu.edu> 
wrote:
 

 Look at the point.in.polygon() and over() functions in package sp.

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

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Alaios via 
R-help
Sent: Wednesday, February 3, 2016 2:42 AM
To: Rolf Turner; R-help Mailing List
Subject: Re: [R] [FORGED] find numbers that fall in a region or the next 
available.

Thanks. I am using distm of the geoshere package.I still wonder if there is a 
package that can tell me if a gps coordinate or not fal

ls inside my area that is defined as:
bbox <- c(min(PlotPoints[, 1])-0.001, min(PlotPoints[, 2])-0.001, 
max(PlotPoints[, 1])+0.001, max(PlotPoints[, 2])+0.001)

PlotPoints are gps coordinates.
That would make it sure that I have no mistakes in my code.
Any ideas?Alex 

    On Tuesday, February 2, 2016 11:33 PM, Rolf Turner 
<r.tur...@auckland.ac.nz> wrote:


 On 03/02/16 11:04, Alaios via R-help wrote:
> Dear all,I have GPS coordinates (one vector for longitude and one for
> latitude: GPSLong and GPSLat) of small are that is around 300meters X
> 300 meters (location falls inside UK).At the same time I have two
> more vectors (Longitude and Latitude) that include position of food
> stores again the UK I would like to find within my 300x300 square
> area which as the food stores that fall inside.I thought to try to
> find which of the Longitude of the food stores fall inside my area. I
> tried something the below
>
> Longitude[Longitude>(min(GPSLong)-0.001)&<(max(GPSLong)+0.001)]
> but this returned me zero results.The next option would be the code
> to return me at least the place that falls outside but still is close
> to that region.'Do you have any idea how to do that and not fall back
> in the time consuming look at each element iteration?
> I would like to thank you for your reply


You could make use of the distfun() function from the spatstat package. 
  Represent your "small area" as an object of class "owin".  The
longitude and latitude coordinates will be treated as if they were 
Euclidean coordinates, but over distances of the order of 300 metres 
this should not matter much.  You could of course convert your long and 
lat coordinates to metres, using some appropriate projection, which 
might make more sense in your context.

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276


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

[R] find numbers that fall in a region or the next available.

2016-02-02 Thread Alaios via R-help
Dear all,I have GPS coordinates (one vector for longitude and one for latitude: 
GPSLong and GPSLat) of small are that is around 300meters X 300 meters 
(location falls inside UK).At the same time I have two more vectors (Longitude 
and Latitude) that include position of food stores again the UK
I would like to find within my 300x300 square area which as the food stores 
that fall inside.I thought to try to find which of the Longitude of the food 
stores fall inside my area. I tried something the below

Longitude[Longitude>(min(GPSLong)-0.001)&<(max(GPSLong)+0.001)]
but this returned me zero results.The next option would be the code to return 
me at least the place that falls outside but still is close to that region.'Do 
you have any idea how to do that and not fall back in the time consuming look 
at each element iteration?
I would like to thank you for your replyRegardsAlex



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


[R] getting values from php or javascript

2016-01-22 Thread Alaios via R-help
Dear all,I would like to execute some php or javascripts I found on the web.

see at middle of this page towards bottom
http://www.howtocreate.co.uk/php/gridref.php#samples

Is there any way I can call the php function for example directly from R?
I would like to thank you in advance for your replyRegardsAlex


[[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] improve my ggplot look

2015-11-24 Thread Alaios via R-help
I am giving to the community two examples
My code currently look like:
breaks<-c(0,0.01,0.05,0.08,0.1,0.15,0.2,0.3,0.5,0.7,0.9,1)
ggmap(mp, darken = 0) + geom_point(aes(Longitude, Latitude, colour 
=Divergence), data = PlotPoints, size =10)+ 
scale_colour_gradientn(colours=rainbow(9),breaks=breaks)+
geom_point(aes(Longitude,Latitude),size=15,data=stationaryPoint,colour="Red",shape="X",size=15)
where I added the gradientn in attempt to specify specific limits with a 
specific color for a a given range.
I am attaching two examples where you would seethat the values on the colorramp 
are not the same. In the first case is the 0.20 that gets the purple number and 
in the second case the 1 (the latter is not printed in the color ramp)
Can someone explain me in what small change Ineed here?
I would like to thank you for your replyRegardsAlex
 


On Tuesday, November 24, 2015 12:43 PM, Alaios via R-help 
<r-help@r-project.org> wrote:
 

 Dear Dennis, it would be better if not plotting the lon and lat. Keeping it 
blank is better for the aesthetics of my map.
I am not sure how I can give a reproducible example herebut I want to  
   ggmap(mp, darken = 0) + geom_point(aes(Longitude, Latitude, 
colour=Divergence), data = PlotPoints, size =10)+
 scale_colour_gradient2(low=muted("red"),mid="green", high=muted("blue"),trans 
="log")+geom_point(aes(Longitude,Latitude),size=15,data=stationaryPoint,colour="Red",shape="X",size=15)
 log10(seq(1,20,length.out=100))
to make the color scale with fixed colors (0.3 for green for example) and 
increase it in size so the numbers in the bar are still visible when the figure 
is getting smaller in size
RegardsAlex

    On Friday, November 20, 2015 11:02 PM, Dennis Murphy <djmu...@gmail.com> 
wrote:
 

 Hi Alex:

The documentation for ggmap tells you that its x-y coordinates are
lat-long. What did you want to plot instead?

There are several theme options for legends, as well as a few more in
the guide_legend() function. As far as the color scale, you should be
able to set it with hex codes in each map.

Since there is no reproducible example with which to work, I can't
really help/comment much further. If you come up with one, please post
it back to the group so that others can see it. Some of them have more
experience with mapping in ggplot2 than I do.

Dennis

On Thu, Nov 19, 2015 at 8:45 PM, Alaios <ala...@yahoo.com> wrote:
> dear Dennis,
> thanks for your answers.
> I have changed my code to look like
>
>    ggmap(mp, darken = 0) + geom_point(aes(Longitude, Latitude, colour
> =Divergence), data = PlotPoints, size =10)+
> scale_colour_gradient2(low=muted("red"),mid="green",
> high=muted("blue"),trans =
> "log")+geom_point(aes(Longitude,Latitude),size=15,data=stationaryPoint,colour="Red",shape="X",size=15)#
> log10(seq(1,20,length.out=100))
>
>
> current issues:
> -ggmap : plots the coordinates (longitudes and latitudes like x and y
> labels), which I do not want to do
> -Increase font size in the color bar
> -the color scale as it is now is totally fine, it is more that I want to
> make the colors there fixed, since different maps have slightly different
> numbers printed there (not much but that hinders comparisons between the
> maps).
>
> I would like to thank you for your support
> Regards
> Alex
>
>
>
> On Thursday, November 19, 2015 7:13 PM, Dennis Murphy <djmu...@gmail.com>
> wrote:
>
>
> Let's try this againsorry for hitting Send inadvertently.
>
> On Thu, Nov 19, 2015 at 5:09 AM, Alaios via R-help <r-help@r-project.org>
> wrote:
>> Dear all,the following line of code
>> print me a map of an area with the points I need. I only new two minor
>> adjustments
>>    ggmap(mp, darken = 0) + geom_point(aes(Longitude, Latitude, colour
>> =Error), data = PlotPoints, size = 6)+
>> scale_colour_gradient2(low=muted("red"),mid="green",
>> high=muted("blue"),trans =
>> "log")+geom_point(aes(Longitude,Latitude),data=stationaryPoint,colour="Red",shape="s",size=12)
>>
>> I want to specify my color ramp to have the specific scale
>> 0,10,040,130,4
>
> You can specify the hex codes for colors in any of the scale_colour*()
> functions.
>>
>> I also want to plot in a way where the fonts will be binger and the
>> legends as well.Any ideas how I can do that?
>
> See ?theme.
>
> Dennis
>
>
>
>> I would like to thank you for your reply
>> RegardsAlex
>>
>>
>>        [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list

Re: [R] improve my ggplot look

2015-11-24 Thread Alaios via R-help
Dear Dennis, it would be better if not plotting the lon and lat. Keeping it 
blank is better for the aesthetics of my map.
I am not sure how I can give a reproducible example herebut I want to  
   ggmap(mp, darken = 0) + geom_point(aes(Longitude, Latitude, 
colour=Divergence), data = PlotPoints, size =10)+
 scale_colour_gradient2(low=muted("red"),mid="green", high=muted("blue"),trans 
="log")+geom_point(aes(Longitude,Latitude),size=15,data=stationaryPoint,colour="Red",shape="X",size=15)
 log10(seq(1,20,length.out=100))
to make the color scale with fixed colors (0.3 for green for example) and 
increase it in size so the numbers in the bar are still visible when the figure 
is getting smaller in size
RegardsAlex

On Friday, November 20, 2015 11:02 PM, Dennis Murphy <djmu...@gmail.com> 
wrote:
 

 Hi Alex:

The documentation for ggmap tells you that its x-y coordinates are
lat-long. What did you want to plot instead?

There are several theme options for legends, as well as a few more in
the guide_legend() function. As far as the color scale, you should be
able to set it with hex codes in each map.

Since there is no reproducible example with which to work, I can't
really help/comment much further. If you come up with one, please post
it back to the group so that others can see it. Some of them have more
experience with mapping in ggplot2 than I do.

Dennis

On Thu, Nov 19, 2015 at 8:45 PM, Alaios <ala...@yahoo.com> wrote:
> dear Dennis,
> thanks for your answers.
> I have changed my code to look like
>
>    ggmap(mp, darken = 0) + geom_point(aes(Longitude, Latitude, colour
> =Divergence), data = PlotPoints, size =10)+
> scale_colour_gradient2(low=muted("red"),mid="green",
> high=muted("blue"),trans =
> "log")+geom_point(aes(Longitude,Latitude),size=15,data=stationaryPoint,colour="Red",shape="X",size=15)#
> log10(seq(1,20,length.out=100))
>
>
> current issues:
> -ggmap : plots the coordinates (longitudes and latitudes like x and y
> labels), which I do not want to do
> -Increase font size in the color bar
> -the color scale as it is now is totally fine, it is more that I want to
> make the colors there fixed, since different maps have slightly different
> numbers printed there (not much but that hinders comparisons between the
> maps).
>
> I would like to thank you for your support
> Regards
> Alex
>
>
>
> On Thursday, November 19, 2015 7:13 PM, Dennis Murphy <djmu...@gmail.com>
> wrote:
>
>
> Let's try this againsorry for hitting Send inadvertently.
>
> On Thu, Nov 19, 2015 at 5:09 AM, Alaios via R-help <r-help@r-project.org>
> wrote:
>> Dear all,the following line of code
>> print me a map of an area with the points I need. I only new two minor
>> adjustments
>>    ggmap(mp, darken = 0) + geom_point(aes(Longitude, Latitude, colour
>> =Error), data = PlotPoints, size = 6)+
>> scale_colour_gradient2(low=muted("red"),mid="green",
>> high=muted("blue"),trans =
>> "log")+geom_point(aes(Longitude,Latitude),data=stationaryPoint,colour="Red",shape="s",size=12)
>>
>> I want to specify my color ramp to have the specific scale
>> 0,10,040,130,4
>
> You can specify the hex codes for colors in any of the scale_colour*()
> functions.
>>
>> I also want to plot in a way where the fonts will be binger and the
>> legends as well.Any ideas how I can do that?
>
> See ?theme.
>
> Dennis
>
>
>
>> I would like to thank you for your reply
>> RegardsAlex
>>
>>
>>        [[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.

[R] improve my ggplot look

2015-11-19 Thread Alaios via R-help
Dear all,the following line of code
print me a map of an area with the points I need. I only new two minor 
adjustments
    ggmap(mp, darken = 0) + geom_point(aes(Longitude, Latitude, colour =Error), 
data = PlotPoints, size = 6)+ 
scale_colour_gradient2(low=muted("red"),mid="green", high=muted("blue"),trans = 
"log")+geom_point(aes(Longitude,Latitude),data=stationaryPoint,colour="Red",shape="s",size=12)
 

I want to specify my color ramp to have the specific scale 
0,10,040,130,4

I also want to plot in a way where the fonts will be binger and the legends as 
well.Any ideas how I can do that?
I would like to thank you for your reply
RegardsAlex


[[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] [FORGED] Re: merging-binning data

2015-11-05 Thread Alaios via R-help
Thanks.That is what I want. It is more that I do not know how to read factors 
that these two functions return
Browse[1]> y
$`13.6954016405008`
[1] (13.2,115]
Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]

$`88.5092280867206`
[1] (13.2,115]
Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]

$`137.931810364616`
[1] (115,217]
Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]

 str(y)
List of 30
 $ 13.6954016405008: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 1
 $ 88.5092280867206: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 1
 $ 137.931810364616: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 138.559590072838: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 143.085897171535: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 177.678839068735: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 177.819693807561: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 184.752000138622: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 211.255591076421: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 238.951618624679: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3
 $ 241.609050762905: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3
 $ 252.528297510773: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3 3 3
 $ 254.643586371518: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3

I need to be able to keep the items within their groups and at the same time to 
keep the label of the group so to be able to use it for plotting purposes.
How I can do that?RegardsAlex
 


 On Wednesday, November 4, 2015 11:20 PM, Rolf Turner 
<r.tur...@auckland.ac.nz> wrote:
   

 
I have been vaguely following this thread and have become very confused 
given the complications that seem to have appeared.

The original question was:

>>>>> On Tue, Nov 3, 2015 at 10:47 AM, Alaios via R-help <r-help@r-project.org> 
>>>>> wrote:
>>>>>> Dear all,I am not exactly sure on what is the proper name of what I am 
>>>>>> trying to do.
>>>>>> I have a vector that looks like

Actually you appear to have a 32 x 1 *matrix* (NOT the same thing!) that 
looks like:

>>>>>>    binDistance
>>>>>>              [,1]
>>>>>>    [1,] 238.95162
>>>>>>    [2,] 143.08590
>>>>>>    [3,]  88.50923
>>>>>>    [4,] 177.67884
>>>>>>    [5,] 277.54116
>>>>>>    [6,] 342.94689
>>>>>>    [7,] 241.60905
>>>>>>    [8,] 177.81969
>>>>>>    [9,] 211.25559
>>>>>> [10,] 279.72702
>>>>>> [11,] 381.95738
>>>>>> [12,] 483.76363
>>>>>> [13,] 480.98841
>>>>>> [14,] 369.75241
>>>>>> [15,] 267.73650
>>>>>> [16,] 138.55959
>>>>>> [17,] 137.93181
>>>>>> [18,] 184.75200
>>>>>> [19,] 254.64359
>>>>>> [20,] 328.87785
>>>>>> [21,] 273.15577
>>>>>> [22,] 252.52830
>>>>>> [23,] 252.52830
>>>>>> [24,] 252.52830
>>>>>> [25,] 262.20084
>>>>>> [26,] 314.93064
>>>>>> [27,] 366.02996
>>>>>> [28,] 442.77467
>>>>>> [29,] 521.20323
>>>>>> [30,] 465.33071
>>>>>> [31,] 366.60582
>>>>>> [32,]  13.69540

A later addendum to the question indicated that the OP wanted labels for 
the result consisting of the endpoints of the intervals into which the 
data were subdivided.  Unless I am misunderstanding, this is trivial to 
accomplish using cut() and split():

x <- c(238.95162, 143.0859, 88.50923, 177.67884, 277.54116, 342.94689,
241.60905, 177.81969, 211.25559, 279.72702, 381.95738, 483.76363,
480.98841, 369.75241, 267.7365, 138.55959, 137.93181, 184.752,
254.64359, 328.87785, 273.15577, 252.5283, 252.5283, 252.5283,
262.20084, 314.93064, 366.02996, 442.77467, 521.20323, 465.33071,
366.60582, 13.6954)

f <- cut(x,5)

y <- split(x,f)

y

$`(13.2,115]`
[1] 88.50923 13.69540

$`(115,217]`
[1] 143.0859 177.6788 177.8197 211.2556 138.5596 137.9318 184.7520

$`(217,318]`
  [1] 238.9516 277.5412 241.6090 279.7270 267.7365 254.6436 273.1558 
252.5283
  [9] 252.5283 252.5283 262.2008 314.9306

$`(318,420]`
[1] 342.9469 381.9574 369.7524 328.8779 366.0300 366.6058

$`(420,522]`
[1] 483.7636 480.9884 442.7747 521.2032 465.3307


Is this not the result that you want?  If not, what *is* the result that 
you want?

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276


  
[[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] merging-binning data

2015-11-04 Thread Alaios via R-help
Thanks it works great and gives me group numbers as integers and thus I can 
with which group the elements as needed (which (groups== 2))
Question though is how to keep also the labels for each group. For example that 
my first group is the [13,206)
RegardsAlex
 


 On Wednesday, November 4, 2015 1:00 PM, Boris Steipe 
<boris.ste...@utoronto.ca> wrote:
   

 I would transform the original numbers into integers which you can use as 
group labels. The row numbers of the group labels are the indexes of your 
values.

Example: assume your input vector is dBin

nGroups <- 5  # number of groups
groups <- (dBin - min(dBin)) / (max(dBin) - min(dBin)) # rescale to the range 
[0,1]
groups <- floor(groups * nGroups) + 1  # discretize to nGroups integers

Now you can eg. get the indices for group 2

groups[groups == 2]

Depending on the nature of your input data, it may be better to keep these 
groups in a column adjacent to your values, rather than in a separate vector, 
or even better to just calculate the groups on the fly in your downstream 
analysis with the approach given above in a function, rather than storing them 
at all. These are simple operations that should not add perceptibly to 
execution time.

Cheers,
Boris






On Nov 4, 2015, at 6:40 AM, Alaios via R-help <r-help@r-project.org> wrote:

> Thanks for the answer. Split does not give me the indexes though but only in 
> which group they fall in. I also need the index of the group. Is the first, 
> the second .. group?Alex
> 
> 
> 
>    On Tuesday, November 3, 2015 5:05 PM, Ista Zahn <istaz...@gmail.com> wrote:
> 
> 
> Probably
> 
> split(binDistance, test).
> 
> Best,
> Ista
> 
> On Tue, Nov 3, 2015 at 10:47 AM, Alaios via R-help <r-help@r-project.org> 
> wrote:
>> Dear all,I am not exactly sure on what is the proper name of what I am 
>> trying to do.
>> I have a vector that looks like
>>  binDistance
>>            [,1]
>>  [1,] 238.95162
>>  [2,] 143.08590
>>  [3,]  88.50923
>>  [4,] 177.67884
>>  [5,] 277.54116
>>  [6,] 342.94689
>>  [7,] 241.60905
>>  [8,] 177.81969
>>  [9,] 211.25559
>> [10,] 279.72702
>> [11,] 381.95738
>> [12,] 483.76363
>> [13,] 480.98841
>> [14,] 369.75241
>> [15,] 267.73650
>> [16,] 138.55959
>> [17,] 137.93181
>> [18,] 184.75200
>> [19,] 254.64359
>> [20,] 328.87785
>> [21,] 273.15577
>> [22,] 252.52830
>> [23,] 252.52830
>> [24,] 252.52830
>> [25,] 262.20084
>> [26,] 314.93064
>> [27,] 366.02996
>> [28,] 442.77467
>> [29,] 521.20323
>> [30,] 465.33071
>> [31,] 366.60582
>> [32,]  13.69540
>> so numbers that start from 13 and go up to maximum 522 (I have also many 
>> other similar sets).I want to put these numbers into 5 categories and thus I 
>> have tried cut
>> 
>> 
>> Browse[2]> 
>> test<-cut(binDistance,seq(min(binDistance)-0.1,max(binDistance),length.out=scaleLength+1))
>> Browse[2]> test
>>  [1] (217,318]  (115,217]  (13.7,115] (115,217]  (217,318]  (318,420]
>>  [7] (217,318]  (115,217]  (115,217]  (217,318]  (318,420]  (420,521]
>> [13] (420,521]  (318,420]  (217,318]  (115,217]  (115,217]  (115,217]
>> [19] (217,318]  (318,420]  (217,318]  (217,318]  (217,318]  (217,318]
>> [25] (217,318]  (217,318]  (318,420]  (420,521]  (420,521]  (420,521]
>> [31] (318,420]  (13.7,115]
>> Levels: (13.7,115] (115,217] (217,318] (318,420] (420,521]
>> 
>> 
>> I want then for the numbers of my initial vector that fall within the same 
>> "category" lets say the (318,420] to be collected on a vector.I rephrase it 
>> the indexes of my initial vector that have a value between 318 to 420 to be 
>> put in a same vector that I can process then as I want.
>> How I can do that effectively in R?
>> I would like to thank you for your replyRegardsAlex
>> 
>>        [[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]]

__
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] merging-binning data

2015-11-04 Thread Alaios via R-help
you are right.by labels I mean the "categories", "breaks" that my data fall 
in.To be part of group 2 for example you have to be in the range of [110,223) I 
need to keep those for my plots.
Did I describe it more precisely now?Alex
 


 On Wednesday, November 4, 2015 2:09 PM, Boris Steipe 
<boris.ste...@utoronto.ca> wrote:
   

 I don't understand: 
 - where does the "label" come from? (It's not an element of your data that I 
see.)
 - what do you want to do with this "label" i.e. how does it need to be 
associated with the data?


B.



On Nov 4, 2015, at 7:57 AM, Alaios <ala...@yahoo.com> wrote:

> Thanks it works great and gives me group numbers as integers and thus I can 
> with which group the elements as needed (which (groups== 2))
> 
> Question though is how to keep also the labels for each group. For example 
> that my first group is the [13,206)
> 
> Regards
> Alex
> 
> 
> 
> On Wednesday, November 4, 2015 1:00 PM, Boris Steipe 
> <boris.ste...@utoronto.ca> wrote:
> 
> 
> I would transform the original numbers into integers which you can use as 
> group labels. The row numbers of the group labels are the indexes of your 
> values.
> 
> Example: assume your input vector is dBin
> 
> nGroups <- 5  # number of groups
> groups <- (dBin - min(dBin)) / (max(dBin) - min(dBin)) # rescale to the range 
> [0,1]
> groups <- floor(groups * nGroups) + 1  # discretize to nGroups integers
> 
> Now you can eg. get the indices for group 2
> 
> groups[groups == 2]
> 
> Depending on the nature of your input data, it may be better to keep these 
> groups in a column adjacent to your values, rather than in a separate vector, 
> or even better to just calculate the groups on the fly in your downstream 
> analysis with the approach given above in a function, rather than storing 
> them at all. These are simple operations that should not add perceptibly to 
> execution time.
> 
> Cheers,
> Boris
> 
> 
> 
> 
> 
> 
> On Nov 4, 2015, at 6:40 AM, Alaios via R-help <r-help@r-project.org> wrote:
> 
> > Thanks for the answer. Split does not give me the indexes though but only 
> > in which group they fall in. I also need the index of the group. Is the 
> > first, the second .. group?Alex
> > 
> > 
> > 
> >    On Tuesday, November 3, 2015 5:05 PM, Ista Zahn <istaz...@gmail.com> 
> >wrote:
> > 
> > 
> > Probably
> > 
> > split(binDistance, test).
> > 
> > Best,
> > Ista
> > 
> > On Tue, Nov 3, 2015 at 10:47 AM, Alaios via R-help <r-help@r-project.org> 
> > wrote:
> >> Dear all,I am not exactly sure on what is the proper name of what I am 
> >> trying to do.
> >> I have a vector that looks like
> >>  binDistance
> >>            [,1]
> >>  [1,] 238.95162
> >>  [2,] 143.08590
> >>  [3,]  88.50923
> >>  [4,] 177.67884
> >>  [5,] 277.54116
> >>  [6,] 342.94689
> >>  [7,] 241.60905
> >>  [8,] 177.81969
> >>  [9,] 211.25559
> >> [10,] 279.72702
> >> [11,] 381.95738
> >> [12,] 483.76363
> >> [13,] 480.98841
> >> [14,] 369.75241
> >> [15,] 267.73650
> >> [16,] 138.55959
> >> [17,] 137.93181
> >> [18,] 184.75200
> >> [19,] 254.64359
> >> [20,] 328.87785
> >> [21,] 273.15577
> >> [22,] 252.52830
> >> [23,] 252.52830
> >> [24,] 252.52830
> >> [25,] 262.20084
> >> [26,] 314.93064
> >> [27,] 366.02996
> >> [28,] 442.77467
> >> [29,] 521.20323
> >> [30,] 465.33071
> >> [31,] 366.60582
> >> [32,]  13.69540
> >> so numbers that start from 13 and go up to maximum 522 (I have also many 
> >> other similar sets).I want to put these numbers into 5 categories and thus 
> >> I have tried cut
> >> 
> >> 
> >> Browse[2]> 
> >> test<-cut(binDistance,seq(min(binDistance)-0.1,max(binDistance),length.out=scaleLength+1))
> >> Browse[2]> test
> >>  [1] (217,318]  (115,217]  (13.7,115] (115,217]  (217,318]  (318,420]
> >>  [7] (217,318]  (115,217]  (115,217]  (217,318]  (318,420]  (420,521]
> >> [13] (420,521]  (318,420]  (217,318]  (115,217]  (115,217]  (115,217]
> >> [19] (217,318]  (318,420]  (217,318]  (217,318]  (217,318]  (217,318]
> >> [25] (217,318]  (217,318]  (318,420]  (420,521]  (420,521]  (420,521]
> >> [31] (318,420]  (13.7,115]
> >> Levels: (13.7,115] (115,217] (217,318] (318,420] (420,521]
> >> 
> >> 
> >> 

Re: [R] merging-binning data

2015-11-04 Thread Alaios via R-help
Thanks for the answer. Split does not give me the indexes though but only in 
which group they fall in. I also need the index of the group. Is the first, the 
second .. group?Alex
 


 On Tuesday, November 3, 2015 5:05 PM, Ista Zahn <istaz...@gmail.com> wrote:
   

 Probably

split(binDistance, test).

Best,
Ista

On Tue, Nov 3, 2015 at 10:47 AM, Alaios via R-help <r-help@r-project.org> wrote:
> Dear all,I am not exactly sure on what is the proper name of what I am trying 
> to do.
> I have a vector that looks like
>  binDistance
>            [,1]
>  [1,] 238.95162
>  [2,] 143.08590
>  [3,]  88.50923
>  [4,] 177.67884
>  [5,] 277.54116
>  [6,] 342.94689
>  [7,] 241.60905
>  [8,] 177.81969
>  [9,] 211.25559
> [10,] 279.72702
> [11,] 381.95738
> [12,] 483.76363
> [13,] 480.98841
> [14,] 369.75241
> [15,] 267.73650
> [16,] 138.55959
> [17,] 137.93181
> [18,] 184.75200
> [19,] 254.64359
> [20,] 328.87785
> [21,] 273.15577
> [22,] 252.52830
> [23,] 252.52830
> [24,] 252.52830
> [25,] 262.20084
> [26,] 314.93064
> [27,] 366.02996
> [28,] 442.77467
> [29,] 521.20323
> [30,] 465.33071
> [31,] 366.60582
> [32,]  13.69540
> so numbers that start from 13 and go up to maximum 522 (I have also many 
> other similar sets).I want to put these numbers into 5 categories and thus I 
> have tried cut
>
>
> Browse[2]> 
> test<-cut(binDistance,seq(min(binDistance)-0.1,max(binDistance),length.out=scaleLength+1))
> Browse[2]> test
>  [1] (217,318]  (115,217]  (13.7,115] (115,217]  (217,318]  (318,420]
>  [7] (217,318]  (115,217]  (115,217]  (217,318]  (318,420]  (420,521]
> [13] (420,521]  (318,420]  (217,318]  (115,217]  (115,217]  (115,217]
> [19] (217,318]  (318,420]  (217,318]  (217,318]  (217,318]  (217,318]
> [25] (217,318]  (217,318]  (318,420]  (420,521]  (420,521]  (420,521]
> [31] (318,420]  (13.7,115]
> Levels: (13.7,115] (115,217] (217,318] (318,420] (420,521]
>
>
> I want then for the numbers of my initial vector that fall within the same 
> "category" lets say the (318,420] to be collected on a vector.I rephrase it 
> the indexes of my initial vector that have a value between 318 to 420 to be 
> put in a same vector that I can process then as I want.
> How I can do that effectively in R?
> I would like to thank you for your replyRegardsAlex
>
>        [[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.

Re: [R] merging-binning data

2015-11-04 Thread Alaios via R-help
Thanks for your comments. Actually only the last group has a single element. 
The first group is always "full" of members and as that it works fine. Some 
constant spacing between the groups would be good as well and thus I will check 
quantiles.
Thanks for the great support and time invested on thisRegardsAlex



 On Wednesday, November 4, 2015 3:34 PM, Boris Steipe 
<boris.ste...@utoronto.ca> wrote:
   

 Whatever approach is "best" to define subsets depends completely on the 
semantics of the data. Your approach (a fixed number of equally spaced breaks) 
is the right one if the absolute ranges of the data is important. It should be 
obvious that either the top or the bottom group could contain only a single 
element, and also that any or all of the intermediate groups could be empty. 

If you want to control the number of elements in your groups, use quantiles 
instead. 

Your application may require to define the breaks in other ways. The code I 
have given you doesn't generalize well, as it depends on the equal spacing of 
breaks. As I mentioned earlier, I would not store the groups at all - but would 
define a function that returns a vector of elements in the group, and in the 
function body I would clearly and explicitly define the conditions for group 
membership (and comment it). That is how you make code for a task like this 
explicit and _maintainable_.


Cheers,
Boris


On Nov 4, 2015, at 9:19 AM, Alaios <ala...@yahoo.com> wrote:

> Thanks everything is solved and I was even able to plot boxplots as needed.
> The only minor is that the max element falls in the last category and is only 
> the single one element. Perhaps this can be from the way my data look like.
> Retgards
> Alex
> 
> 
> 
> On Wednesday, November 4, 2015 3:06 PM, Boris Steipe 
> <boris.ste...@utoronto.ca> wrote:
> 
> 
> The breaks are just the min() and max() in your groups. Something like
> 
>  sprintf("[%5.2f,%5.2f]", min(dBin[groups==2]), max(dBin[groups==2]))
> 
> ... should achieve what you need.
> 
> 
> B.
> 
> 
> 
> On Nov 4, 2015, at 8:45 AM, Alaios <ala...@yahoo.com> wrote:
> 
> > you are right.
> > by labels I mean the "categories", "breaks" that my data fall in.
> > To be part of group 2 for example you have to be in the range of [110,223) 
> > I need to keep those for my plots.
> > 
> > Did I describe it more precisely now?
> > Alex
> > 
> > 
> > 
> > On Wednesday, November 4, 2015 2:09 PM, Boris Steipe 
> > <boris.ste...@utoronto.ca> wrote:
> > 
> > 
> > I don't understand: 
> > - where does the "label" come from? (It's not an element of your data that 
> > I see.)
> > - what do you want to do with this "label" i.e. how does it need to be 
> > associated with the data?
> > 
> > 
> > B.
> > 
> > 
> > 
> > On Nov 4, 2015, at 7:57 AM, Alaios <ala...@yahoo.com> wrote:
> > 
> > > Thanks it works great and gives me group numbers as integers and thus I 
> > > can with which group the elements as needed (which (groups== 2))
> > > 
> > > Question though is how to keep also the labels for each group. For 
> > > example that my first group is the [13,206)
> > > 
> > > Regards
> > > Alex
> > > 
> > > 
> > > 
> > > On Wednesday, November 4, 2015 1:00 PM, Boris Steipe 
> > > <boris.ste...@utoronto.ca> wrote:
> > > 
> > > 
> > > I would transform the original numbers into integers which you can use as 
> > > group labels. The row numbers of the group labels are the indexes of your 
> > > values.
> > > 
> > > Example: assume your input vector is dBin
> > > 
> > > nGroups <- 5  # number of groups
> > > groups <- (dBin - min(dBin)) / (max(dBin) - min(dBin)) # rescale to the 
> > > range [0,1]
> > > groups <- floor(groups * nGroups) + 1  # discretize to nGroups integers
> > > 
> > > Now you can eg. get the indices for group 2
> > > 
> > > groups[groups == 2]
> > > 
> > > Depending on the nature of your input data, it may be better to keep 
> > > these groups in a column adjacent to your values, rather than in a 
> > > separate vector, or even better to just calculate the groups on the fly 
> > > in your downstream analysis with the approach given above in a function, 
> > > rather than storing them at all. These are simple operations that should 
> > > not add perceptibly to execution time.
> > > 
> > > Cheers,
> > > Bori

[R] merging-binning data

2015-11-03 Thread Alaios via R-help
Dear all,I am not exactly sure on what is the proper name of what I am trying 
to do.
I have a vector that looks like
 binDistance
   [,1]
 [1,] 238.95162
 [2,] 143.08590
 [3,]  88.50923
 [4,] 177.67884
 [5,] 277.54116
 [6,] 342.94689
 [7,] 241.60905
 [8,] 177.81969
 [9,] 211.25559
[10,] 279.72702
[11,] 381.95738
[12,] 483.76363
[13,] 480.98841
[14,] 369.75241
[15,] 267.73650
[16,] 138.55959
[17,] 137.93181
[18,] 184.75200
[19,] 254.64359
[20,] 328.87785
[21,] 273.15577
[22,] 252.52830
[23,] 252.52830
[24,] 252.52830
[25,] 262.20084
[26,] 314.93064
[27,] 366.02996
[28,] 442.77467
[29,] 521.20323
[30,] 465.33071
[31,] 366.60582
[32,]  13.69540
so numbers that start from 13 and go up to maximum 522 (I have also many other 
similar sets).I want to put these numbers into 5 categories and thus I have 
tried cut


Browse[2]> 
test<-cut(binDistance,seq(min(binDistance)-0.1,max(binDistance),length.out=scaleLength+1))
Browse[2]> test
 [1] (217,318]  (115,217]  (13.7,115] (115,217]  (217,318]  (318,420] 
 [7] (217,318]  (115,217]  (115,217]  (217,318]  (318,420]  (420,521] 
[13] (420,521]  (318,420]  (217,318]  (115,217]  (115,217]  (115,217] 
[19] (217,318]  (318,420]  (217,318]  (217,318]  (217,318]  (217,318] 
[25] (217,318]  (217,318]  (318,420]  (420,521]  (420,521]  (420,521] 
[31] (318,420]  (13.7,115]
Levels: (13.7,115] (115,217] (217,318] (318,420] (420,521]


I want then for the numbers of my initial vector that fall within the same 
"category" lets say the (318,420] to be collected on a vector.I rephrase it the 
indexes of my initial vector that have a value between 318 to 420 to be put in 
a same vector that I can process then as I want.
How I can do that effectively in R?
I would like to thank you for your replyRegardsAlex

[[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] threshold and replace values in a matrix

2015-10-21 Thread Alaios via R-help
Thanks. replace also looks to work okay. 


 On Wednesday, October 21, 2015 3:43 PM, PIKAL Petr 
<petr.pi...@precheza.cz> wrote:
   

 Hi

I wonder why you are asking that after quite a long use of R.

test[test < (-.5)] <- (-1)

Double loops seems to me the last resort in R if any other approach fails.

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Alaios
> via R-help
> Sent: Wednesday, October 21, 2015 3:35 PM
> To: R-help Mailing List
> Subject: [R] threshold and replace values in a matrix
>
> Dear all I have a table as that.
> test<-matrix(data=rnorm(100),ncol=10)
> and I want to find the values that are below my thresholdthreshold<- -
> 0.5and replace them with a -1 instead.
>
> I can of course write a double nested for loop to check one by one
> elementif (test[i,j]<= threshold)  test[i,j]<- -1 but that would be
> rather inneficient sice I have very large tables.
> Does R offer any "automation" for matrix data types?
> I would like to thank you in advance for your replyRegardsAlex
>
>      [[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.


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 that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.


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

[R] threshold and replace values in a matrix

2015-10-21 Thread Alaios via R-help
Dear all I have a table as that.
test<-matrix(data=rnorm(100),ncol=10)
and I want to find the values that are below my thresholdthreshold<- -0.5and 
replace them with a -1 instead.

I can of course write a double nested for loop to check one by one elementif 
(test[i,j]<= threshold)   test[i,j]<- -1
but that would be rather inneficient sice I have very large tables.
Does R offer any "automation" for matrix data types?
I would like to thank you in advance for your replyRegardsAlex

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

[R] Multinomial Fitting Distrbution

2015-04-21 Thread Alaios via R-help
Dear all,I am trying to fit a heavy tailed distribution and I have tried 
working with the mix function of the mixdist package.It looks like that this 
package allows fitting two distributions (or move) of the same family  and not 
combining different distributions (so mixing a geometric with a normal and so 
on).
After trying with the mix tool all the different combinations have failed. (I 
am not know if images are allowed here as attachments and thus I am sharing a 
link with the uploaded image )
http://alexpal.smugmug.com/photos/i-N76qWsM/0/O/i-N76qWsM.jpg
You can see that the three different families of distribution failed to capture 
correct the heavy tail at the end.
Can you please sugest me which functions (package) I could try in R for 
combining two different distributions for a fit?
I would like to thank you for your reply


|   |
|   |  |   |   |   |   |   |
|  |
|  |
| View on alexpal.smugmug.com | Preview by Yahoo |
|  |
|   |



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

[R] From replicate to accesing sublists

2015-04-01 Thread Alaios via R-help
Dear all,I have a R structure that was created with replicate.The data sets 
looks to be a matrix with each cell being a list.
str(error_suburban_0[,1],max.level=1)
List of 4
 $ vaR  :List of 20
  ..- attr(*, class)= chr variogram
 $ Shadowing:List of 2
  ..- attr(*, class)= chr geodata
 $ FIT  :List of 1
 $ propmodel:List of 12
  ..- attr(*, class)= chr lm


The error_suburban is a matrix that each field so 
error_suburban_0[,1], error_suburban_0[,2], error_suburban_0[,3], 
error_suburban_0[,4],... and so on,  contains the four sublists
$ vaR  :List of 20
  ..- attr(*, class)= chr variogram
 $ Shadowing:List of 2
  ..- attr(*, class)= chr geodata
 $ FIT  :List of 1
 $ propmodel:List of 12
  ..- attr(*, class)= chr lm


I would like to pick for each of these matrix elements to collect only the 
$Shadowing sublist
error_suburban_0[,1], error_suburban_0[,2], error_suburban_0[,3], 
error_suburban_0[,4]... and so on

Right now I am implementing this by a for loop that access each matrix element 
sequentially.

Can you please advice me if there is a better approach to do that in R?
Regards
Alex
 

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

[R] change language at console

2015-04-01 Thread Alaios via R-help
Hi all,I am a linux R user and my default R environemnt (after writing R in 
linux console) returns the error messages in German (I am not the system 
adminitstrator and I can not change system settings). I know that the English 
package is also installed so I guess I need to set some environmental variable 
for this.Any idea how I am doing that?
RegardsAlex


[[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] From replicate to accesing sublists

2015-04-01 Thread Alaios via R-help
Thanks.The code you gave me at the end works correctly.. I was wondering if 
there is more efficient way to access each element withouth this classic for 
loop.
RegardsAlex
 


 On Wednesday, April 1, 2015 5:54 PM, David Winsemius 
dwinsem...@comcast.net wrote:
   

 
On Apr 1, 2015, at 3:34 AM, Alaios via R-help wrote:

 Dear all,I have a R structure that was created with replicate.The data sets 
 looks to be a matrix with each cell being a list.
 str(error_suburban_0[,1],max.level=1)
 List of 4
 $ vaR      :List of 20
  ..- attr(*, class)= chr variogram
 $ Shadowing:List of 2
  ..- attr(*, class)= chr geodata
 $ FIT      :List of 1
 $ propmodel:List of 12
  ..- attr(*, class)= chr lm
 
 
 The error_suburban is a matrix that each field so 
 error_suburban_0[,1], error_suburban_0[,2], error_suburban_0[,3], 
 error_suburban_0[,4],... and so on,  contains the four sublists
 $ vaR      :List of 20
  ..- attr(*, class)= chr variogram
 $ Shadowing:List of 2
  ..- attr(*, class)= chr geodata
 $ FIT      :List of 1
 $ propmodel:List of 12
  ..- attr(*, class)= chr lm
 
 
 I would like to pick for each of these matrix elements to collect only the 
 $Shadowing sublist
 error_suburban_0[,1], error_suburban_0[,2], error_suburban_0[,3], 
 error_suburban_0[,4]... and so on
 
 Right now I am implementing this by a for loop that access each matrix 
 element sequentially.

It would have been better to show the results of dim() or dput(). Matrix 
objects (which are capable of holding lists) should be accessible with either a 
single or double argument to [. This should deliver contents:

for (i in 1:4)  print(  error_suburban_0[i]$Shadowing )

If the matrix has 4 or more rows, then that would be accessing only from the 
first column. If fewer than 4 rows, you would be wrapping around to later 
columns.

-- 
David.

 
 Can you please advice me if there is a better approach to do that in R?
 Regards
 Alex
  
 
     [[alternative HTML version deleted]]

This is a plain text mailing list. Please reconfigure your email client to sent 
in plain text.

-- 

David Winsemius
Alameda, CA, USA


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

[R] check a list that a sublist exists

2015-03-03 Thread Alaios via R-help
Hi all,I have a list that has the following fields.
$`80`
[1] Error in if (fitcass1[[2]] == \Error\) { : \n  Fehlender Wert, wo 
TRUE/FALSE nötig ist\n
attr(,class)
[1] try-error
attr(,condition)
simpleError in if (fitcass1[[2]] == Error) {    print(sprintf(error at 
fitting gamma distribution with %s periods. Mean %f %f Sd %f %f, flag, 
mean1, mean2, sd1, sd2))} else {    return(fitcass1)}: Fehlender Wert, wo 
TRUE/FALSE nötig ist


$`81`
[1] 0

$`9`
[1] 0

$`79`
$parameters
    pi   mu    sigma
1 0.9996796725 1.654832 127.6542
2 0.0003203275 17183.001125 302.8063

$se
 pi.se  mu.se sigma.se
1 2.113882e-05  0.1439152 14.22274
2 2.113882e-05 38.3582148  NaN

$distribution
[1] gamma



and so one. The content of each first level sublist are never the same. I want 
for each first-level sublist my list has to check fast that the current element 
, lets say the 79th has the $parameters.then I would keep only the numbers from 
the sublists that have this $parameters inside them and skip all the rest.
I tried something like exists(Mylist[[i]]$parameters) but it does not workI 
also tried the is.numeric(Mylist[[i]]$parameters)) but this line fails when the 
current sublist does not contain the $parameters field.
Can you please help me sort this out?
RegardsAlex


[[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] Save a list of list and search for values

2015-02-27 Thread Alaios via R-help
Hi,thanks all for the answer.I am using mclapply to call the lapply many times 
as needed. My function returns only a value if the fit is succesful.For testing 
if the fit is sucessfuly my code works like that
fitcass1-tryCatch(mix(mixdat=mydataOnVector,mixpar=params,dist=distribution),error=function(e)
 list(e,Error))
if (fitcass1[[2]]==Error){
                                              print(sprintf(error at fitting 
gamma distribution with %s periods. Mean %f %f Sd %f 
%f,flag,mean1,mean2,sd1,sd2))

                                            }else{ 
(code trunctated)... where I do some plots

so at the end of the function the code looks like
if (fitcass1[[2]]!=Error)
                                        return(fitcass1)

then I am calling the function above with
keeptheBigListAsJimSuggested-mclapply(expandMeanSigmaOn_list,callFunctionAbove,mydataOnVector=mydataOnVector,filename=filename,mc.cores=64)

If I am not wrong that would work. I will try later after my code stops 
executing. 
Any more comments on this?
RegardsAlex

 

 On Thursday, February 26, 2015 3:39 PM, jim holtman jholt...@gmail.com 
wrote:
   

 You store it as a list of lists and can then use the lapply function
to navigate for values.

result - lapply(1:1, function(x){
    mix(param[x])  # whatever your call to 'mix' is with some data
})





Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Thu, Feb 26, 2015 at 9:27 AM, Alaios via R-help r-help@r-project.org wrote:
 Dear all,in my code I am using the mix() function that returns results in a 
 list. The result looks like
 List of 10
  $ parameters  :'data.frame':  2 obs. of  3 variables:
  ..$ pi  : num [1:2] 0.77 0.23
  ..$ mu  : num [1:2] -7034 162783
  ..$ sigma: num [1:2] 20235 95261
  $ se          :'data.frame':  2 obs. of  3 variables:
  ..$ pi.se  : num [1:2] 0.0423 0.0423
  ..$ mu.se  : num [1:2] 177 12422
  ..$ sigma.se: num [1:2] 1067 65551
  $ distribution: chr norm
  $ constraint  :List of 8
  ..$ conpi  : chr NONE
  ..$ conmu  : chr NONE
  ..$ consigma: chr NONE
  ..$ fixpi  : NULL
  ..$ fixmu  : NULL
  ..$ fixsigma: NULL
  ..$ cov    : NULL
  ..$ size    : NULL
  $ chisq      : num 28
  $ df          : num 5
  $ P          : num 3.67e-05
  $ vmat        : num [1:5, 1:5] 1.79e-03 -3.69e-01 -1.17e+02 2.95e+01 
-2.63e+03 ...
  $ mixdata    :Classes ‘mixdata’ and 'data.frame':    11 obs. of  2 variables:
  ..$ X    : num [1:11] 1e+04 2e+04 3e+04 4e+04 5e+04 6e+04 7e+04 8e+04 9e+04 
1e+05 ...
  ..$ count: int [1:11] 993 137 82 30 21 5 7 14 21 2 ...
  $ usecondit  : logi FALSE
  - attr(*, class)= chr mix

 In my code I am trying around 10.000 fit (and each of these fits returns the 
 list above) and I want to keep those in a way that later on I would be able 
 to search inside all the lists.For example I would like to find inside those 
 10.000 lists which one has the smallest $chisq value. What would be a 
 suitable way to implement that in R? Luckily I am working in a computer with 
 a lot of ram so storing 10.000 lists temporary in memory before saving to 
 disk would not be a problem.
 What would you suggest me?
 RegardsAlex

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

Re: [R] Save a list of list and search for values

2015-02-27 Thread Alaios via R-help
Sorry Jim I forgot to reply on what I am trying to do.I  have many data sets 
that contain some numbers: I am trying to fit those with a mixture 
distribution. For that I am using the mix function that returns me back the 
fitted parameters and the chi square (which is a first performance 
indicator).After all the fits are completed and gathered on the big list, I 
would like to see which are the fits with the better chi square numbers and 
what are their typical numbers. After I see that results I would have to think 
more on how to proceed
RegardsAlex
 

 On Friday, February 27, 2015 1:58 PM, Alaios ala...@yahoo.com wrote:
   

 Hi,thanks all for the answer.I am using mclapply to call the lapply many times 
as needed. My function returns only a value if the fit is succesful.For testing 
if the fit is sucessfuly my code works like that
fitcass1-tryCatch(mix(mixdat=mydataOnVector,mixpar=params,dist=distribution),error=function(e)
 list(e,Error))
if (fitcass1[[2]]==Error){
                                              print(sprintf(error at fitting 
gamma distribution with %s periods. Mean %f %f Sd %f 
%f,flag,mean1,mean2,sd1,sd2))

                                            }else{ 
(code trunctated)... where I do some plots

so at the end of the function the code looks like
if (fitcass1[[2]]!=Error)
                                        return(fitcass1)

then I am calling the function above with
keeptheBigListAsJimSuggested-mclapply(expandMeanSigmaOn_list,callFunctionAbove,mydataOnVector=mydataOnVector,filename=filename,mc.cores=64)

If I am not wrong that would work. I will try later after my code stops 
executing. 
Any more comments on this?
RegardsAlex

 

 On Thursday, February 26, 2015 3:39 PM, jim holtman jholt...@gmail.com 
wrote:
   

 You store it as a list of lists and can then use the lapply function
to navigate for values.

result - lapply(1:1, function(x){
    mix(param[x])  # whatever your call to 'mix' is with some data
})





Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Thu, Feb 26, 2015 at 9:27 AM, Alaios via R-help r-help@r-project.org wrote:
 Dear all,in my code I am using the mix() function that returns results in a 
 list. The result looks like
 List of 10
  $ parameters  :'data.frame':  2 obs. of  3 variables:
  ..$ pi  : num [1:2] 0.77 0.23
  ..$ mu  : num [1:2] -7034 162783
  ..$ sigma: num [1:2] 20235 95261
  $ se          :'data.frame':  2 obs. of  3 variables:
  ..$ pi.se  : num [1:2] 0.0423 0.0423
  ..$ mu.se  : num [1:2] 177 12422
  ..$ sigma.se: num [1:2] 1067 65551
  $ distribution: chr norm
  $ constraint  :List of 8
  ..$ conpi  : chr NONE
  ..$ conmu  : chr NONE
  ..$ consigma: chr NONE
  ..$ fixpi  : NULL
  ..$ fixmu  : NULL
  ..$ fixsigma: NULL
  ..$ cov    : NULL
  ..$ size    : NULL
  $ chisq      : num 28
  $ df          : num 5
  $ P          : num 3.67e-05
  $ vmat        : num [1:5, 1:5] 1.79e-03 -3.69e-01 -1.17e+02 2.95e+01 
-2.63e+03 ...
  $ mixdata    :Classes ‘mixdata’ and 'data.frame':    11 obs. of  2 variables:
  ..$ X    : num [1:11] 1e+04 2e+04 3e+04 4e+04 5e+04 6e+04 7e+04 8e+04 9e+04 
1e+05 ...
  ..$ count: int [1:11] 993 137 82 30 21 5 7 14 21 2 ...
  $ usecondit  : logi FALSE
  - attr(*, class)= chr mix

 In my code I am trying around 10.000 fit (and each of these fits returns the 
 list above) and I want to keep those in a way that later on I would be able 
 to search inside all the lists.For example I would like to find inside those 
 10.000 lists which one has the smallest $chisq value. What would be a 
 suitable way to implement that in R? Luckily I am working in a computer with 
 a lot of ram so storing 10.000 lists temporary in memory before saving to 
 disk would not be a problem.
 What would you suggest me?
 RegardsAlex

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

[R] Save a list of list and search for values

2015-02-26 Thread Alaios via R-help
Dear all,in my code I am using the mix() function that returns results in a 
list. The result looks like
List of 10
 $ parameters  :'data.frame':   2 obs. of  3 variables:
  ..$ pi   : num [1:2] 0.77 0.23
  ..$ mu   : num [1:2] -7034 162783
  ..$ sigma: num [1:2] 20235 95261
 $ se  :'data.frame':   2 obs. of  3 variables:
  ..$ pi.se   : num [1:2] 0.0423 0.0423
  ..$ mu.se   : num [1:2] 177 12422
  ..$ sigma.se: num [1:2] 1067 65551
 $ distribution: chr norm
 $ constraint  :List of 8
  ..$ conpi   : chr NONE
  ..$ conmu   : chr NONE
  ..$ consigma: chr NONE
  ..$ fixpi   : NULL
  ..$ fixmu   : NULL
  ..$ fixsigma: NULL
  ..$ cov : NULL
  ..$ size    : NULL
 $ chisq   : num 28
 $ df  : num 5
 $ P   : num 3.67e-05
 $ vmat    : num [1:5, 1:5] 1.79e-03 -3.69e-01 -1.17e+02 2.95e+01 -2.63e+03 
...
 $ mixdata :Classes ‘mixdata’ and 'data.frame': 11 obs. of  2 variables:
  ..$ X    : num [1:11] 1e+04 2e+04 3e+04 4e+04 5e+04 6e+04 7e+04 8e+04 9e+04 
1e+05 ...
  ..$ count: int [1:11] 993 137 82 30 21 5 7 14 21 2 ...
 $ usecondit   : logi FALSE
 - attr(*, class)= chr mix

In my code I am trying around 10.000 fit (and each of these fits returns the 
list above) and I want to keep those in a way that later on I would be able to 
search inside all the lists.For example I would like to find inside those 
10.000 lists which one has the smallest $chisq value. What would be a suitable 
way to implement that in R? Luckily I am working in a computer with a lot of 
ram so storing 10.000 lists temporary in memory before saving to disk would not 
be a problem.
What would you suggest me?
RegardsAlex

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

[R] from expand.grid to a list (lapply)

2015-02-25 Thread Alaios via R-help
Hi all,I would like to use an expand.grid functionality that would give me at 
the end a listso far my code looks like:
 sigma_max_On_seq-seq(0.05,100,length.out=1)
mean_max_On_seq-seq(2,1),length.out=1)
expandMeanSigmaOn-expand.grid(mean_max_On_seq,mean_max_On_seq,sigma_max_On_seq,sigma_max_On_seq)
that gives me at the end all the possible combinations as a data 
frame.Browse[1] str((expandMeanSigmaOn))
'data.frame':   XXX obs. of  4 variables:
 $ Var1: num  1 11432 22864 34295 45727 ...
 $ Var2: num  1 1 1 1 1 1 1 1 1 1 ...
 $ Var3: num  0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 ...
 $ Var4: num  0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 ...
 - attr(*, out.attrs)=List of 2
  ..$ dim : int  10 10 10 10
  ..$ dimnames:List of 4
  .. ..$ Var1: chr  Var1= 1.00 Var1= 11432.44 Var1= 22863.89 Var1= 
34295.33 ...
  .. ..$ Var2: chr  Var2= 1.00 Var2= 11432.44 Var2= 22863.89 Var2= 
34295.33 ...
  .. ..$ Var3: chr  Var3=  0.05000 Var3= 31.48065 Var3= 62.91131 Var3= 
94.34196 ...
  .. ..$ Var4: chr  Var4=  0.05000 Var4= 31.48065 Var4= 62.91131 Var4= 
94.34196 ...

 but I want to have a list that I would be able to use it as input into a 
lapply function. The lapply should use then each list entry independently 
giving as input variables only the current $Var1,$Var2,$Var3,$Var4

How I can convert in R the data.frame into a list?
I would like to thank you in advance for your replyRegardsAlex


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

[R] Parallel for that does not keep the results

2015-02-24 Thread Alaios via R-help
Hi all,I am working in a multi core machine and I am trying to make some 
parallel code to speed up the process.
I have seen already the foreach packet but it looks like that it always combine 
the results on a list. My case though is simpler since I am plotting and saving 
in external files, inside the loop, and thus I do not need to keep anything 
from the loop.My code looks like
    expandMeanSigmaOn-expand.grid(1:100,100:200,5:10,5000:6000)
   for (i in 1:length(expandMeanSigmaOn$Var1)){
                                        mean1-expandMeanSigmaOn$Var1[i]
                                        mean2-expandMeanSigmaOn$Var2[i]
                                        sd1-expandMeanSigmaOn$Var3[i]
                                        sd2-expandMeanSigmaOn$Var4[i]
                                   
                                            
fitcass1-mix(mydata,mixparam(c(mean1,mean2),(c(sd1,sd2)),gamma)))
                                            
pdf(file=paste(filename,ON.pdf,sep=));plot(fitcass1);dev.off() # plotting 
and saving
                                            
save(OnFitList,file=paste(filename,ON.Rdata,sep=)) # plotting and saving
                                            }
                                        }
 }

as you can see from the code above, given some input values I am trying some 
fits, which then I am saving the results. Do you think that the foreach 
packaget would be suitable (since the returning list can grow very large and 
eat up memory) or should I try some alternative package?
I would like to thank you in advance for your replyRegardsAlex

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

[R] save structure to be accesible later

2015-02-05 Thread Alaios via R-help
Dear all,I have a function that returns the following list. At the end I will 
call my function 1000 times and I want to keep for each of these 1000 results 
(the structure as given below)in an order to be accessible later (Load the 1000 
results and access them within a for loop for example)
How should I approach the issue?I would like to thank you for your 
exampleRegardsAlex
P,S The result of my function



 str(fitcass1)
List of 10
 $ parameters  :'data.frame':   2 obs. of  3 variables:
  ..$ pi   : num [1:2] 0.833 0.167
  ..$ mu   : num [1:2] 8828 11
  ..$ sigma: num [1:2] 18085 1543
 $ se  :'data.frame':   2 obs. of  3 variables:
  ..$ pi.se   : num [1:2] NA NA
  ..$ mu.se   : num [1:2] NA NA
  ..$ sigma.se: num [1:2] NA NA
 $ distribution: chr gamma
 $ constraint  :List of 8
  ..$ conpi   : chr NONE
  ..$ conmu   : chr NONE
  ..$ consigma: chr NONE
  ..$ fixpi   : NULL
  ..$ fixmu   : NULL
  ..$ fixsigma: NULL
  ..$ cov : NULL
  ..$ size    : NULL
 $ chisq   : num 52.4
 $ df  : num 5
 $ P   : num 4.57e-10
 $ vmat    : num [1:5, 1:5] NA NA NA NA NA NA NA NA NA NA ...
 $ mixdata :Classes ‘mixdata’ and 'data.frame': 11 obs. of  2 variables:
  ..$ X    : num [1:11] 1e+04 2e+04 3e+04 4e+04 5e+04 6e+04 7e+04 8e+04 9e+04 
1e+05 ...
  ..$ count: int [1:11] 993 137 82 30 21 5 7 14 21 2 ...
 $ usecondit   : logi FALSE
 - attr(*, class)= chr mix



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

[R] combinations between two vectors

2014-12-18 Thread Alaios via R-help
Hi all,I am looking for a function that would give me all the combinations 
between two vectors.Lets take as example the 

test-seq(1,3,by=5000)
Browse[2] test
[1] 1  5001 10001 15001 20001 25001
I want all the combinations between two times the test... I think this is  
called permutation so a function that could do permutation(test,test)and 
produce the following
1,11,50011,100011,15001
3,13,5001...25001,20001,25001,25001
is there such a function ?
RegardsAlex


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


[R] combining two distributions

2014-12-08 Thread Alaios via R-help
(I am sorry if you have received this email twice but it does not look sent on 
my client)

  

 Hi all,I am having some heavy tailed data and I am trying to think of the more 
appropriate package for the fitting.The canonical try should be something like 
exponential and pareto or exponential + gamma (or gamma + gamma with different 
shape parameters). I am trying to have one distribution that is classical 
thin tailed one and another one which is more like a power law or close 
(pareto,gamma,weibull, log-normal).
Do you have any recommendation with which packages I can start on and if the 
functions you have in mind they can also provide information like AIC or BIC so 
to help me choose the best combinations?
I would like to thank you in advance for your help
RegardsAlex


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


[R] combining two distributions

2014-12-08 Thread Alaios via R-help
Hi all,I am having some heavy tailed data and I am trying to think of the more 
appropriate package for the fitting.The canonical try should be something like 
exponential and pareto or exponential + gamma (or gamma + gamma with different 
shape parameters). I am trying to have one distribution that is classical 
thin tailed one and another one which is more like a power law or close 
(pareto,gamma,weibull, log-normal).
Do you have any recommendation with which packages I can start on and if the 
functions you have in mind they can also provide information like AIC or BIC so 
to help me choose the best combinations?
I would like to thank you in advance for your help
RegardsAlex
[[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] combining two distributions

2014-12-08 Thread Alaios via R-help
Hi,thanks a lot for the answer. I think that my problem is before packages. I 
have a large amount of different datasets and I had a random look on their 
histograms. I know that some of them look like the combination I have explained 
(exponential+pareto, exponential+gamma) but I am not sure still.I wanted to 
know if there is a preliminary approach where a fitting algorithms tries some 
of the suggested combinations and give me hints where to focus my future 
research.I will have a look on the package you suggested.
RegardsAlex
 

 On Monday, December 8, 2014 11:23 PM, Spencer Graves 
spencer.gra...@prodsyse.com wrote:
   

       Have you considered distr and related packages?


      If this does not solve your problem, have you considered 
searching with findFn in the sos package?  If that still does not 
produce sufficient enlightenment, please try this list again with 
commented, minimal, self-contained, reproducible code describing what 
you want in a bit more detail (as indicated at the end of emails on this 
list).


      Spencer


On 12/8/2014 10:45 AM, Alaios via R-help wrote:
 (I am sorry if you have received this email twice but it does not look sent 
 on my client)

    

  Hi all,I am having some heavy tailed data and I am trying to think of the 
more appropriate package for the fitting.The canonical try should be something 
like exponential and pareto or exponential + gamma (or gamma + gamma with 
different shape parameters). I am trying to have one distribution that is 
classical thin tailed one and another one which is more like a power law or 
close (pareto,gamma,weibull, log-normal).
 Do you have any recommendation with which packages I can start on and if the 
 functions you have in mind they can also provide information like AIC or BIC 
 so to help me choose the best combinations?
 I would like to thank you in advance for your help
 RegardsAlex

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


[R] starting with mixture distribution

2014-11-30 Thread Alaios via R-help
Hi.I was using the last night the fitdistr package to start with some fitting. 
I have some data sets that even though have a very gaussian distribution it 
looks like that also it has some very heavy tails, that can not be accurately 
be modelled by a gaussian distribution.Where should I give a try with mixture 
of distribution?
RegardsAlex


[[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] From Strings to Variable name. When get does not work

2014-03-12 Thread Alaios
Hi all,
I would like to turn some long strings like MyString$Myfield$MySubfield into 
variables but it looks like that the get does not like lists



so for example:

 test-list(a=2) 

test 
$a 
[1] 2 


get(test) 
$a 
[1] 2 


get(test$a) 
Fehler in get(test$a) : Objekt 'test$a' nicht gefunden 

lapply(test,function(x) return (x$a)) 
Fehler in x$a : $ operator is invalid for atomic vectors 

What should I do to read those lists I have as strings?

I would like to thank you in advance for your reply

regards
A

[[alternative HTML version deleted]]

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


[R] Read text file

2014-03-11 Thread Alaios
Hi all
I am trying to read some text files with the following format:

1377262633.948000    
$GPRMC,125708.00,A,5047.66107,N,00603.65528,E,0.203,247.36,230813,,,A*60
1377262633.958000    $GPVTG,247.36,T,,M,0.203,N,0.377,K,A*3B
1377262633.968000    
$GPGGA,125708.00,5047.66107,N,00603.65528,E,1,09,0.85,169.3,M,46.5,M,,*52
1377262633.978000    $GPGSA,A,3,29,21,31,25,16,05,06,13,271.78,0.85,1.57*0C
1377262633.998000    
$GPGSV,3,1,12,03,01,266,,05,16,043,39,06,21,263,43,13,07,330,43*70
1377262634.008000    
$GPGSV,3,2,12,16,37,302,45,18,03,149,,21,59,166,33,23,04,304,16*75
1377262634.028000    
$GPGSV,3,3,12,25,18,129,21,27,11,260,39,29,45,071,47,31,35,211,47*7C

but this returns me the following:

read.csv(sensor_0.log,sep=,)
Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
  more columns than column names

I guess the problem is that the columns are not consistent on a per row basis.
What  I am trying to do though is to read only the lines that contain the 
$GPGLL or the $GPGLA entries (in the example they corresponds to 3rd and 4th 
line).
How can I do this in R?

Regards
A
[[alternative HTML version deleted]]

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


[R] Ignore errors and proceed to next

2014-02-14 Thread Alaios
Hi all,
I have a very large number of vectors that I want first to look fast which 
distribution might be considered candidate for fitting.
I made a simple loop that checks for all vector (the code below is for one 
vector and being called for each vector separately). If a good fit is found 
this is dumped to a txt file so to allow me later on, see results

distList-c(norm,exp,gamma,lnorm)
    for (dist in distList) {
    
        if (gofstat(fitdist(onVector,distr=dist))$kstest ==not rejected){
        # keep it
      out-capture.output(gofstat(fitdist(onVector,distr=distr))$ks)
      print(sprintf(Saving to file %s ,filename))
      cat(out,file=paste(filename,.txt,sep=),sep=\n,append=TRUE)
      
        }
    }
the major problem is that these for loops return errors (sometimes for a given 
vector a specific distribution does not make sense or the vector might be zero 
or containing only many times the same element)    . The easiest would be in 
errors and warning just move to the next element of the for loop.
Something like that

for ()
{
 if error==skip to next element
 else do normal stuff
}
how I can do that in R?
Regards
Alex
[[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] Ignore errors and proceed to next

2014-02-14 Thread Alaios
Hi thanks for the answer.
I have so vast majority of vectors that some distributions will not work for 
some cases but they work for others pretty well. This is the reason I store 
only those that worked to helpe get a coarse understanding how to proceed. If 
you have a better idea let me know





On Friday, February 14, 2014 10:35 AM, Frede Aakmann Tøgersen 
fr...@vestas.com wrote:
 
Hi

See

?try
?tryCatch

So you still want to do these distribution tests even though you have been 
warned not to?

Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance  Modeling

Technology  Service Solutions
T +45 9730 5135
M +45 2547 6050
fr...@vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 



 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Alaios
 Sent: 14. februar 2014 10:14
 To: R-help@r-project.org
 Subject: [R] Ignore errors and proceed to next
 
 Hi all,
 I have a very large number of vectors that I want first to look fast which
 distribution might be considered candidate for fitting.
 I made a simple loop that checks for all vector (the code below is for one
 vector and being called for each vector separately). If a good fit is found 
 this
 is dumped to a txt file so to allow me later on, see results
 
 distList-c(norm,exp,gamma,lnorm)
     for (dist in distList) {
 
         if (gofstat(fitdist(onVector,distr=dist))$kstest ==not rejected){
         # keep it
       out-capture.output(gofstat(fitdist(onVector,distr=distr))$ks)
       print(sprintf(Saving to file %s ,filename))
       cat(out,file=paste(filename,.txt,sep=),sep=\n,append=TRUE)
 
         }
     }
 the major problem is that these for loops return errors (sometimes for a
 given vector a specific distribution does not make sense or the vector might
 be zero or containing only many times the same element)    . The easiest
 would be in errors and warning just move to the next element of the for
 loop.
 Something like that
 
 for ()
 {
  if error==skip to next element
  else do normal stuff
 }
 how I can do that in R?
 Regards
 Alex
     [[alternative HTML version deleted]]
[[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] Which distribution to select (massive fitting)

2014-02-10 Thread Alaios
Hi all,
I have a large number of measurements from which I select a large number of 
unique vectors. For each vectors I would like to test which distribution might 
be a candidate for fitting.
It is impossible to look on each vector separately but I can inside a for loop 
test different models and based on their goodness of fit to make offline 
decisions (I will be saving goodness of fits results on a text file).

Do you know given a vector how I can get the goodness of fit for the basic 
distributions : norm, lnorm, pois, exp, gamma, nbinom,
geom, beta, unif and logis

Is it possible to try many of those (or at least some of the above) and try to 
get these results?

Regards
Alex
[[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] Density or Boxplot with median and mean

2014-01-22 Thread Alaios
Hi there,
I would like to be able to draw a density plot or a box plot where the median 
and the median and the mean would be visible.

If I decide a density plot I need to put two big marks one for the median and 
one for the mean, which I do not know how I can achieve to put marks in a 
density plot. For that I am using plot(density(myVector))

while on the boxplot median is already visible but mean not. To have the mean 
there I would have to add one more line on each boxplot, perhaps of different 
color but I am not sure if that is possible in R. boxplot(myVector) I am using

where myVector can be something like myVector-seq(1,200)

I would like to thank you all in advance 
Regards
Alex
[[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] Density or Boxplot with median and mean

2014-01-22 Thread Alaios
Thanks Jim.. once again your rock





On Wednesday, January 22, 2014 9:51 AM, Jim Lemon j...@bitwrit.com.au wrote:
 
On 01/22/2014 07:37 PM, Alaios wrote:

 Hi there,
 I would like to be able to draw a density plot or a box plot where the median 
 and the median and the mean would be visible.

 If I decide a density plot I need to put two big marks one for the median and 
 one for the mean, which I do not know how I can achieve to put marks in a 
 density plot. For that I am using plot(density(myVector))

 while on the boxplot median is already visible but mean not. To have the mean 
 there I would have to add one more line on each boxplot, perhaps of different 
 color but I am not sure if that is possible in R. boxplot(myVector) I am using

 where myVector can be something like myVector-seq(1,200)

Hi Alex,
On a density plot you can use abline:

abline(v=mean(myVector),col=red)
abline(v=median(myVector),col=green)

I don't know of any boxplot function that will plot two measures of 
central tendency, but box.heresy in plotrix will plot any one measure 
that you like.

Jim
[[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] Select 5 identical numbers

2014-01-20 Thread Alaios
Dear all,
I would like to select from a vector of 10 elements, 5 of those that are 
identical.
How can I do that in R? I guess one way would be to taking random numbers and 
see if that appeared again. Is though there a more straightforward approach?

Regards
Alex
[[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] Select 5 identical numbers

2014-01-20 Thread Alaios
Hi,
I want from a vector containing has like 1000 elements to select X of it 
randomly but with never selecting the same element again. Each one should be 
unique element of the vector.
Is this more precise now?

Regards
Alex




On Monday, January 20, 2014 7:54 PM, Alaios ala...@yahoo.com wrote:
 
Dear all,
I would like to select from a vector of 10 elements, 5 of those that are 
identical.
How can I do that in R? I guess one way would be to taking random numbers and 
see if that appeared again. Is though there a more straightforward approach?

Regards
Alex
    [[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] save table to txt file in a printable form

2013-11-19 Thread Alaios
Hi there,
I would like to save tabular (in R just matrices) in a txt file but in a way 
that they would be somehow readable.
That means keeping columns aligned and rows so one can read easily for example 
the 2,3 element.

IS there a way to do that in R?
capture.output for example does not produce tables in the way I want to have 
those.

Regards
Alex
[[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] Grid type of sampling in geodata

2013-11-13 Thread Alaios
Hi all,
I have spatial field created with grf and I was wondering if I can sample in 
lines, something that can resemble sampling outdoors at the streets.
Random sampling looks to far of what I want to have.

there is in geodata package the sample.geodata but this looks like to be random 
samples.

I would like to thank you in advance for your help

Regards
A.
[[alternative HTML version deleted]]

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


Re: [R] Colour Legend text, in a print color2D.matplot

2013-11-12 Thread Alaios
Hi Jim, it worked nicely.
par(mar) looks to control the space at the bottom left right and top.. What If 
I want to increase a bit the distance between the plotted matrix and the added 
color legend ? They look to be at my version slightly packed together.

Regards
Alex





On Monday, November 11, 2013 3:07 AM, Alaios ala...@yahoo.com wrote:
 
Thanks! It worked. 

Regards
Alex






On Monday, November 11, 2013 12:02 AM, Jim Lemon j...@bitwrit.com.au wrote:

On 11/11/2013 04:57 AM, Alaios wrote:

 Hi all,

 I am plotting very nice looking mattrices with  plotrin...

 so far so good, I would like though to ask you if it would be possible to add 
 at the bottom of the color.legend (this lovely color bar that maps colors to 
 numbers).
 Would that be possible to do that?

Hi Alex,
It is not too difficult:

# first allow printing outside the plot
par(xpd=TRUE)
# get the x component of the label
# from the values passed to color.legend
# see the help page
labelx-(xl+xr)/2
# get the y coordinate from the y value
labely-yb-strheight(M)
# display the label
text(labelx,labely,mylabel)
# restore the clipping
par(xpd=FALSE)

Jim
    [[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] Handle Gps coordinates

2013-11-12 Thread Alaios
Dear all,
I would like to ask you if there are any gps libraries.


I would like to be able to handle them,
-like calculate distances in meters between gps locations,
-or find which gps location is closer to a list of gps locations.

Is there something like that in R?

I would like to tthank you in advance for your reply

Regards
Alex
[[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] Colour Legend text, in a print color2D.matplot

2013-11-10 Thread Alaios
Hi all,

I am plotting very nice looking mattrices with  plotrin...

so far so good, I would like though to ask you if it would be possible to add 
at the bottom of the color.legend (this lovely color bar that maps colors to 
numbers).
Would that be possible to do that?

I would like to thank you in advance for your reply

Regards
Alex
[[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] Plotrix: Add text below the color- legend.

2013-11-10 Thread Alaios
Hi all,
I am plotting very nice and sexy images with plotrix :)
so far so good, I would like though to ask you if it would be possible to add 
at the bottom of the color.legend (this lovely color bar that maps colors to 
numbers).
Would that be possible to do that?

I would like to thank you in advance for your reply

Regards
Alex
[[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] Colour Legend text, in a print color2D.matplot

2013-11-10 Thread Alaios
Thanks! It worked. 

Regards
Alex





On Monday, November 11, 2013 12:02 AM, Jim Lemon j...@bitwrit.com.au wrote:
 
On 11/11/2013 04:57 AM, Alaios wrote:

 Hi all,

 I am plotting very nice looking mattrices with  plotrin...

 so far so good, I would like though to ask you if it would be possible to add 
 at the bottom of the color.legend (this lovely color bar that maps colors to 
 numbers).
 Would that be possible to do that?

Hi Alex,
It is not too difficult:

# first allow printing outside the plot
par(xpd=TRUE)
# get the x component of the label
# from the values passed to color.legend
# see the help page
labelx-(xl+xr)/2
# get the y coordinate from the y value
labely-yb-strheight(M)
# display the label
text(labelx,labely,mylabel)
# restore the clipping
par(xpd=FALSE)

Jim
[[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] convert one digit numbers to two digits one

2013-11-06 Thread Alaios
Hi all,
the following returns the hour and the minutes

paste(DataSet$TimeStamps[selectedInterval$start,4], 
DataSet$TimeStamps[selectedInterval$start,5],sep=:)
[1] 12:3

the problem is that from these two I want to create a time stamp so 12:03. The 
problem is that the number 3 is not converted to 03. Is there an easy way when 
I have one digit integer to add a zero in the front? Two digits integers are 
working fine so far, 12:19, or 12:45 would appear correctly

I would like to thank you in advance for your help

Regards
Alex
[[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] add a color band

2013-11-04 Thread Alaios
Hi Jim Lemon,
thanks for the help, I appreciate this.

right now my code looks like.


par(mar=c(5,4,4,5))
color2D.matplot(data,1,c(0,1),0,xlab=,ylab=Spans,
  main=color.scale,xrange=c(-110,-50),border=NA,axes=F)
color.legend(357,30,370,100,seq(-110,-50,length.out=13),
  align=rb,rect.col=color.scale(1:13,1,c(0,1),0),
  gradient=y)


my major problem now is that the 

a. text in  the color bar is squeezed so -50 overlaps with -60 and so on
b. for some reason the color bar sometimes (the same code is called for all the 
data matrices I have) is misaligned  in different positions each time

Could you please also help me with those two?

Regards
Alex




On Monday, October 28, 2013 9:00 AM, Alaios ala...@yahoo.com wrote:
 


Hi Jim and thanks for your answer... I might be too tired with my new born or 
just exhausted.

I am sharing for everyone a small data snipset that you can load
https://www.dropbox.com/s/fh8jhwujgunmtrb/DataToPlotAsImage.Rdata



load(DataToPlotAsImage.Rdata)
require(plotrix)
browser()
test-data
# this transforms the values of test into red-yellow
color2D.matplot(test,axes=F,xlab=,ylab=,main=color.scale,
  extremes=c(#FF,#00),show.legend=FALSE)
  
axis(1,at=seq(1,ncol(test),length.out=10),labels=seq(201,300,length.out=10))
color.legend(104,30,112,70,seq(-110,-30,length=11),
  align=rb,rect.col=color.scale(1:30,1,c(0,1),0),gradient=y)

as you can see I have problems where the legend appears. My par(usr  returned 
me
par(usr)
# [1]   0 351   0 200

but I am not sure how to read that to place the legend at a useful place. 
second I am not sure why the image is so full with black rows..

What I want is to have the legend visible
and later on customize the x axis to write custom string of different 
size... First I need though to fix the more severe problems as I have 
described

RegardsAlex




On Sunday, October 27, 2013 12:25 PM, Jim Lemon j...@bitwrit.com.au wrote:

On 10/27/2013 08:39 AM, Alaios wrote:
 Hi Jim and thanks for your answer... I might be too tired with my new
 born or just exhausted.

 I am attaching for everyone a small data snipset that you can load


 load(DataToPlotAsImage.Rdata)
 require(plotrix)
 browser()
 test-data
 # this transforms the values of test into red-yellow
 color2D.matplot(test,axes=F,xlab=,ylab=,main=color.scale,
 extremes=c(#FF,#00),show.legend=FALSE)

 axis(1,at=seq(1,ncol(test),length.out=10),labels=seq(201,300,length.out=10))
 color.legend(104,30,112,70,seq(-110,-30,length=11),
 align=rb,rect.col=color.scale(1:30,1,c(0,1),0),gradient=y)

 as you can see I have problems where the legend appears. My par(usr
 returned me
 par(usr)
 # [1] 0 351 0 200

 but I am not sure how to read that to place the legend at a useful place.
 second I am not sure why the image is so full with black rows..

 What I want is to have the legend visible
 and later on customize the x axis to write custom string of different
 size... First I need though to fix the more severe problems as I have
 described

Hi Alex,
I'm not sure why you have created a copy of data to plot it. I can get 
quite a sensible plot using this:

par(mar=c(5,4,4,5))
color2D.matplot(data,1,c(0,1),0,xlab=,ylab=,
  main=color.scale,xrange=c(-110,-50),border=NA)
color.legend(357,30,370,100,seq(-110,-50,length.out=6),
  align=rb,rect.col=color.scale(1:6,1,c(0,1),0),
  gradient=y)

Notice several things. First, when you have a large number of cells in a 
plot like this, setting the border to NA means that you don't get mostly 
borders (default = black) in the plot. The second thing is that your 
data range is -107.18150 to -54.07662. In order to get rounded numbers 
in your legend, I have set the xrange argument to -110 to -50. This 
gives a neat looking legend that spans your data, a bit like the
pretty function would do. It also means that the color mapping is to 
that range and is the same in the legend as in the plot. I have left 
enough space on the right of the plot to fit in the legend, as that was 
where you said you wanted it in your last email. What par(usr) tells 
you is the dimensions of the plot in user units. Here it is x=0 at the 
left, x=351 at the right, y=0 at the bottom and y=200 at the top.


Jim
    [[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] add a color band

2013-11-04 Thread Alaios
Hi Jim,
thanks for the answer! I toyed around as you said and now they look cool and 
sexy! many thanks!

Do you know if there is a way to compress a bit the output? The image type of 
functions have the useRaster parameter to set to have a compressed output. 
Right now the produced plots are around 400kBytes which is a lot and I am 
looking for ways to reduce image size.

I would like to thank you for you reply 

Alex





On Monday, November 4, 2013 11:59 AM, Jim Lemon j...@bitwrit.com.au wrote:
 
On 11/04/2013 08:09 PM, Alaios wrote:
 Hi Jim Lemon,
 thanks for the help, I appreciate this.

 right now my code looks like.


 par(mar=c(5,4,4,5))
 color2D.matplot(data,1,c(0,1),0,xlab=,ylab=Spans,
 main=color.scale,xrange=c(-110,-50),border=NA,axes=F)
 color.legend(357,30,370,100,seq(-110,-50,length.out=13),
 align=rb,rect.col=color.scale(1:13,1,c(0,1),0),
 gradient=y)


 my major problem now is that the
 a. text in the color bar is squeezed so -50 overlaps with -60 and so on
 b. for some reason the color bar sometimes (the same code is called for
 all the data matrices I have) is misaligned in different positions each time

 Could you please also help me with those two?

Hi Alex,
For your first question, I would simply extend the color legend vertically:

color.legend(357,30,370,150,seq(-110,-50,length.out=13),
  align=rb,rect.col=color.scale(1:13,1,c(0,1),0),
  gradient=y)

For the second one, you obviously have different dimensions for the data 
matrices. So, let's step through a method for getting the legend 
position and size from the plot itself. As I have written a few times 
previously, par(usr) gives you the dimensions of the plot in user 
units. For the example above, the dimensions were:

x - 0-351
y - 0-200

With a bit of arithmetic, you can work out that the legend positions in 
the above are:

xylim-par(usr)
# x position of lower left corner of legend
xl-xylim[2]+diff(xylim[1:2])*0.017
# y position of lower left corner
yb-xylim[3]+diff(xylim[3:4])*0.15
# x position of upper right corner of legend
xr-xylim[2]+diff(xylim[1:2])*0.054
# y position of upper right corner
yt-xylim[3]+diff(xylim[3:4])*0.75

Having these lines means that you can get the position and size of the 
legend about right from the information provided by par(usr) even if 
you change the number of cells in the matrix passed to color2D.matplot. 
Then you would call:

color.legend(xl,yb,xr,yt,seq(-110,-50,length.out=13),
  align=rb,rect.col=color.scale(1:13,1,c(0,1),0),
  gradient=y)

unless of course you wanted to change the values in the scale markings. 
I'll leave that for you to work out.


Jim
[[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] remap values from one vector to the other

2013-10-31 Thread Alaios
Hi everyone, 
I am plotting some legend and I am using the axis(at=..) to specify the place 
to plot the marks I want.

My plotted data have ncol(x) so the at places have values that span from 1 to 
ncol(x)

there I would like to be able to map values that go from 880e6 to 1020e6.
so 
880e6 remaps to 1


1020e6 repams to ncol(x)

what I do not know how to do is to remap the values that are between 880e6 and 
1020e6 between then 1 and ncol(x).

Can someone help me find an appropriate function for that?

I would like to thank you in advance for your help

Regards
Alex
[[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] Select fixed number of elements

2013-10-30 Thread Alaios
Hi all,
I have in my code some vectors that are not of equal size. I would like to be 
able for each of these vectors select 6 elements that are (almost) equally 
spaced. So the first one would be at (or close) to the beginning the last one 
at (or close) to the end and the other 4 equally spaced between first and last 
element.

How can I do something like that on a vector of not known size?

I would like to thank you in advance for your help

Regards
Alex
[[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 me align the legend bar

2013-10-30 Thread Alaios
Hi,
I have some code that you can simply execute:

require(plotrix)

test-matrix(data=rnorm(1,-100,5),nrow=100)
color2D.matplot(test,axes=F,xlab=,ylab=,main=color.scale,
  extremes=c(#FF,#00),show.legend=FALSE)
 
axis(1,at=seq(1,ncol(test),length.out=10),labels=seq(201,300,length.out=10))
color.legend(84,30,125,70,seq(-110,-30,length=11),
  align=rb,rect.col=color.scale(1:30,1,c(0,1),0),gradient=y)


What I would like to do is to make space at the right for the color band . The 
band should have one color from -110 to -30 with scales of 10.

Can someone help me with that?

Regards
Alex
[[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] TelosB external modules, guide

2013-10-29 Thread Alaios
Hi all,
I would like to ask your help regarding connecting external modules to telosb. 
I have found that tiny os offers many possibilities for that as 

ADC,
GPIOs, SPI, UART, I2C

I have never learned anything regarding those. Can someone please let me know 
if there is any simple
guide on these interfaces to show with a primitive example how to start with?

I would like to thank you in advance for your help

Regards
Alex
[[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] add a color bar in a plot

2013-10-29 Thread Alaios
Hi all,
I am trying to add a color legend to my plot. As an example I am giving you a 
bit of code that you can run.
I am sharing for everyone a small data snipset that you can load
https://www.dropbox.com/s/fh8jhwujgunmtrb/DataToPlotAsImage.Rdata



load(DataToPlotAsImage.Rdata)
require(plotrix)
browser()
test-data
# this transforms the values of test into red-yellow
color2D.matplot(test,axes=F,xlab=,ylab=,main=color.scale,
  extremes=c(#FF,#00),show.legend=FALSE)
  
axis(1,at=seq(1,ncol(test),length.out=10),labels=seq(201,300,length.out=10))
color.legend(104,30,112,70,seq(-110,-30,length=11),
  align=rb,rect.col=color.scale(1:30,1,c(0,1),0),gradient=y)

as you can see I have problems where the legend appears. My par(usr  returned 
me
par(usr)
# [1]   0 351   0 200

but I am not sure how to read that to place the legend at a useful place. 
second I am not sure why the image is so full with black rows..

What I want is to have the legend visible
and later on customize the x axis to write custom string of different 
size... First I need though to fix the more severe problems as I have 
described

RegardsAlex

[[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] add a color band

2013-10-28 Thread Alaios


Hi Jim and thanks for your answer... I might be too tired with my new born or 
just exhausted.

I am sharing for everyone a small data snipset that you can load
https://www.dropbox.com/s/fh8jhwujgunmtrb/DataToPlotAsImage.Rdata



load(DataToPlotAsImage.Rdata)
require(plotrix)
browser()
test-data
# this transforms the values of test into red-yellow
color2D.matplot(test,axes=F,xlab=,ylab=,main=color.scale,
  extremes=c(#FF,#00),show.legend=FALSE)
  
axis(1,at=seq(1,ncol(test),length.out=10),labels=seq(201,300,length.out=10))
color.legend(104,30,112,70,seq(-110,-30,length=11),
  align=rb,rect.col=color.scale(1:30,1,c(0,1),0),gradient=y)

as you can see I have problems where the legend appears. My par(usr  returned 
me
par(usr)
# [1]   0 351   0 200

but I am not sure how to read that to place the legend at a useful place. 
second I am not sure why the image is so full with black rows..

What I want is to have the legend visible
and later on customize the x axis to write custom string of different 
size... First I need though to fix the more severe problems as I have 
described

RegardsAlex



On Sunday, October 27, 2013 12:25 PM, Jim Lemon j...@bitwrit.com.au wrote:
 
On 10/27/2013 08:39 AM, Alaios wrote:
 Hi Jim and thanks for your answer... I might be too tired with my new
 born or just exhausted.

 I am attaching for everyone a small data snipset that you can load


 load(DataToPlotAsImage.Rdata)
 require(plotrix)
 browser()
 test-data
 # this transforms the values of test into red-yellow
 color2D.matplot(test,axes=F,xlab=,ylab=,main=color.scale,
 extremes=c(#FF,#00),show.legend=FALSE)

 axis(1,at=seq(1,ncol(test),length.out=10),labels=seq(201,300,length.out=10))
 color.legend(104,30,112,70,seq(-110,-30,length=11),
 align=rb,rect.col=color.scale(1:30,1,c(0,1),0),gradient=y)

 as you can see I have problems where the legend appears. My par(usr
 returned me
 par(usr)
 # [1] 0 351 0 200

 but I am not sure how to read that to place the legend at a useful place.
 second I am not sure why the image is so full with black rows..

 What I want is to have the legend visible
 and later on customize the x axis to write custom string of different
 size... First I need though to fix the more severe problems as I have
 described

Hi Alex,
I'm not sure why you have created a copy of data to plot it. I can get 
quite a sensible plot using this:

par(mar=c(5,4,4,5))
color2D.matplot(data,1,c(0,1),0,xlab=,ylab=,
  main=color.scale,xrange=c(-110,-50),border=NA)
color.legend(357,30,370,100,seq(-110,-50,length.out=6),
  align=rb,rect.col=color.scale(1:6,1,c(0,1),0),
  gradient=y)

Notice several things. First, when you have a large number of cells in a 
plot like this, setting the border to NA means that you don't get mostly 
borders (default = black) in the plot. The second thing is that your 
data range is -107.18150 to -54.07662. In order to get rounded numbers 
in your legend, I have set the xrange argument to -110 to -50. This 
gives a neat looking legend that spans your data, a bit like the
pretty function would do. It also means that the color mapping is to 
that range and is the same in the legend as in the plot. I have left 
enough space on the right of the plot to fit in the legend, as that was 
where you said you wanted it in your last email. What par(usr) tells 
you is the dimensions of the plot in user units. Here it is x=0 at the 
left, x=351 at the right, y=0 at the bottom and y=200 at the top.


Jim
[[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] Create Time Lists with a for loop

2013-10-28 Thread Alaios
Dear all, 
in my code I have written the following list

TimeFramesShort -list(c(strptime(2011-10-12 10:59:00,%Y-%m-%d 
%H:%M:%S),strptime(2011-10-13 11:02:00,%Y-%m-%d %H:%M:%S))  # 
rest items were truncated


I was wondering if could somehow  take the first element of the list and create 
element that are only 5 minutes apart something like
list(c(strptime(2011-10-12 10:59:00,%Y-%m-%d %H:%M:%S),strptime(2011-10-12 
11:04:00,%Y-%m-%d %H:%M:%S),
c(strptime(2011-10-12 11:04:00,%Y-%m-%d %H:%M:%S),strptime(2011-10-12 
11:09:00,%Y-%m-%d %H:%M:%S),
c(strptime(2011-10-12 11:09:00,%Y-%m-%d %H:%M:%S),strptime(2011-10-12 
11:13:00,%Y-%m-%d %H:%M:%S)
...
and so on.

The problem I see is that pure string manipulation will not work as after one 
hour that should also make changes in the hours.

Regards
Alex 
[[alternative HTML version deleted]]

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


[R] How to avoid this warning message

2013-10-27 Thread Alaios
Dear all,
I would like to ask you how I can avoid this warning I am getting when I am 
writing some results in a text file

5: In write.table(x = cor(t(collectMean_UL), t(collectMean_DL)),  ... :
  appending column names to file


the code that saves to the file look like:

 write(x=TEMPERATURE,file=paste(Folder,/Corr_,.txt,sep=),append=TRUE) 
   
 write.table(x=cor(t(Data)),file=paste(Folder,/Cor_,.txt,sep=),eol = 
\r\n,append=TRUE)

if someone can help on that...

I would like to thank you in advance for your reply

Regards
Alex

[[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] Compare two lists, with their sublists that have same structure

2013-10-26 Thread Alaios
Dear all,
I would like to ask your help concering two R lists.
If I did everything should have the same structure (that means the same number 
of sublists, and their sublists also the same number of sublists). What would 
change between the two lists is the contents of each element in the lists.


Could you please help me understand how I can do that in R?
I would like to thank you in advance for your help

Regards
Alex
[[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] add a color band

2013-10-26 Thread Alaios
Hi Jim and thanks for your answer... I might be too tired with my new born or 
just exhausted.

I am attaching for everyone a small data snipset that you can load


load(DataToPlotAsImage.Rdata)
require(plotrix)
browser()
test-data
# this transforms the values of test into red-yellow
color2D.matplot(test,axes=F,xlab=,ylab=,main=color.scale,
  extremes=c(#FF,#00),show.legend=FALSE)
  
axis(1,at=seq(1,ncol(test),length.out=10),labels=seq(201,300,length.out=10))
color.legend(104,30,112,70,seq(-110,-30,length=11),
  align=rb,rect.col=color.scale(1:30,1,c(0,1),0),gradient=y)

as you can see I have problems where the legend appears. My par(usr  returned 
me
par(usr)
# [1]   0 351   0 200

but I am not sure how to read that to place the legend at a useful place. 
second I am not sure why the image is so full with black rows..

What I want is to have the legend visible
and later on customize the x axis to write custom string of different size... 
First I need though to fix the more severe problems as I have described

Regards
Alex




On Friday, October 25, 2013 11:45 PM, Jim Lemon j...@bitwrit.com.au wrote:
 
On 10/25/2013 11:16 PM, Alaios wrote:
 Hi Jim and thanks for help

 I will need some help to make
 -the legend visible (probably at the right side of the window)
 -split the legend at 0.1 steps -1,-0.9,-0.8.1 and
 -assign a color heat.color(30). I have selected orange and reds
 -show me the way to change the size of legend if it would be needed



 par(mar=c(7,4,4,6))
 test-matrix(data=runif(1),nrow=100)
 color2D.matplot(test,axes=F,xlab=,ylab=,show.legend=FALSE)
 #,show.legend=TRUE
 axis(1,at=seq(1:nrow(test)),labels=seq(201,300)) #
 color.legend(11,6,11.8,9,seq(-1,1,length=10),rect.col=heat.colors(30),gradient=y)

Hi Alex,
You can do this in at least two ways. The first example uses the 
color.scale function to assign colors close to those of heat.colors. The 
second shows how to use heat.colors if you want that.

library(plotrix)
par(mar=c(7,4,4,6))
test-matrix(data=runif(1),nrow=100)
# this transforms the values of test into red-yellow
color2D.matplot(test,axes=F,xlab=,ylab=,main=color.scale,
  extremes=c(#FF,#00),show.legend=FALSE)
axis(1,at=seq(1:nrow(test)),labels=seq(201,300))
# use par(usr) to find out the plot dimensions,
# then place the legend where you want it
color.legend(104,30,112,70,seq(-1,1,length=11),
  align=rb,rect.col=color.scale(1:30,1,c(0,1),0),gradient=y)
# now try it with heat.colors
test.cut-matrix(as.numeric(cut(test,breaks=seq(0,1,length.out=30))),nrow=100)
color2D.matplot(test.cut,axes=F,xlab=,ylab=,main=heat.colors,
  cellcolors=heat.colors(30)[test.cut],show.legend=FALSE)
axis(1,at=seq(1:nrow(test)),labels=seq(201,300))
color.legend(104,30,112,70,seq(-1,1,length=11),
  align=rb,rect.col=heat.colors(30),gradient=y)


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.


[R] add a color band

2013-10-25 Thread Alaios
Hi all,
I would like to ask your help to add a color band (Ι am not sure regarding the 
right term, this color band at the right of the plot describing values with 
their corresponding color. 

For now I have only this code



test-matrix(data=runif(1),nrow=100)
plot(test,axes=FALSE)

axis(1,at=c(0,1),labels=c(a,b)) # 

but  I would like to add at the right  side the color legend.

How can I do that in R?

I would like to thank you in advance for your help

R.
Alex
[[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] add a color band

2013-10-25 Thread Alaios
Hi Jim and thanks for help

I will need some help to make
-the legend visible (probably at the right side of the window)
-split the legend at 0.1 steps -1,-0.9,-0.8.1 and 

-assign a color heat.color(30). I have selected orange and reds
-show me the way to change the size of legend if it would be needed




par(mar=c(7,4,4,6))
test-matrix(data=runif(1),nrow=100)
color2D.matplot(test,axes=F,xlab=,ylab=,show.legend=FALSE) 
#,show.legend=TRUE
axis(1,at=seq(1:nrow(test)),labels=seq(201,300)) #
color.legend(11,6,11.8,9,seq(-1,1,length=10),rect.col=heat.colors(30),gradient=y)

I would like to thank you in advance for your help

Regards
Alex




On Friday, October 25, 2013 11:50 AM, Jim Lemon j...@bitwrit.com.au wrote:
 
On 10/25/2013 08:38 PM, Alaios wrote:
 Hi all,
 I would like to ask your help to add a color band (Ι am not sure 
 regarding the right term, this color band at the right of the plot 
 describing values with their corresponding color.

 For now I have only this code



 test-matrix(data=runif(1),nrow=100)
 plot(test,axes=FALSE)

 axis(1,at=c(0,1),labels=c(a,b)) #

 but  I would like to add at the right  side the color legend.


 How can I do that in R?

 I would like to thank you in advance for your help

Hi Alex,
If all else fails, look at color.legend (plotrix).

Jim
[[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] Plot.raster hides the axis layer

2013-10-24 Thread Alaios
Hi all,
I am trying to plot a raster object (I can explain why but the point is that it 
would be a raster objeçt)..

I have selected a small code to show you exactly the problem


require(raster)
test-matrix(data=runif(1),nrow=100)
m-raster(test)
plot(m,axes=FALSE)
axis(1,at=c(0,1),labels=c(a,b)) # THIS DOES NOT CHANGE THE INVISIBLE AXIS 
WHILE




plot(test,axes=FALSE)
axis(1,at=c(0,1),labels=c(a,b)) # WHEN I AM PLOTTING A NON RASTER OBJECT 
THE AXIS APPEARS.

Can someone explain me what I can do so a raster layer to show correctly the 
axis? Please remember that I have to do that on a raster object so coercing it 
will not help ..

I would like to thank you in advance for your help

Regards
Alex

[[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] Where is element 30?

2013-10-22 Thread Alaios
Hi I have a vector like that

readCsvFile$V1
 [1]  30  31  32  33  34  35  36  37  38  39 310 311 312 313 314 315 316 317 318
[20] 319 320 321  20  21  22  23  24  25  26  27  28  29 210 211 212 213 214 215
[39] 216 217 218 219 220 221 222 223  40  41  42  43  44  45  46  47  48  49 410
[58] 411 412 413 414 415 416 417 418 419 420 421


and I am looking to find where the number 31 is located. So I need one function 
to return me the index of where the number 31 is.
Is there a function for that in R?

Regards
Alex
[[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] plot correlation matrix

2013-10-21 Thread Alaios
Hi all,
I am having 4 vectors like

Data: num [1:4, 1:32] -82.8 -81.8 -75.5 -107.6 -87.6 ...  

and I want to calculate the correlation between those.

Is there a graphical way in R to plot the correlations or not?

I would like to thank you in advance for your help

Regards
Alex
[[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] Lists with numbers lists and strings

2013-10-18 Thread Alaios
Dear all,
I have a list that is created like that

Spans-list( c(837e6,842e6), 
      c(832e6,837e6), 
      c(930.1e6,935.1e6)
      )



I would like to include a second list that will contain the string that would 
correspond to the numbers at the left side. 

I would like thus inside my list to have two sublists. The first onew would be 
the Spans and the second one the Caption list.

Could you please help me understand how I can do that?

Regards
Alex

[[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] Averaging Out many rows from a column AND funtion to string

2013-03-27 Thread Alaios
Dear all,
1) I have a very large matrix of 
str(keep) 
 num [1:153899, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ... 
that  I would like to reduce its size to something like

str(keep) 
 num [1:1000, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ...  
or anything similar in size as this is a matrix that needs plotting (so is ok 
if it is 1000 row, 995, or 1123)

I think what I need here is a way of selecting multiple rows and averaging per 
column (notice that the column number should stay the same)

b. I would like to be able to convert strings that are function names to real 
function calls. For example I have something like

LogFunction- function(){}
FunctionIndex- rbind (c(1,LogFunction),
           c(2,TakeFunction)
          )
print(sprintf('Using the function %s',FunctionIndex[1,1]))
# call the FunctionIndex[1,1] somehow 



I would like to thank you in advance for your help

Regards
Alex

[[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] Averaging Out many rows from a column AND funtion to string

2013-03-27 Thread Alaios
see inline




 From: PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 11:24 AM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string

Hi

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Alaios
 Sent: Wednesday, March 27, 2013 9:13 AM
 To: R help
 Subject: [R] Averaging Out many rows from a column AND funtion to
 string
 
 Dear all,
 1) I have a very large matrix of
 str(keep)
  num [1:153899, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ...
 that  I would like to reduce its size to something like
 
 str(keep)
  num [1:1000, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ... or anything
 similar in size as this is a matrix that needs plotting (so is ok if it
 is 1000 row, 995, or 1123)
 
 I think what I need here is a way of selecting multiple rows and
 averaging per column (notice that the column number should stay the
 same)

Make an index variable and aggregate values according it

Something like
idx-cut(1:153899, 153)
keep.ag-aggregate(keep, list(idx), mean)

1) Thanks that returned a data frame.. How I can have a matrix at the end?
2) I want to have a string that can be used also for calling a function with 
the same name. Think of using mean to call mean. I need to have R interpret 
the string in different ways.

Regards
Alex

 
 b. I would like to be able to convert strings that are function names
 to real function calls. For example I have something like
 
 LogFunction- function(){}
 FunctionIndex- rbind (c(1,LogFunction),
            c(2,TakeFunction)
           )
 print(sprintf('Using the function %s',FunctionIndex[1,1])) # call the
 FunctionIndex[1,1] somehow

I am not sure if I understand correctly. 

Is this what you want?
myf -function(fun=mean, arg) eval(call(fun, arg))

Regards
Petr

 
 
 
 I would like to thank you in advance for your help
 
 Regards
 Alex
 
     [[alternative HTML version deleted]]
[[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] Averaging Out many rows from a column AND funtion to string

2013-03-27 Thread Alaios
see inline





 From: PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 1:50 PM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string



Hi
 

Sent: Wednesday, March 27, 2013 11:46 AM
To: PIKAL Petr; R help
Subject: Re: [R] Averaging Out many rows from a column AND funtion to string
 
see inline
 



From:PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 11:24 AM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string

Hi

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Alaios
 Sent: Wednesday, March 27, 2013 9:13 AM
 To: R help
 Subject: [R] Averaging Out many rows from a column AND funtion to
 string
 
 Dear all,
 1) I have a very large matrix of
 str(keep)
  num [1:153899, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ...
 that  I would like to reduce its size to something like
 
 str(keep)
  num [1:1000, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ... or anything
 similar in size as this is a matrix that needs plotting (so is ok if it
 is 1000 row, 995, or 1123)
 
 I think what I need here is a way of selecting multiple rows and
 averaging per column (notice that the column number should stay the
 same)

Make an index variable and aggregate values according it

Something like
idx-cut(1:153899, 153)
keep.ag-aggregate(keep, list(idx), mean)

1) Thanks that returned a data frame.. How I can have a matrix at the end?


use as.matrix(data.frame) on numeric part

a bit of my code that you can re run. I convert a 30,30 matrix to a 10,30.  
but it looks at the end that I do not get the Data part of the data.fram 
correctly: 

Data-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
idx-cut(1:30, 10)
keep.ag-aggregate(Data, list(idx), mean)
str(as.matrix(keep.ag) ) # it does not look like integers









2) I want to have a string that can be used also for calling a function with 
the same name. Think of using mean to call mean. I need to have R interpret 
the string in different ways.


To call „mean“ of what? I am sure I do not understand what is your 
intention.
LogFunction- function(){}
FunctionIndex- rbind (c(1,LogFunction),
               c(2,TakeFunction))
print(sprintf('Using the function %s',FunctionIndex[1,1]))
This does not contain much clue.
Regards
Petr
PS. Do not use HTML mail messages. 
Regards
Alex

 
 b. I would like to be able to convert strings that are function names
 to real function calls. For example I have something like
 
 LogFunction- function(){}
 FunctionIndex- rbind (c(1,LogFunction),
                c(2,TakeFunction)
               )
 print(sprintf('Using the function %s',FunctionIndex[1,1])) # call the
 FunctionIndex[1,1] somehow

I am not sure if I understand correctly. 

Is this what you want?
myf -function(fun=mean, arg) eval(call(fun, arg))

Regards
Petr

 
 
 
 I would like to thank you in advance for your help
 
 Regards
 Alex
 
     [[alternative HTML version deleted]]
[[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] Averaging Out many rows from a column AND funtion to string

2013-03-27 Thread Alaios
I have fixed it like that:


keep-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
ShrinkTo-500
idx-cut(1:nrow(keep), ShrinkTo)
keep.ag-aggregate(keep, list(idx), mean)
PlotMe-data.matrix(keep.ag[2:ShrinkTo])

The only problem is that takes ages to finish. Would it be possible to 
convert it to something like lapply?

Regards
Alex





 From: PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 4:02 PM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string



Hi
 
 str(as.matrix(keep.ag[,-1]) )  # does look like numeric
num [1:10, 1:30] 75.1 93 79 81.7 76.3 ...
- attr(*, dimnames)=List of 2
  ..$ : NULL
  ..$ : chr [1:30] V1 V2 V3 V4 ...
 
Please read and follow what was recommended.
 
quote
 
use as.matrix(data.frame) on numeric part
                                        
                  ^^^
 
aggregate produces data frame with its first column being your idx variable, 
which is factor. Trying to convert it whole to matrix results in character 
matrix. You need to exclude first column from conversion
 
And please can you explain how mean(rnorm(whatever)) shall be integer?
 
Regards
Petr
 

Sent: Wednesday, March 27, 2013 3:01 PM
To: PIKAL Petr; R help
Subject: Re: [R] Averaging Out many rows from a column AND funtion to string
 
see inline
 
 



From:PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 1:50 PM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string


Hi
 

Sent: Wednesday, March 27, 2013 11:46 AM
To: PIKAL Petr; R help
Subject: Re: [R] Averaging Out many rows from a column AND funtion to string
 
see inline
 



From:PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 11:24 AM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string

Hi

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Alaios
 Sent: Wednesday, March 27, 2013 9:13 AM
 To: R help
 Subject: [R] Averaging Out many rows from a column AND funtion to
 string
 
 Dear all,
 1) I have a very large matrix of
 str(keep)
  num [1:153899, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ...
 that  I would like to reduce its size to something like
 
 str(keep)
  num [1:1000, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ... or anything
 similar in size as this is a matrix that needs plotting (so is ok if it
 is 1000 row, 995, or 1123)
 
 I think what I need here is a way of selecting multiple rows and
 averaging per column (notice that the column number should stay the
 same)

Make an index variable and aggregate values according it

Something like
idx-cut(1:153899, 153)
keep.ag-aggregate(keep, list(idx), mean)

1) Thanks that returned a data frame.. How I can have a matrix at the end?
use as.matrix(data.frame) on numeric part
 
a bit of my code that you can re run. I convert a 30,30 matrix to a 10,30.  
but it looks at the end that I do not get the Data part of the data.fram 
correctly: 
Data-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
idx-cut(1:30, 10)
keep.ag-aggregate(Data, list(idx), mean)
str(as.matrix(keep.ag) ) # it does not look like integers
 
 
 
 
 
 
 
2) I want to have a string that can be used also for calling a function with 
the same name. Think of using mean to call mean. I need to have R interpret 
the string in different ways.
To call „mean“ of what? I am sure I do not understand what is your 
intention.
LogFunction- function(){}
FunctionIndex- rbind (c(1,LogFunction),
               c(2,TakeFunction))
print(sprintf('Using the function %s',FunctionIndex[1,1]))
This does not contain much clue.
Regards
Petr
PS. Do not use HTML mail messages. 
Regards
Alex

 
 b. I would like to be able to convert strings that are function names
 to real function calls. For example I have something like
 
 LogFunction- function(){}
 FunctionIndex- rbind (c(1,LogFunction),
                c(2,TakeFunction)
               )
 print(sprintf('Using the function %s',FunctionIndex[1,1])) # call the
 FunctionIndex[1,1] somehow

I am not sure if I understand correctly. 

Is this what you want?
myf -function(fun=mean, arg) eval(call(fun, arg))

Regards
Petr

 
 
 
 I would like to thank you in advance for your help
 
 Regards
 Alex
 
     [[alternative HTML version deleted]]
[[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] Controlling Raster plots

2013-03-27 Thread Alaios
Hi,
I have a few raster layers and I would like to customized their x and y axis.

I have tried already something like:


require('raster')
keep-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
xlab-seq(100e6,200e6,length.out=5)
test-raster(keep)
plot(test,ylab=,xaxt=n,yaxt=n)
axis(1, at=seq(0,1,length.out=5), xlab)

that normally would work in any other plot function.

Could you please help me add the xaxis ?

I would like to thank you in advance for your reply

Regards
Alex

[[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] Averaging Out many rows from a column AND funtion to string

2013-03-27 Thread Alaios
Well my true matrix is 

of


num [1:153899, 1:3415]

that I want to convert to something like

num [1:1000, 1:3415] (keeping column number the same).

I only give subsets here to allow others to run the code at their computer

Thanks a lot

Regards
Alex




 From: PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 4:45 PM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string



Hi
 
 system.time({
+ keep-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
+ ShrinkTo-500
+ idx-cut(1:nrow(keep), ShrinkTo)
+ keep.ag-aggregate(keep, list(idx), mean)
+ PlotMe-as.matrix(keep.ag[,-1])
+ })
   user  system elapsed 
  29.23    0.14   29.37 
  
 
It takes 30 seconds when using 30 rows. It is not enough time to get a cup 
of tee, which I do not consider ages. Maybe split lapply approach or 
data.matrix or  **ply could be quicker but I do not consider worth spending 
hours to elaborate some solution which will spare 20 sec computing time.
 
Regards
Petr 
 

Sent: Wednesday, March 27, 2013 4:12 PM
To: PIKAL Petr; R help
Subject: Re: [R] Averaging Out many rows from a column AND funtion to string
 
I have fixed it like that:


keep-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
ShrinkTo-500
idx-cut(1:nrow(keep), ShrinkTo)
keep.ag-aggregate(keep, list(idx), mean)
PlotMe-data.matrix(keep.ag[2:ShrinkTo])

The only problem is that takes ages to finish. Would it be possible to 
convert it to something like lapply?

Regards
Alex
 
 



From:PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 4:02 PM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string


Hi
 
 str(as.matrix(keep.ag[,-1]) )  # does look like numeric
num [1:10, 1:30] 75.1 93 79 81.7 76.3 ...
- attr(*, dimnames)=List of 2
  ..$ : NULL
  ..$ : chr [1:30] V1 V2 V3 V4 ...
 
Please read and follow what was recommended.
 
quote
 
use as.matrix(data.frame) on numeric part
                                        
                  ^^^
 
aggregate produces data frame with its first column being your idx variable, 
which is factor. Trying to convert it whole to matrix results in character 
matrix. You need to exclude first column from conversion
 
And please can you explain how mean(rnorm(whatever)) shall be integer?
 
Regards
Petr
 

Sent: Wednesday, March 27, 2013 3:01 PM
To: PIKAL Petr; R help
Subject: Re: [R] Averaging Out many rows from a column AND funtion to string
 
see inline
 
 



From:PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 1:50 PM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string
 
Hi
 

Sent: Wednesday, March 27, 2013 11:46 AM
To: PIKAL Petr; R help
Subject: Re: [R] Averaging Out many rows from a column AND funtion to string
 
see inline
 



From:PIKAL Petr petr.pi...@precheza.cz

Sent: Wednesday, March 27, 2013 11:24 AM
Subject: RE: [R] Averaging Out many rows from a column AND funtion to string

Hi

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Alaios
 Sent: Wednesday, March 27, 2013 9:13 AM
 To: R help
 Subject: [R] Averaging Out many rows from a column AND funtion to
 string
 
 Dear all,
 1) I have a very large matrix of
 str(keep)
  num [1:153899, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ...
 that  I would like to reduce its size to something like
 
 str(keep)
  num [1:1000, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ... or anything
 similar in size as this is a matrix that needs plotting (so is ok if it
 is 1000 row, 995, or 1123)
 
 I think what I need here is a way of selecting multiple rows and
 averaging per column (notice that the column number should stay the
 same)

Make an index variable and aggregate values according it

Something like
idx-cut(1:153899, 153)
keep.ag-aggregate(keep, list(idx), mean)

1) Thanks that returned a data frame.. How I can have a matrix at the end?
use as.matrix(data.frame) on numeric part
 
a bit of my code that you can re run. I convert a 30,30 matrix to a 10,30.  
but it looks at the end that I do not get the Data part of the data.fram 
correctly: 
Data-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
idx-cut(1:30, 10)
keep.ag-aggregate(Data, list(idx), mean)
str(as.matrix(keep.ag) ) # it does not look like integers
 
 
 
 
 
 
 
2) I want to have a string that can be used also for calling a function with 
the same name. Think of using mean to call mean. I need to have R interpret 
the string in different ways.
To call „mean“ of what? I am sure I do not understand what is your 
intention.
LogFunction- function(){}
FunctionIndex- rbind (c(1,LogFunction),
               c(2,TakeFunction))
print(sprintf('Using the function %s',FunctionIndex[1,1]))
This does

Re: [R] Plot Matrix with Data

2013-03-26 Thread Alaios
Hi,
Thanks for the answer.
It looks like that the mutate what I was missing so long..

That's my current attempt

Data-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
Lengths- 15
library(reshape2)
library(ggplot2)
require('plyr')
tdm - melt(Data)
tdm - mutate(tdm, col = cut(value, seq(15, 90, by=5), labels = seq(20, 90, 
by=5)) )
test-colorRampPalette(c(orange, red),space=Lab,interpolate=linear)
ggplot(tdm, aes(x = Var1, y = Var2, fill = col)) +
  geom_raster() +
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0)) +
  labs(x = MHz, y = Threshold, fill = Duty Cycle)


Two things.
a. I have tried to make a color pallete that goes from orange through all the 
orangish and redish hues to the red but as you can see that failed.
b. One think is that the colors visible in the legend in the right part are not 
always visible. If for example there is a 20 value the 20 will appear and if 
there is not but there is a 25 the bar will start from the 25 onwards.

I would like to thank everyone for their on going support

Regards
Alex



 From: Dennis Murphy djmu...@gmail.com

Sent: Monday, March 25, 2013 9:17 PM
Subject: Re: [R] Plot Matrix with Data

Hi Alex:

Here are a couple of raw examples, one with a 'discretized' color
gradient and another with ordered factor levels in groups of length
10. Starting with tdm,

library(plyr)
library(ggplot2)
tdm - mutate(tdm, col = cut(value, seq(0, 140, by = 10),
                              labels = seq(10, 140, by = 10)) )
## or equivalently,
# tdm$col - cut(col$value, seq(0, 140, by = 10),
#                      labels = seq(10, 140, by = 10)) )

# The numeric factor levels are 1 - 14, so if we convert col to numeric,
# should multiply the values by 10. This plot uses a continuous
# color gradient whose midpoint is near the median value.
ggplot(tdm, aes(x = Var1, y = Var2, fill = 10 * as.numeric(col))) +
       geom_raster() +
       scale_x_continuous(expand = c(0, 0)) +
       scale_y_continuous(expand = c(0, 0)) +
       scale_fill_gradient2(low = green, mid = orange,
                            high = yellow, midpoint = 85) +
       labs(x = MHz, y = Threshold, fill = Duty Cycle)

# This one uses col as a factor. The labels are the correct
# upper limits of each value bin. Obviously you want to use
# a smarter mechanism for assigning colors than the
# default. The colorspace package or the colorRampPalette()
# function might be useful here.
ggplot(tdm, aes(x = Var1, y = Var2, fill = col)) +
  geom_raster() +
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0)) +
  labs(x = MHz, y = Threshold, fill = Duty Cycle)

The values on the x-y axes are the row and column numbers of the
reshaped matrix. You may need to map them to values of the MHz and
Threshold values; I doubt that [0, 1] is the range of each variable
(as you have in another post using base graphics).

Dennis


 Hi ,
 I would like to use ggplot2 to plot a matrix as an image.

 You can copy paste the following


 Data-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)

 lengthOut-5



 Lengths- 15
 library(reshape2)
 library(ggplot2)
 tdm - melt(Data)





 ggplot(tdm, aes(x = Var2, y = Var1, fill = 
 factor(value)),levels=seq(0,1,by=0.1)) +
                   labs(x = MHz, y = Threshold, fill = Duty Cycle) +
                   geom_raster(alpha=1) +
                   
scale_fill_discrete(h.start=1,breaks=c(20,30,40,50,60,70,80,90),labels=c(20,30,40,50,60,70,80,90),fill=red)
 +
                   scale_x_continuous(expand = c(0, 0)) +
                   scale_y_continuous(expand = c(0, 0))






 # End of code part



 What I wanted to do is to print the values

 below 20, with an x color
 between 20-30, with a y clor
 between 30-40, with a z color
 and so on

 I would not care now for the color palette.
 Any would do.
 Could you please help me with that?

 Regards
 A

         [[alternative HTML version deleted]]


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

[[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] Increase font size in plots

2013-03-26 Thread Alaios
Hi
I am using violin plots (type of boxplots) and  I am trying to increase the 
font size in the plots.

It looks like that the violin plots do not work as normal plots as the cex 
parameters are ignored.

You can have a loot at the code below




require('vioplot')
data1-rnorm(100)
data2-rnorm(10)
data3-rnorm(1000)
vioplot(data1,data2,data3,cex.lab=2,cex.axis=2)




Regards
Alex
[[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] Plot Matrix with Data

2013-03-26 Thread Alaios
Hi,
it was very kind of you to help me again.

Your code works, and the reason I was using the limits as that is that my 
dataset is slightly different than the one I used for showing the problem here.
More specifically this is my dataset

Browse[1] str(keep)
 num [1:153899, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ...
Browse[1] (density(keep))

Call:
    density.default(x = keep)

Data: keep (525565085 obs.);    Bandwidth 'bw' = 0.1695

   x y    
 Min.   :-106.94   Min.   :0.000  
 1st Qu.: -87.13   1st Qu.:0.0003593  
 Median : -67.31   Median :0.0050385  
 Mean   : -67.31   Mean   :0.0126038  
 3rd Qu.: -47.49   3rd Qu.:0.0084189  
 Max.   : -27.67   Max.   :0.1792683  



and as you can see is rather large... that makes it a marathon to print it. 
Would it be possible to average some of the arrows in a column by column basis 
so to turn the

str(keep)
 num [1:153899, 1:3415] -98.6 -95.8 -96.4 -95.8 -98 ...

to something like

num [1:1000, 1:3415] . How can I do that efficiently in R?

I would like to thank everyone in advance.

Regards
Alex







 From: Dennis Murphy djmu...@gmail.com

Sent: Tuesday, March 26, 2013 10:43 AM
Subject: Re: [R] Plot Matrix with Data

Hi:

I don't understand why you're truncating the duty cycle at 90 when the
data range from 15 to 150 - the effect of doing that is the set of
grey squares in the heatmap corresponding to missing values.

The reason your color scale didn't work is because you never used it
in the ggplot() call, but I think that it would have been difficult to
incorporate it anyway because ggplot2 has its own conventions. It
appears that what you want is ggplot2::scale_fill_continuous().

I chucked the color factor and tried the following instead. You can
edit it however you want, and you can extend the length/width of the
color bar - see the help page of guide_colourbar(), in particular the
barheight argument.
http://docs.ggplot2.org/current/guide_colourbar.html

My shot at your graphic:

ggplot(tdm, aes(x = Var1, y = Var2, fill = value)) +
   geom_raster() +
   scale_x_continuous(expand = c(0, 0)) +
   scale_y_continuous(expand = c(0, 0)) +
   scale_fill_continuous(limits = c(15, 150),
                         breaks = seq(15, 150, by = 15),
                         low = orange, high = red,
                         guide = guide_colourbar(nbin = 28)) +
   labs(x = MHz, y = Threshold, fill = Duty Cycle)

This color bar has 28 bins, 5 units apart, but the labels are 15 apart
since otherwise they overwrite each other. You can reduce the crowding
by increasing the height of the color bar as indicated earlier. This
appears to be closer to your intent with a lot less bother.

Dennis


 Hi,
 Thanks for the answer.
 It looks like that the mutate what I was missing so long..

 That's my current attempt

 Data-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)

 Lengths- 15
 library(reshape2)
 library(ggplot2)
 require('plyr')
 tdm - melt(Data)
 tdm - mutate(tdm, col = cut(value, seq(15, 90, by=5), labels = seq(20, 90,
 by=5)) )
 test-colorRampPalette(c(orange, red),space=Lab,interpolate=linear)

 ggplot(tdm, aes(x = Var1, y = Var2, fill = col)) +
   geom_raster() +
   scale_x_continuous(expand = c(0, 0)) +
   scale_y_continuous(expand = c(0, 0)) +
   labs(x = MHz, y = Threshold, fill = Duty Cycle)


 Two things.
 a. I have tried to make a color pallete that goes from orange through all
 the orangish and redish hues to the red but as you can see that failed.
 b. One think is that the colors visible in the legend in the right part are
 not always visible. If for example there is a 20 value the 20 will appear
 and if there is not but there is a 25 the bar will start from the 25
 onwards.

 I would like to thank everyone for their on going support

 Regards
 Alex
 
 From: Dennis Murphy djmu...@gmail.com

 Sent: Monday, March 25, 2013 9:17 PM
 Subject: Re: [R] Plot Matrix with Data

 Hi Alex:

 Here are a couple of raw examples, one with a 'discretized' color
 gradient and another with ordered factor levels in groups of length
 10. Starting with tdm,

 library(plyr)
 library(ggplot2)
 tdm - mutate(tdm, col = cut(value, seq(0, 140, by = 10),
                               labels = seq(10, 140, by = 10)) )
 ## or equivalently,
 # tdm$col - cut(col$value, seq(0, 140, by = 10),
 #                      labels = seq(10, 140, by = 10)) )

 # The numeric factor levels are 1 - 14, so if we convert col to numeric,
 # should multiply the values by 10. This plot uses a continuous
 # color gradient whose midpoint is near the median value.
 ggplot(tdm, aes(x = Var1, y = Var2, fill = 10 * as.numeric(col))) +
       geom_raster() +
       scale_x_continuous(expand = c(0, 0)) +
       scale_y_continuous(expand = c(0, 0)) +
       scale_fill_gradient2(low = green, mid = orange,
                             high = yellow, midpoint = 85) +
       labs(x = MHz, y = Threshold, fill = Duty Cycle)

 # 

[R] plot Raster

2013-03-25 Thread Alaios
Dear all,
I am trying to plot an image so I am trying this through raster layer.

You can copy paste the following

require('raster')
Data-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
rasterData-raster(Data)
lengthOut-5
xAxisFrequencies-seq(800,900,length.out=lengthOut)
plot(rasterData, ylab=,xaxt=n,yaxt=n)
axis(1, at=seq(0,1,length.out=lengthOut), xAxisFrequencies, col.axis = blue)



What I want is to add a customized x label, but the last line I gave above
axis(1,at.) does not work. 

It would be also nice to add a bit of legend also under the color bar to 
explain there what are the values.

Could you please help me with those two ?

Regards
Alex

[[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] Plot Matrix with Data

2013-03-25 Thread Alaios
Hi ,
I would like to use ggplot2 to plot a matrix as an image.

You can copy paste the following


Data-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)

lengthOut-5



Lengths- 15
library(reshape2)
library(ggplot2)
tdm - melt(Data)





ggplot(tdm, aes(x = Var2, y = Var1, fill = 
factor(value)),levels=seq(0,1,by=0.1)) +
  labs(x = MHz, y = Threshold, fill = Duty Cycle) +
  geom_raster(alpha=1) +
  
scale_fill_discrete(h.start=1,breaks=c(20,30,40,50,60,70,80,90),labels=c(20,30,40,50,60,70,80,90),fill=red)
 +
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0))






# End of code part



What I wanted to do is to print the values 

below 20, with an x color
between 20-30, with a y clor
between 30-40, with a z color
and so on

I would not care now for the color palette.
Any would do.
Could you please help me with that?

Regards
A

[[alternative HTML version deleted]]

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


[R] All unique combinations

2013-03-21 Thread Alaios
Dear all,
I would like to have all unique combinations in the following matrix

TimeIndex- rbind (c(1,Week_of_21_07-29_03), 
          c(2,Thursday_21_03),
          c(3,Friday_22_03),
          c(4,Saturday_23_03),
          c(5,Sunday_24_03),
          c(6,Monday_25_03),
          c(7,Tuesday_26_03),
          c(8,Wednesday_27_03),
          c(9,Thursday_28_03),
          c(10,Friday_ 29_03))


As  have a plotting code that takes two input arguments 

plot_two_time_frames(time1,LabelTime1,time2,LabelTime2)
these inputs are
time1: integer from TimeIndex.  TimeIndex[i,1]
LabelTime1: Labels from  TimeIndex[i,2]

time2: integer from TimeIndex, TimeIndex[i,1]
LabelTime2: Labels from  TimeIndex[i,2]


the times 1 and time 2 should be unique combinations and never the same number. 
I understand that my explanation was not the best possible. But I would like to 
thank you in advance for your support

Regards
Alex
[[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] lm and Formula tutorial

2013-03-05 Thread Alaios
Dear all,
I was reading last night the lm and the Formula manual page, and 'I have to 
admit that I had tough time to understand their syntax. Is there a simpler 
guide for the dummies like me to start with?

I would like to thank you in advance for your help

Regards
Alex
[[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] parallel execution in R

2013-02-26 Thread Alaios
Dear all,
I have a piece of code that  I want to run in parallel (I am working in system 
of 16 cores)


foreach (i=(seq(-93,-73,length.out=21))) %dopar% 
 {
  threshold-i
 
 print(i)
 do_analysis1(i,path)
 do_analysis2(i,path)
           do_something_else_analysis1(i,path)
           something_else_now(i,path)
 }


as you can see I have already tried to make this run in parallel, meaning for 
every  i   value each of the 16 processor shoule take a block of the body such 
as:

    threshold-i
 
 print(i)
 do_analysis1(i,path)
 do_analysis2(i,path)
           do_something_else_analysis1(i,path)
           something_else_now(i,,path)
 



and execute it . Unfortunately this does not work and oonly one processor looks 
utilized.

Alternatively, mclapply have worked well in the past, but in this case I am not 
sure how to convert the serial execution of the body of the loop to a list that 
would be compatible with the mclapply. 

I would like to thank you in advance for your help

Regards
Alex

[[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] ggplot2 Increase font size

2013-02-26 Thread Alaios
Hi,
I am not quite sure what you meanΙ. I give again reproducible code:



require(ggplot2)
require(reshape)

DataToPlot-matrix(data=rnorm(9),nrow=3,dimnames=list(seq(1,3),seq(4,6)))
tdm-melt(DataToPlot)
p- ggplot(tdm, aes(x = X2, y = X1, fill = factor(value))) +
                  labs(x = MHz, y = Threshold, fill = 
Duty Cycle) +
                  geom_raster(alpha=1) +
                  
scale_fill_discrete(h.start=1,breaks=c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1),labels=c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1))
 +
                  scale_x_continuous(expand = c(0, 0)) +
                  scale_y_continuous(expand = c(0, 0))







DataToPlot in my case contains something like that:

DataToPlot
           4          5          6
1 -0.4135124  0.4643110 -0.7530622
2  0.8827643 -0.1702428  0.4607671
3  0.7942167 -1.2450487 -0.9380290


what I would like to have is to have one specific color for each of the 
following cases c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1)

so for example the -0.4 would be categorized under the 0 category 

the 0.46 would be categorized under the 0.5 category
the -0.75 would be categorized under the 0 category
the 0.88 would be categorized under the 0.9 category


right now the code I gave prints no color bar. If I change it like that.
p- ggplot(tdm, aes(x = X2, y = X1, fill = factor(value))) +
                  labs(x = MHz, y = Threshold, fill = 
Duty Cycle) +
                  geom_raster(alpha=1) +
                 
 
scale_fill_discrete(h.start=1)
 +
                  scale_x_continuous(expand = c(0, 0)) +
                  scale_y_continuous(expand = c(0, 0))


colorbar comes back but as you will see the defined values is not how I want to 
categorize my data.

Could you please help me find what I do not understand here?

I would like to thank you in advance for your reply

Regards
Alex




 From: Ista Zahn istaz...@gmail.com

Cc: R help R-help@r-project.org 
Sent: Monday, February 25, 2013 3:54 PM
Subject: Re: [R] ggplot2 Increase font size

Hi Alex,

See ?theme

Best,
Ista



 Dear all,
 I am using the code as below
   tdm - melt(matrixToPlot)
    p- ggplot(tdm, aes(x = Var2, y = Var1, fill = factor(value))) +
                   labs(x = Mz, y = T, fill = D) +
                   geom_raster(alpha=1) +
                   scale_fill_discrete(h.start=1) +
                   scale_x_continuous(expand = c(0, 0)) +
                   scale_y_continuous(expand = c(0, 0))

 to plot an two dimensional image .

 I would like to ask your help to replace the gray border with white color
 and increase the font size of x and y axis as wells as the legend of the
 color bar. Could you please give me the function names to use?

 Regards
 Alex
         [[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] ggplot2 Increase font size

2013-02-25 Thread Alaios
Dear all,
I am using the code as below
  tdm - melt(matrixToPlot)
   p- ggplot(tdm, aes(x = Var2, y = Var1, fill = factor(value))) +
  labs(x = Mz, y = T, fill = D) +
  geom_raster(alpha=1) +
  scale_fill_discrete(h.start=1) +
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0))

to plot an two dimensional image .

I would like to ask your help to replace the gray border with white color and 
increase the font size of x and y axis as wells as the legend of the color bar. 
Could you please give me the function names to use?

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


  1   2   3   4   5   >