[R] Help with if else branching print out

2018-12-18 Thread Andrew
Hi all

Playing around with some branching using if, if else, and else, I wrote 
the following very basic script:


[code block]

## Take single value input from user:
# Note 'as.integer' to convert character vector to numeric for testing

nums <- (as.numeric(readline("Please enter a number between 1 and 15: ")))

## Truth test routine:
# Set conditional values and test input against conditions and then 
print outcome

if ((nums > 15) || (nums < 1))
{
   print(c(nums, "is not between 1 or 15"))
} else if ((nums > 5) && (nums < 10) || (nums == 12))
{
   print(c(nums, "falls within 6 - 9 inclusively, or is 12"))
}  else
{
   print( c(nums, "is *not* 6 - 9 inclusive, nor is it 12"))
}

[/ code block]


However, it prints out like this:

[output]

Please enter a number between 1 and 15: 17
[1] "17" "is not between 1 or 15"

Please enter a number between 1 and 15: 9
[1] "9"
[2] "falls within 6 - 9 inclusively, or is 12"

Please enter a number between 1 and 15: 13
[1] "13" "is *not* 6 - 9 inclusive, 
nor is it 12"

[/ output]


How do I:

(a) reduce the gap between the reported number (i.e., 17, 9, 13) in each 
of the lines? and

(b) ensure that in the case of the second run using 9 as the input, the 
print is not over two lines?

I will try the switches function soon, which may yield a different 
output format, but wanted to get my head around why this is printing out 
the way it is.

Many thanks for any help.

Andrew


[[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] Help with if else branching print out

2018-12-18 Thread Eric Berger
I often use sprintf() to control formatting of text strings. e.g.

sprintf("%s is not between 1 or 15\n",nums)

See ?sprintf for details

HTH,
Eric


On Tue, Dec 18, 2018 at 10:56 AM Andrew  wrote:

> Hi all
>
> Playing around with some branching using if, if else, and else, I wrote
> the following very basic script:
>
>
> [code block]
>
> ## Take single value input from user:
> # Note 'as.integer' to convert character vector to numeric for testing
>
> nums <- (as.numeric(readline("Please enter a number between 1 and 15: ")))
>
> ## Truth test routine:
> # Set conditional values and test input against conditions and then
> print outcome
>
> if ((nums > 15) || (nums < 1))
> {
>print(c(nums, "is not between 1 or 15"))
> } else if ((nums > 5) && (nums < 10) || (nums == 12))
> {
>print(c(nums, "falls within 6 - 9 inclusively, or is 12"))
> }  else
> {
>print( c(nums, "is *not* 6 - 9 inclusive, nor is it 12"))
> }
>
> [/ code block]
>
>
> However, it prints out like this:
>
> [output]
>
> Please enter a number between 1 and 15: 17
> [1] "17" "is not between 1 or 15"
>
> Please enter a number between 1 and 15: 9
> [1] "9"
> [2] "falls within 6 - 9 inclusively, or is 12"
>
> Please enter a number between 1 and 15: 13
> [1] "13" "is *not* 6 - 9 inclusive,
> nor is it 12"
>
> [/ output]
>
>
> How do I:
>
> (a) reduce the gap between the reported number (i.e., 17, 9, 13) in each
> of the lines? and
>
> (b) ensure that in the case of the second run using 9 as the input, the
> print is not over two lines?
>
> I will try the switches function soon, which may yield a different
> output format, but wanted to get my head around why this is printing out
> the way it is.
>
> Many thanks for any help.
>
> Andrew
>
>
> [[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] Help with if else branching print out

2018-12-18 Thread Ivan Krylov
On Tue, 18 Dec 2018 08:56:23 +
Andrew  wrote:

> How do I:
> 
> (a) reduce the gap between the reported number (i.e., 17, 9, 13) in
> each of the lines? and
> 
> (b) ensure that in the case of the second run using 9 as the input,
> the print is not over two lines?

Build a single string from your string parts. ?sprintf has already been
mentioned; another option is ?paste.

To prevent strings from being printed in quotes, use ?message.

-- 
Best regards,
Ivan

__
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] Help with if else branching print out

2018-12-18 Thread Rui Barradas

Hello,

Yet another option is ?cat.


msg <- c("is not between 1 or 15",
 "is *not* 6 - 9 inclusive, nor is it 12",
 "falls within 6 - 9 inclusively, or is 12",
 "is *not* 6 - 9 inclusive, nor is it 12",
 "is not between 1 or 15")

nums <- as.numeric(readline("Please enter a number between 1 and 15: "))

i <- if(nums == 12) 2 else findInterval(nums, c(-Inf, 1, 6, 9, 15), 
rightmost.closed = TRUE)

cat(nums, msg[i], "\n")


Hope this helps,

Rui Barradas

Às 09:25 de 18/12/2018, Ivan Krylov escreveu:

On Tue, 18 Dec 2018 08:56:23 +
Andrew  wrote:


How do I:

(a) reduce the gap between the reported number (i.e., 17, 9, 13) in
each of the lines? and

(b) ensure that in the case of the second run using 9 as the input,
the print is not over two lines?


Build a single string from your string parts. ?sprintf has already been
mentioned; another option is ?paste.

To prevent strings from being printed in quotes, use ?message.



__
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] Webshot failed to take snapshot in Ubuntu machine

2018-12-18 Thread Christofer Bogaso
Hi,

I was using webshot package to take snapshot of a webpage as below:

library(webshot)
webshot('
https://www.bseindia.com/stock-share-price/asian-paints-ltd/asianpaint/500820/',
'bb.pdf')

However what I see is a Blank PDF file is saved.

However if I use the same code in my windows machine it is able to produce
correct snapshot.

Below is my system information
> Sys.info()
   sysname
   "Linux"
   release
   "4.4.0-139-generic"
   version
"#165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018"
  nodename
  "ubuntu-s-2vcpu-4gb-blr1-01"
   machine
  "x86_64"
 login
"root"
  user
"root"
effective_user
"root"

Any idea what went wrong would be highly helpful.

Thanks,

[[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] Webshot failed to take snapshot in Ubuntu machine

2018-12-18 Thread Marc Girondot via R-help

Hi Christofer,
I just try on MacOSX and ubuntu and it works on both:

For ubuntu:
> Sys.info()
  sysname
  "Linux"
  release
  "4.15.0-42-generic"
  version
"#45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018"
 nodename
   "lepidochelys"
  machine
 "x86_64"

Not sure what to do...

Marc

Le 18/12/2018 à 13:37, Christofer Bogaso a écrit :

Hi,

I was using webshot package to take snapshot of a webpage as below:

library(webshot)
webshot('
https://www.bseindia.com/stock-share-price/asian-paints-ltd/asianpaint/500820/',
'bb.pdf')

However what I see is a Blank PDF file is saved.

However if I use the same code in my windows machine it is able to produce
correct snapshot.

Below is my system information

Sys.info()

sysname
"Linux"
release
"4.4.0-139-generic"
version
"#165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018"
   nodename
   "ubuntu-s-2vcpu-4gb-blr1-01"
machine
   "x86_64"
  login
 "root"
   user
 "root"
 effective_user
 "root"

Any idea what went wrong would be highly helpful.

Thanks,

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


Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-12-18 Thread Jim Lemon
Hi Subhamitra,
My apologies, I caught a mistake. To have the first tick in the middle of
the first year, you want half of the _observations_ in a year, not half of
the days. As I now have your data at my fingertips:

3567/15.58385
[1] 228.8908

Almost exactly what was calculated for the first series. Your increment
remains 229 and your offset is 114, so

year_mids<-seq(114,3567,229)

Jim

[[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] [R studio] Plotting of line chart for each columns at 1 page

2018-12-18 Thread Subhamitra Patra
Hello Sir,

It is really great learning for me while discussing with you.

As per your suggestion, I also read the axis function in the graphics
package, and now completely understand your logic. I will apply the same
logic for my rest variable and would like to discuss after the successful
generation of all plots.

Thank you very much, Sir, for pointing me to the right path.



[image: Mailtrack]

Sender
notified by
Mailtrack

12/18/18,
5:54:53 PM

On Tue, Dec 18, 2018 at 3:31 PM Jim Lemon  wrote:

> Hi Subhamitra,
> My apologies, I caught a mistake. To have the first tick in the middle of
> the first year, you want half of the _observations_ in a year, not half of
> the days. As I now have your data at my fingertips:
>
> 3567/15.58385
> [1] 228.8908
>
> Almost exactly what was calculated for the first series. Your increment
> remains 229 and your offset is 114, so
>
> year_mids<-seq(114,3567,229)
>
> Jim
>
>

-- 
*Best Regards,*
*Subhamitra Patra*
*Phd. Research Scholar*
*Department of Humanities and Social Sciences*
*Indian Institute of Technology, Kharagpur*
*INDIA*

[[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] Webshot failed to take snapshot in Ubuntu machine

2018-12-18 Thread Christofer Bogaso
Also the Session information.

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] pdftools_2.0  webshot_0.5.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.19 ps_1.1.0 crayon_1.3.4 assertthat_0.2.0
 [5] R6_2.3.0 jsonlite_1.5 magrittr_1.5 pillar_1.3.0
 [9] rlang_0.2.2  debugme_1.1.0callr_3.0.0  tools_3.4.4
[13] compiler_3.4.4   processx_3.2.0   base64enc_0.1-3  tibble_1.4.2

On Tue, Dec 18, 2018 at 6:07 PM Christofer Bogaso <
bogaso.christo...@gmail.com> wrote:

> Hi,
>
> I was using webshot package to take snapshot of a webpage as below:
>
> library(webshot)
> webshot('
> https://www.bseindia.com/stock-share-price/asian-paints-ltd/asianpaint/500820/',
> 'bb.pdf')
>
> However what I see is a Blank PDF file is saved.
>
> However if I use the same code in my windows machine it is able to produce
> correct snapshot.
>
> Below is my system information
> > Sys.info()
>sysname
>"Linux"
>release
>"4.4.0-139-generic"
>version
> "#165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018"
>   nodename
>   "ubuntu-s-2vcpu-4gb-blr1-01"
>machine
>   "x86_64"
>  login
> "root"
>   user
> "root"
> effective_user
> "root"
>
> Any idea what went wrong would be highly helpful.
>
> Thanks,
>

[[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] Problem with Plotting in R

2018-12-18 Thread Michael Dewey

Dear Bob

We do not have your data so it is hard to be sure but plot() takes two 
parameters for the data x and y so when you give it three you are 
confusing it into thinking one of them is something else.


What exactly were you trying to do with the failed command?

On 18/12/2018 14:17, rsherry8 wrote:


Please consider the following R statements:

     > x = seq(1:1632)
     > length( MyData$NWorth )
     [1] 1632
     > length( MyData$NWorthSm )
     [1] 1632
     > plot( x, MyData$NWorth, type="l" )
     > plot( x, MyData$NWorthSm, type="l" )
     > plot( x, MyData$NWorth, MyData$NWorthSm, type="l" )

All of the above statements work except for the last one. The last one 
produces the following message:


     Error in plot.window(...) : invalid 'xlim' value

So I then tired this:

     > xlim1 = c(0, 5000)
     >plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim = xlim1 )

Which produced the following error message:
     Error in plot.window(...) : invalid 'ylim' value

So, I tired this:
     > ylim1 = c(0,9000)
     > plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim = xlim1, 
ylim = ylim1 )


Which produced the following error message:
     Error in strsplit(log, NULL) : non-character argument

I would like to know what I am doing wrong.

Thank you,
Bob

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



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] Problem with Plotting in R

2018-12-18 Thread Rui Barradas

Hello,

You are calling plot.default with 4 arguments.
The first 2 are x and y.
The 3rd is type.
So MyData$NWorthSm becomes the 4th, xlim.
When you pass xlim a value, MyData$NWorthSm becomes the next one, ylim.
Etc, etc, etc.

It will throw the errors in the order of the arguments you can see in 
?plot.default:


## Default S3 method:
plot(x, y = NULL, type = "p",  xlim = NULL, ylim = NULL,
 log = "", main = NULL, etc, etc, etc)


So now if you pass a log = , it's the time for argument main.

Revise the reason why you are passing MyData$NWorthSm.


Hope this helps,

Rui Barradas


Às 14:17 de 18/12/2018, rsherry8 escreveu:


Please consider the following R statements:

     > x = seq(1:1632)
     > length( MyData$NWorth )
     [1] 1632
     > length( MyData$NWorthSm )
     [1] 1632
     > plot( x, MyData$NWorth, type="l" )
     > plot( x, MyData$NWorthSm, type="l" )
     > plot( x, MyData$NWorth, MyData$NWorthSm, type="l" )

All of the above statements work except for the last one. The last one 
produces the following message:


     Error in plot.window(...) : invalid 'xlim' value

So I then tired this:

     > xlim1 = c(0, 5000)
     >plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim = xlim1 )

Which produced the following error message:
     Error in plot.window(...) : invalid 'ylim' value

So, I tired this:
     > ylim1 = c(0,9000)
     > plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim = xlim1, 
ylim = ylim1 )


Which produced the following error message:
     Error in strsplit(log, NULL) : non-character argument

I would like to know what I am doing wrong.

Thank you,
Bob

__
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] Problem with Plotting in R

2018-12-18 Thread rsherry8



Please consider the following R statements:

> x = seq(1:1632)
> length( MyData$NWorth )
[1] 1632
> length( MyData$NWorthSm )
[1] 1632
> plot( x, MyData$NWorth, type="l" )
> plot( x, MyData$NWorthSm, type="l" )
> plot( x, MyData$NWorth, MyData$NWorthSm, type="l" )

All of the above statements work except for the last one. The last one 
produces the following message:


Error in plot.window(...) : invalid 'xlim' value

So I then tired this:

> xlim1 = c(0, 5000)
>plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim = xlim1 )

Which produced the following error message:
Error in plot.window(...) : invalid 'ylim' value

So, I tired this:
> ylim1 = c(0,9000)
> plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim = xlim1, 
ylim = ylim1 )


Which produced the following error message:
Error in strsplit(log, NULL) : non-character argument

I would like to know what I am doing wrong.

Thank you,
Bob

__
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] [Solved] Re: Help with if else branching print out

2018-12-18 Thread Andrew

Dear Eric, Ivan & Rui

Thanks all for your suggestions. FWIW, I've opted to use paste0 and 
after a bit of playing around found it formatted the output nicely.


Eric, I wasn't aware of sprintf - seems a handy function to format text 
with, so will try to remember that.

Ivan, I'll dig into 'message' a little more, so that's a good one to know.
Rui, I liked the idea of the output vector and indexing - that will be 
useful for longer/ more complicated branching


Thank you all again.

Best wishes
Andrew


On 18/12/2018 09:25, Ivan Krylov wrote:

On Tue, 18 Dec 2018 08:56:23 +
Andrew  wrote:


How do I:

(a) reduce the gap between the reported number (i.e., 17, 9, 13) in
each of the lines? and

(b) ensure that in the case of the second run using 9 as the input,
the print is not over two lines?

Build a single string from your string parts. ?sprintf has already been
mentioned; another option is ?paste.

To prevent strings from being printed in quotes, use ?message.



__
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] Webshot failed to take snapshot in Ubuntu machine

2018-12-18 Thread Christofer Bogaso
Is there any alternative to webshot?

On Tue, Dec 18, 2018 at 6:23 PM Marc Girondot  wrote:

> Hi Christofer,
> I just try on MacOSX and ubuntu and it works on both:
>
> For ubuntu:
>  > Sys.info()
>sysname
>"Linux"
>release
>"4.15.0-42-generic"
>version
> "#45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018"
>   nodename
> "lepidochelys"
>machine
>   "x86_64"
>
> Not sure what to do...
>
> Marc
>
> Le 18/12/2018 à 13:37, Christofer Bogaso a écrit :
> > Hi,
> >
> > I was using webshot package to take snapshot of a webpage as below:
> >
> > library(webshot)
> > webshot('
> >
> https://www.bseindia.com/stock-share-price/asian-paints-ltd/asianpaint/500820/
> ',
> > 'bb.pdf')
> >
> > However what I see is a Blank PDF file is saved.
> >
> > However if I use the same code in my windows machine it is able to
> produce
> > correct snapshot.
> >
> > Below is my system information
> >> Sys.info()
> > sysname
> > "Linux"
> > release
> > "4.4.0-139-generic"
> > version
> > "#165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018"
> >nodename
> >"ubuntu-s-2vcpu-4gb-blr1-01"
> > machine
> >"x86_64"
> >   login
> >  "root"
> >user
> >  "root"
> >  effective_user
> >  "root"
> >
> > Any idea what went wrong would be highly helpful.
> >
> > Thanks,
> >
> >   [[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] Plotting rgb proportions in R

2018-12-18 Thread Tasha O'Hara
Hello,

I am trying to plot specific rgb color proportions of a marine specimen in
a stacked plot using R and I was looking for some help. I have several
rgb proportions per specimen (an example of one is below).  I've run into
different examples of people using vegan or grDevices. Can anyone help with
this?

RedGreen  Blue   %
249 158 37 56.311
249 158 68 4.319
249 158 98 0.058
249 128 7 13.965
249 128 37 12.87
188 128 37 0.029
249 128 68 0.161
188 128 68 0.015
188 98 7 0.029
219 128 7 2.773
219 128 37 2.583
188 98 68 0.058
219 128 68 0.525
249 188 37 0.876
249 188 68 1.08
219 98 7 0.482
249 188 98 0.015
249 158 7 3.852

[[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] Plotting rgb proportions in R

2018-12-18 Thread Jeff Newmiller
I can't figure out what message you are hoping to convey in your plot from your 
posting... what are you comparing to what? Comments like "I've run into 
different examples of people using vegan (an analysis package with some 
diagnostic display functionality) or grDevices (a package supporting different 
device and graphic file formats)" fail to inform us as to where we can catch up 
with your reading or whether you liked what they did or not. Is there some 
missing analysis step or do you just want to present the raw data? Even a hand 
drawn sketch in PNG format would be some improvement in clarity.

Note that this is the wrong place to ask for help on theory... if you want to 
know what type of analysis you should attempt then you came here too soon... 
this is where we try to help you apply R to the problem once you know what your 
analysis strategy will be.

On December 18, 2018 9:17:24 AM PST, Tasha O'Hara  
wrote:
>Hello,
>
>I am trying to plot specific rgb color proportions of a marine specimen
>in
>a stacked plot using R and I was looking for some help. I have several
>rgb proportions per specimen (an example of one is below).  I've run
>into
>different examples of people using vegan or grDevices. Can anyone help
>with
>this?
>
>RedGreen  Blue   %
>249 158 37 56.311
>249 158 68 4.319
>249 158 98 0.058
>249 128 7 13.965
>249 128 37 12.87
>188 128 37 0.029
>249 128 68 0.161
>188 128 68 0.015
>188 98 7 0.029
>219 128 7 2.773
>219 128 37 2.583
>188 98 68 0.058
>219 128 68 0.525
>249 188 37 0.876
>249 188 68 1.08
>219 98 7 0.482
>249 188 98 0.015
>249 158 7 3.852
>
>   [[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.

-- 
Sent from my phone. Please excuse my brevity.

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


Re: [R] Problem with LM

2018-12-18 Thread Richard M. Heiberger
## This example, with your variable names, works correctly.

z2 <- data.frame(y=1:5, x=c(1,5,2,3,5), x2=c(1,5,2,3,5)^2)
z2
class(z2)
length(z2)
dim(z2)

lm(y ~ x + x2, data=z2)

## note that that variable names y, x, x2 are column names of the
## data.frame z2

## please review the definitions and examples of data.frame in ?data.frame
## also the argument requirements for lm in ?lm

On Tue, Dec 18, 2018 at 6:32 PM rsherry8  wrote:
>
> The values read into z2 came from a CSV file. Please consider this R
> session:
>
>  > length(x2)
> [1] 1632
>  > length(x)
> [1] 1632
>  > length(z2)
> [1] 1632
>  > head(z2)
> [1] 28914.0 28960.5 28994.5 29083.0 29083.0 29083.0
>  > tail(z2)
> [1] 32729.65 32751.85 32386.05 32379.75 32379.15 31977.15
>  > lm ( y ~ x2 + x, z2 )
> Error in eval(predvars, data, env) :
>numeric 'envir' arg not of length one
>  > lm ( y ~ x2 + x, as.data.frme(z2) )
> Error in as.data.frme(z2) : could not find function "as.data.frme"
>  > lm ( y ~ x2 + x, as.data.frame(z2) )
> Error in eval(predvars, data, env) :
>numeric 'envir' arg not of length one
> lm(formula = y ~ x2 + x, data = as.data.frame(z2))
>
> Coefficients:
> (Intercept)   x2x
>   -1.475e-091.000e+006.044e-13
>
>  > min(z2)
> [1] 24420
>  > max(z2)
> [1] 35524.85
>  > class(z2)
> [1] "numeric"
>  >
>
> where x is set to x = seq(1:1632)
> and x2 is set to x^2
>
> I am looking for an interpolating polynomial of the form:
>  Ax^2 + Bx + C
> I do not think the results I got make sense. I believe that I have a
> data type error.  I do not understand why
> I need to convert z2 to a data frame if it is already numeric.
>
> Thanks,
> Bob
>
> __
> 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.


Re: [R] Problem with LM

2018-12-18 Thread Bert Gunter
... Perhaps worth adding is the use of poly() rather than separately
created  terms for (non/orthogonal)  polynomials:

lm(y ~ poly(x, degree =2)  #orthogonal polyomial of degree 2

see ?poly for details.

-- 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 Tue, Dec 18, 2018 at 6:14 PM rsherry8  wrote:

> Richard,
>
> It is now working.
>
> Thank you very much.
>
> Bob
> On 12/18/2018 7:10 PM, Richard M. Heiberger wrote:
> > ## This example, with your variable names, works correctly.
> >
> > z2 <- data.frame(y=1:5, x=c(1,5,2,3,5), x2=c(1,5,2,3,5)^2)
> > z2
> > class(z2)
> > length(z2)
> > dim(z2)
> >
> > lm(y ~ x + x2, data=z2)
> >
> > ## note that that variable names y, x, x2 are column names of the
> > ## data.frame z2
> >
> > ## please review the definitions and examples of data.frame in
> ?data.frame
> > ## also the argument requirements for lm in ?lm
> >
> > On Tue, Dec 18, 2018 at 6:32 PM rsherry8  wrote:
> >> The values read into z2 came from a CSV file. Please consider this R
> >> session:
> >>
> >>   > length(x2)
> >> [1] 1632
> >>   > length(x)
> >> [1] 1632
> >>   > length(z2)
> >> [1] 1632
> >>   > head(z2)
> >> [1] 28914.0 28960.5 28994.5 29083.0 29083.0 29083.0
> >>   > tail(z2)
> >> [1] 32729.65 32751.85 32386.05 32379.75 32379.15 31977.15
> >>   > lm ( y ~ x2 + x, z2 )
> >> Error in eval(predvars, data, env) :
> >> numeric 'envir' arg not of length one
> >>   > lm ( y ~ x2 + x, as.data.frme(z2) )
> >> Error in as.data.frme(z2) : could not find function "as.data.frme"
> >>   > lm ( y ~ x2 + x, as.data.frame(z2) )
> >> Error in eval(predvars, data, env) :
> >> numeric 'envir' arg not of length one
> >> lm(formula = y ~ x2 + x, data = as.data.frame(z2))
> >>
> >> Coefficients:
> >> (Intercept)   x2x
> >>-1.475e-091.000e+006.044e-13
> >>
> >>   > min(z2)
> >> [1] 24420
> >>   > max(z2)
> >> [1] 35524.85
> >>   > class(z2)
> >> [1] "numeric"
> >>   >
> >>
> >> where x is set to x = seq(1:1632)
> >> and x2 is set to x^2
> >>
> >> I am looking for an interpolating polynomial of the form:
> >>   Ax^2 + Bx + C
> >> I do not think the results I got make sense. I believe that I have a
> >> data type error.  I do not understand why
> >> I need to convert z2 to a data frame if it is already numeric.
> >>
> >> Thanks,
> >> Bob
> >>
> >> __
> >> 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] Problem with LM

2018-12-18 Thread rsherry8

Richard,

It is now working.

Thank you very much.

Bob
On 12/18/2018 7:10 PM, Richard M. Heiberger wrote:

## This example, with your variable names, works correctly.

z2 <- data.frame(y=1:5, x=c(1,5,2,3,5), x2=c(1,5,2,3,5)^2)
z2
class(z2)
length(z2)
dim(z2)

lm(y ~ x + x2, data=z2)

## note that that variable names y, x, x2 are column names of the
## data.frame z2

## please review the definitions and examples of data.frame in ?data.frame
## also the argument requirements for lm in ?lm

On Tue, Dec 18, 2018 at 6:32 PM rsherry8  wrote:

The values read into z2 came from a CSV file. Please consider this R
session:

  > length(x2)
[1] 1632
  > length(x)
[1] 1632
  > length(z2)
[1] 1632
  > head(z2)
[1] 28914.0 28960.5 28994.5 29083.0 29083.0 29083.0
  > tail(z2)
[1] 32729.65 32751.85 32386.05 32379.75 32379.15 31977.15
  > lm ( y ~ x2 + x, z2 )
Error in eval(predvars, data, env) :
numeric 'envir' arg not of length one
  > lm ( y ~ x2 + x, as.data.frme(z2) )
Error in as.data.frme(z2) : could not find function "as.data.frme"
  > lm ( y ~ x2 + x, as.data.frame(z2) )
Error in eval(predvars, data, env) :
numeric 'envir' arg not of length one
lm(formula = y ~ x2 + x, data = as.data.frame(z2))

Coefficients:
(Intercept)   x2x
   -1.475e-091.000e+006.044e-13

  > min(z2)
[1] 24420
  > max(z2)
[1] 35524.85
  > class(z2)
[1] "numeric"
  >

where x is set to x = seq(1:1632)
and x2 is set to x^2

I am looking for an interpolating polynomial of the form:
  Ax^2 + Bx + C
I do not think the results I got make sense. I believe that I have a
data type error.  I do not understand why
I need to convert z2 to a data frame if it is already numeric.

Thanks,
Bob

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


Re: [R] Plotting rgb proportions in R

2018-12-18 Thread Jim Lemon
I was probably a bit obscure and should have written "convert your
0-255 values to 0-1". As Bert notes, you can't get a sensible ternary
plot if your values do not sum to 1. scatterplot3d does a pretty good
job, if you run the example.


Jim

On Wed, Dec 19, 2018 at 3:26 PM Bert Gunter  wrote:
>
> 3-d Proportions must sum to 1and are thus actually 2-d and should preferaby 
> be plotted as a ternary plot. Several r packages will do this for you, e.g. 
> package Ternary. Search "ternary plots" on rseek.org for others.
>
> -- 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 Tue, Dec 18, 2018 at 3:10 PM Jim Lemon  wrote:
>>
>> Hi Tasha,
>> I may be right off the track, but you could plot RGB proportions on a
>> 3D plot. The easiest way I can think if would be to convert your 0-255
>> values to proportions:
>>
>> rgb_prop<-read.table(text="Red Green Blue pct
>> 249 158 37 56.311
>> 249 158 68 4.319
>> 249 158 98 0.058
>> 249 128 7 13.965
>> 249 128 37 12.87
>> 188 128 37 0.029
>> 249 128 68 0.161
>> 188 128 68 0.015
>> 188 98 7 0.029
>> 219 128 7 2.773
>> 219 128 37 2.583
>> 188 98 68 0.058
>> 219 128 68 0.525
>> 249 188 37 0.876
>> 249 188 68 1.08
>> 219 98 7 0.482
>> 249 188 98 0.015
>> 249 158 7 3.852",header=TRUE)
>> rgb_prop$Red<-rgb_prop$Red/255
>> rgb_prop$Green<-rgb_prop$Green/255
>> rgb_prop$Blue<-rgb_prop$Blue/255
>> library(scatterplot3d)
>> scatterplot3d(rgb_prop[,1:3],cex.symbols=sqrt(rgb_prop[,4]),
>>  color=rgb(rgb_prop[,1],rgb_prop[,2],rgb_prop[,3]),pch=19)
>>
>> then plot the RGB values on a 3D scatterplot. I have included
>> arguments to make the symbols the actual RGB colors that you specify
>> and their size proportional to the square root of the percentages.
>>
>> Jim
>>
>> On Wed, Dec 19, 2018 at 5:17 AM Tasha O'Hara  wrote:
>> >
>> > Hello,
>> >
>> > I am trying to plot specific rgb color proportions of a marine specimen in
>> > a stacked plot using R and I was looking for some help. I have several
>> > rgb proportions per specimen (an example of one is below).  I've run into
>> > different examples of people using vegan or grDevices. Can anyone help with
>> > this?
>> >
>> > RedGreen  Blue   %
>> > 249 158 37 56.311
>> > 249 158 68 4.319
>> > 249 158 98 0.058
>> > 249 128 7 13.965
>> > 249 128 37 12.87
>> > 188 128 37 0.029
>> > 249 128 68 0.161
>> > 188 128 68 0.015
>> > 188 98 7 0.029
>> > 219 128 7 2.773
>> > 219 128 37 2.583
>> > 188 98 68 0.058
>> > 219 128 68 0.525
>> > 249 188 37 0.876
>> > 249 188 68 1.08
>> > 219 98 7 0.482
>> > 249 188 98 0.015
>> > 249 158 7 3.852
>> >
>> > [[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-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] Problem with LM

2018-12-18 Thread rsherry8
The values read into z2 came from a CSV file. Please consider this R 
session:


> length(x2)
[1] 1632
> length(x)
[1] 1632
> length(z2)
[1] 1632
> head(z2)
[1] 28914.0 28960.5 28994.5 29083.0 29083.0 29083.0
> tail(z2)
[1] 32729.65 32751.85 32386.05 32379.75 32379.15 31977.15
> lm ( y ~ x2 + x, z2 )
Error in eval(predvars, data, env) :
  numeric 'envir' arg not of length one
> lm ( y ~ x2 + x, as.data.frme(z2) )
Error in as.data.frme(z2) : could not find function "as.data.frme"
> lm ( y ~ x2 + x, as.data.frame(z2) )
Error in eval(predvars, data, env) :
  numeric 'envir' arg not of length one
lm(formula = y ~ x2 + x, data = as.data.frame(z2))

Coefficients:
(Intercept)   x2x
 -1.475e-091.000e+006.044e-13

> min(z2)
[1] 24420
> max(z2)
[1] 35524.85
> class(z2)
[1] "numeric"
>

where x is set to x = seq(1:1632)
and x2 is set to x^2

I am looking for an interpolating polynomial of the form:
Ax^2 + Bx + C
I do not think the results I got make sense. I believe that I have a 
data type error.  I do not understand why

I need to convert z2 to a data frame if it is already numeric.

Thanks,
Bob

__
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] Plotting rgb proportions in R

2018-12-18 Thread Bert Gunter
3-d Proportions must sum to 1and are thus actually 2-d and should preferaby
be plotted as a ternary plot. Several r packages will do this for you, e.g.
package Ternary. Search "ternary plots" on rseek.org for others.

-- 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 Tue, Dec 18, 2018 at 3:10 PM Jim Lemon  wrote:

> Hi Tasha,
> I may be right off the track, but you could plot RGB proportions on a
> 3D plot. The easiest way I can think if would be to convert your 0-255
> values to proportions:
>
> rgb_prop<-read.table(text="Red Green Blue pct
> 249 158 37 56.311
> 249 158 68 4.319
> 249 158 98 0.058
> 249 128 7 13.965
> 249 128 37 12.87
> 188 128 37 0.029
> 249 128 68 0.161
> 188 128 68 0.015
> 188 98 7 0.029
> 219 128 7 2.773
> 219 128 37 2.583
> 188 98 68 0.058
> 219 128 68 0.525
> 249 188 37 0.876
> 249 188 68 1.08
> 219 98 7 0.482
> 249 188 98 0.015
> 249 158 7 3.852",header=TRUE)
> rgb_prop$Red<-rgb_prop$Red/255
> rgb_prop$Green<-rgb_prop$Green/255
> rgb_prop$Blue<-rgb_prop$Blue/255
> library(scatterplot3d)
> scatterplot3d(rgb_prop[,1:3],cex.symbols=sqrt(rgb_prop[,4]),
>  color=rgb(rgb_prop[,1],rgb_prop[,2],rgb_prop[,3]),pch=19)
>
> then plot the RGB values on a 3D scatterplot. I have included
> arguments to make the symbols the actual RGB colors that you specify
> and their size proportional to the square root of the percentages.
>
> Jim
>
> On Wed, Dec 19, 2018 at 5:17 AM Tasha O'Hara 
> wrote:
> >
> > Hello,
> >
> > I am trying to plot specific rgb color proportions of a marine specimen
> in
> > a stacked plot using R and I was looking for some help. I have several
> > rgb proportions per specimen (an example of one is below).  I've run into
> > different examples of people using vegan or grDevices. Can anyone help
> with
> > this?
> >
> > RedGreen  Blue   %
> > 249 158 37 56.311
> > 249 158 68 4.319
> > 249 158 98 0.058
> > 249 128 7 13.965
> > 249 128 37 12.87
> > 188 128 37 0.029
> > 249 128 68 0.161
> > 188 128 68 0.015
> > 188 98 7 0.029
> > 219 128 7 2.773
> > 219 128 37 2.583
> > 188 98 68 0.058
> > 219 128 68 0.525
> > 249 188 37 0.876
> > 249 188 68 1.08
> > 219 98 7 0.482
> > 249 188 98 0.015
> > 249 158 7 3.852
> >
> > [[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] Plotting rgb proportions in R

2018-12-18 Thread Jim Lemon
Hi Tasha,
I may be right off the track, but you could plot RGB proportions on a
3D plot. The easiest way I can think if would be to convert your 0-255
values to proportions:

rgb_prop<-read.table(text="Red Green Blue pct
249 158 37 56.311
249 158 68 4.319
249 158 98 0.058
249 128 7 13.965
249 128 37 12.87
188 128 37 0.029
249 128 68 0.161
188 128 68 0.015
188 98 7 0.029
219 128 7 2.773
219 128 37 2.583
188 98 68 0.058
219 128 68 0.525
249 188 37 0.876
249 188 68 1.08
219 98 7 0.482
249 188 98 0.015
249 158 7 3.852",header=TRUE)
rgb_prop$Red<-rgb_prop$Red/255
rgb_prop$Green<-rgb_prop$Green/255
rgb_prop$Blue<-rgb_prop$Blue/255
library(scatterplot3d)
scatterplot3d(rgb_prop[,1:3],cex.symbols=sqrt(rgb_prop[,4]),
 color=rgb(rgb_prop[,1],rgb_prop[,2],rgb_prop[,3]),pch=19)

then plot the RGB values on a 3D scatterplot. I have included
arguments to make the symbols the actual RGB colors that you specify
and their size proportional to the square root of the percentages.

Jim

On Wed, Dec 19, 2018 at 5:17 AM Tasha O'Hara  wrote:
>
> Hello,
>
> I am trying to plot specific rgb color proportions of a marine specimen in
> a stacked plot using R and I was looking for some help. I have several
> rgb proportions per specimen (an example of one is below).  I've run into
> different examples of people using vegan or grDevices. Can anyone help with
> this?
>
> RedGreen  Blue   %
> 249 158 37 56.311
> 249 158 68 4.319
> 249 158 98 0.058
> 249 128 7 13.965
> 249 128 37 12.87
> 188 128 37 0.029
> 249 128 68 0.161
> 188 128 68 0.015
> 188 98 7 0.029
> 219 128 7 2.773
> 219 128 37 2.583
> 188 98 68 0.058
> 219 128 68 0.525
> 249 188 37 0.876
> 249 188 68 1.08
> 219 98 7 0.482
> 249 188 98 0.015
> 249 158 7 3.852
>
> [[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] geom_ribbon function in ggplot2 package

2018-12-18 Thread John
Hi,

   When using the geom_ribbon function in gglot2 package, I got the text
"fill" above the legend "A" and "B". How can I get rid of the text "fill"
above the legend?

   Thanks!

The code is as follows:


df<-data.frame(x=c(1,2), y=c(1,2), z=c(3,5))
> ggplot(df,
aes(1:2))+geom_ribbon(aes(ymin=0,ymax=df[,"y"],fill="A"),alpha=0.5)+geom_ribbon(aes(ymin=0,ymax=df[,"z"],fill="B"),alpha=0.5)

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