Re: [R] Adjusting axis labels on lattice xyplot [RESOLVED]

2016-10-17 Thread Rich Shepard

On Mon, 17 Oct 2016, Rui Barradas wrote:


I'm not a lattice user but the 'by' argument is not an argument of xyplot,
it's an argument of ?seq.Date.


Rui,

  Yes, this does help.

Thanks very much,

Rich

__
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] Adjusting axis labels on lattice xyplot

2016-10-17 Thread Rui Barradas

Hello,

I'm not a lattice user but the 'by' argument is not an argument of 
xyplot, it's an argument of ?seq.Date.


Hope this helps,

Rui Barradas

Em 17-10-2016 15:45, Rich Shepard escreveu:

On Fri, 14 Oct 2016, David Winsemius wrote:


xyplot(amount ~ date | station, data=rain, main="Weather Stations",
  xlab="Date", ylab="Amount (inches)", pch=16, col=132,
  scales=list(y=list(at=0:4),
  x=list(at=seq(min(rain$date), max(rain$date),
by='week'), rot=90) )
)


David,

   I searched ?xyplot for the 'by' option in scales and did not find it. I
understand the other parameters of scales and would like to learn how to
use
'by' when appropriate.

TIA,

Rich

__
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] Adjusting axis labels on lattice xyplot

2016-10-17 Thread Rich Shepard

On Fri, 14 Oct 2016, David Winsemius wrote:


xyplot(amount ~ date | station, data=rain, main="Weather Stations",
  xlab="Date", ylab="Amount (inches)", pch=16, col=132,
  scales=list(y=list(at=0:4),
  x=list(at=seq(min(rain$date), max(rain$date), by='week'), rot=90) 
)
)


David,

  I searched ?xyplot for the 'by' option in scales and did not find it. I
understand the other parameters of scales and would like to learn how to use
'by' when appropriate.

TIA,

Rich

__
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] Adjusting axis labels on lattice xyplot

2016-10-15 Thread Rolf Turner

On 16/10/16 12:10, Rich Shepard wrote:

On Sat, 15 Oct 2016, David Winsemius wrote:


I am not the one to answer the windoze question but my Mac (being less
sensible than Rolf) also pops up a help window when queried with
?xyplot()


David,

  Well, on my Slackware system writing in emacs with ESS ?read.csv()
produces the error message that there's no documentation for that, while
?read.csv brings up the help page.

Shrug.


Ah!  It's Emacs.  Enuff said! :-)  (IMHO Emacs is too clever by half.)

cheers,

Rolf

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

__
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] Adjusting axis labels on lattice xyplot

2016-10-15 Thread Rich Shepard

On Sat, 15 Oct 2016, David Winsemius wrote:


I am not the one to answer the windoze question but my Mac (being less
sensible than Rolf) also pops up a help window when queried with ?xyplot()


David,

  Well, on my Slackware system writing in emacs with ESS ?read.csv()
produces the error message that there's no documentation for that, while
?read.csv brings up the help page.

Shrug,

Rich

__
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] Adjusting axis labels on lattice xyplot

2016-10-15 Thread Rich Shepard

On Sun, 16 Oct 2016, Rolf Turner wrote:


Presumably you are running (yeuccch) Windoze,


Rolf,

  Not since mid-1997. Slackware-14.1 on this host.

Rich

__
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] Adjusting axis labels on lattice xyplot

2016-10-15 Thread David Winsemius

> On Oct 15, 2016, at 3:48 PM, Rolf Turner  wrote:
> 
> On 16/10/16 11:28, Rich Shepard wrote:
>> On Fri, 14 Oct 2016, Rich Shepard wrote:
>> 
 So typing ?xyplot at the console doesn't bring up a help page? That
 would
 imply that you need to reinstall R.
>> 
>>> Will rebuild and re-install tomorrow morning.
>> 
>>  Sigh. User error. I entered the string as a function, e.g., ?xyplot()
>> rather than by its name.
>> 
>>  When entered correctly the help page appears.
>> 
>> Apologies.
> 
> Just out of interest, I tried typing "?xyplot()" and it worked just as if I'd 
> typed "?xyplot" (without the parentheses).
> 
> So I am puzzled as to why this didn't work for you (despite your --- very 
> mild! --- user error).  Presumably you are running (yeuccch) Windoze, whereas 
> I (being a Sensible Person) am running Ubuntu Linux.
> Could this make a difference?

I am not the one to answer the windoze question but my Mac (being less sensible 
than Rolf) also pops up a help window when queried with ?xyplot()

Best;
David.
> 
> cheers,
> 
> Rolf
> 
> -- 
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
> 
> __
> 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

__
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] Adjusting axis labels on lattice xyplot

2016-10-15 Thread Rolf Turner

On 16/10/16 11:28, Rich Shepard wrote:

On Fri, 14 Oct 2016, Rich Shepard wrote:


So typing ?xyplot at the console doesn't bring up a help page? That
would
imply that you need to reinstall R.



 Will rebuild and re-install tomorrow morning.


  Sigh. User error. I entered the string as a function, e.g., ?xyplot()
rather than by its name.

  When entered correctly the help page appears.

Apologies.


Just out of interest, I tried typing "?xyplot()" and it worked just as 
if I'd typed "?xyplot" (without the parentheses).


So I am puzzled as to why this didn't work for you (despite your --- 
very mild! --- user error).  Presumably you are running (yeuccch) 
Windoze, whereas I (being a Sensible Person) am running Ubuntu Linux.

Could this make a difference?

cheers,

Rolf

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

__
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] Adjusting axis labels on lattice xyplot

2016-10-15 Thread Rich Shepard

On Fri, 14 Oct 2016, Rich Shepard wrote:


So typing ?xyplot at the console doesn't bring up a help page? That would
imply that you need to reinstall R.



 Will rebuild and re-install tomorrow morning.


  Sigh. User error. I entered the string as a function, e.g., ?xyplot()
rather than by its name.

  When entered correctly the help page appears.

Apologies,

Rich

__
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] Adjusting axis labels on lattice xyplot

2016-10-14 Thread Rich Shepard

On Fri, 14 Oct 2016, David Winsemius wrote:


Notice that the formula has just the column names rather than using `$`.
But need to give `rain$date` to functions in hte scales list. It always
seemed to me that the evaluation of names inside the scales list should
also be evaluated inside the `data` environment but Deepayan didn't design
it that way, so you need to "reach out" to get them pulled back in.


David,

  Mea culpa. I left off the data argument.


So typing ?xyplot at the console doesn't bring up a help page? That would
imply that you need to reinstall R.


  Will rebuild and re-install tomorrow morning.

  Thanks again.

Carpe weekend,

Rich

__
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] Adjusting axis labels on lattice xyplot

2016-10-14 Thread David Winsemius

> On Oct 14, 2016, at 3:51 PM, Rich Shepard  wrote:
> 
> On Fri, 14 Oct 2016, David Winsemius wrote:
> 
>>> rain <- source("~/raindata.dat")
>>> str(rain)
>> List of 2
>> $ value  :'data.frame':  341 obs. of  3 variables:
>> ..$ station: Factor w/ 6 levels "0.3E","0.6W",..: 1 1 1 1 1 1 1 1 1 1 ...
>> ..$ date   : Factor w/ 62 levels "2013-12-01","2013-12-02",..: 32 33 34 35 
>> 36 37 38 39 40 41 ...
>> ..$ amount : Factor w/ 48 levels "","0.00","0.01",..: 1 1 3 2 2 2 12 18 34 
>> 14 ...
>> $ visible: logi TRUE
> 
> David,
> 
>  I left the station as a factor and changed the date using
> as.Date(as.character...) and the amount using as.numeric.
> 
>> When you do that you can see the only the first item in the length2 list
>> is likely to be useful:
> 
>  I'm not seeing to what the 'List of 2' refers in the data.frame.
> 
>  This is the script I sourced:
> 
> rain <- read.csv("daily_records.csv", header=T, sep=",")
> require(lattice)
> rain$date <- as.Date(as.character(rain$date))
> rain$amount <- as.numeric(rain$amount)
> xyplot(rain$amount ~ rain$date | rain$station, main="Weather Stations", 
> xlab="Date", ylab="Amount (inches)", pch=20, col=132)
> 
>  What did I do incorrectly here?

Well, you didn't send a text file with the contents of "daily_records.csv"; 
rather you sent a text file that was R code that would return a data object. I 
assigned it to the name `rain` before I realized it was a two item list. I then 
fixed the problems that assignment and the factor Dates presented so that I 
could then give a `data=rain` parameter to the xyplot function.
> 
> 
>> And the date column is a factor. Fortunately the as.Date.factor function
>> doesn't need as.chaacter anymore:
> 
>  Oh. Thanks.
> 
>> The place on the ?xyplot help page to look is in the section on `scales`.
>> There's no difficulty using 'rot' as long as it is in the correct place
>> which in this instance is `x` sublist of the `scales` list
> 
>> xyplot(amount ~ date | station, data=rain, main="Weather Stations",
>>   xlab="Date", ylab="Amount (inches)", pch=16, col=132,
>>   scales=list(y=list(at=0:4),
>>   x=list(at=seq(min(rain$date), max(rain$date), by='week'), 
>> rot=90) )
>> )

Notice that the formula has just the column names rather than using `$`. But 
need to give `rain$date` to functions in hte scales list. It always seemed to 
me that the evaluation of names inside the scales list should also be evaluated 
inside the `data` environment but Deepayan didn't design it that way, so you 
need to "reach out" to get them pulled back in.

> 
>  That's what I missed: where the scales command is placed, and
> understanding how to use all the components.
> 
>  I need to figure out why I'm no longer seeing the help files. As far as I
> know they should be loaded when I invoke R.

So typing ?xyplot at the console doesn't bring up a help page? That would imply 
that you need to reinstall R.
> 
> Thanks very much,
> 
> Rich
> 
> __
> 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

__
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] Adjusting axis labels on lattice xyplot

2016-10-14 Thread Rich Shepard

On Fri, 14 Oct 2016, David Winsemius wrote:


rain <- source("~/raindata.dat")
str(rain)

List of 2
$ value  :'data.frame': 341 obs. of  3 variables:
 ..$ station: Factor w/ 6 levels "0.3E","0.6W",..: 1 1 1 1 1 1 1 1 1 1 ...
 ..$ date   : Factor w/ 62 levels "2013-12-01","2013-12-02",..: 32 33 34 35 36 
37 38 39 40 41 ...
 ..$ amount : Factor w/ 48 levels "","0.00","0.01",..: 1 1 3 2 2 2 12 18 34 14 
...
$ visible: logi TRUE


David,

  I left the station as a factor and changed the date using
as.Date(as.character...) and the amount using as.numeric.


When you do that you can see the only the first item in the length2 list
is likely to be useful:


  I'm not seeing to what the 'List of 2' refers in the data.frame.

  This is the script I sourced:

rain <- read.csv("daily_records.csv", header=T, sep=",")
require(lattice)
rain$date <- as.Date(as.character(rain$date))
rain$amount <- as.numeric(rain$amount)
xyplot(rain$amount ~ rain$date | rain$station, main="Weather Stations", xlab="Date", 
ylab="Amount (inches)", pch=20, col=132)

  What did I do incorrectly here?


And the date column is a factor. Fortunately the as.Date.factor function
doesn't need as.chaacter anymore:


  Oh. Thanks.


The place on the ?xyplot help page to look is in the section on `scales`.
There's no difficulty using 'rot' as long as it is in the correct place
which in this instance is `x` sublist of the `scales` list



xyplot(amount ~ date | station, data=rain, main="Weather Stations",
   xlab="Date", ylab="Amount (inches)", pch=16, col=132,
   scales=list(y=list(at=0:4),
   x=list(at=seq(min(rain$date), max(rain$date), by='week'), 
rot=90) )
 )


  That's what I missed: where the scales command is placed, and
understanding how to use all the components.

  I need to figure out why I'm no longer seeing the help files. As far as I
know they should be loaded when I invoke R.

Thanks very much,

Rich

__
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] Adjusting axis labels on lattice xyplot

2016-10-14 Thread David Winsemius

> On Oct 14, 2016, at 12:03 PM, Rich Shepard  wrote:
> 
>  I've read chapters 7 and 8 in the Lattice book and do not see how to thin
> labels on the x and y axes of an xyplot(), and how to rotate the dates on
> the x axis for easier reading (rot did not do the job for me.)
> 
>  The data (as raindata.dat) and the existing plot (as precip.pdf) are
> attached.

The structure( .. ) call would need to be sourced:

> rain <- source("~/raindata.dat")
> str(rain)
List of 2
 $ value  :'data.frame':341 obs. of  3 variables:
  ..$ station: Factor w/ 6 levels "0.3E","0.6W",..: 1 1 1 1 1 1 1 1 1 1 ...
  ..$ date   : Factor w/ 62 levels "2013-12-01","2013-12-02",..: 32 33 34 35 36 
37 38 39 40 41 ...
  ..$ amount : Factor w/ 48 levels "","0.00","0.01",..: 1 1 3 2 2 2 12 18 34 14 
...
 $ visible: logi TRUE

When you do that you can see the only the first item in the length2 list is 
likely to be useful:

> str(rain[[1]])
'data.frame':   341 obs. of  3 variables:
 $ station: Factor w/ 6 levels "0.3E","0.6W",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ date   : Factor w/ 62 levels "2013-12-01","2013-12-02",..: 32 33 34 35 36 37 
38 39 40 41 ...
 $ amount : Factor w/ 48 levels "","0.00","0.01",..: 1 1 3 2 2 2 12 18 34 14 ...

#So re-assign#

rain <- rain[[1]]

And the date column is a factor. Fortunately the as.Date.factor function 
doesn't need as.chaacter anymore:

rain$date=as.Date(rain$date)


> 
>  The ploting command used is:
> 
> xyplot(rain$amount ~ rain$date | rain$station, main="Weather Stations",
> xlab="Date", ylab="Amount (inches)", pch=16, col=132)
> 
>  Please point me to the appropriate place in the book where the prepanel
> function to change the axis lable spacing and rotation is discussed.

The place on the ?xyplot help page to look is in the section on `scales`. 
There's no difficulty using 'rot' as long as it is in the correct place which 
in this instance is `x` sublist of the `scales` list

xyplot(amount ~ date | station, data=rain, main="Weather Stations",
xlab="Date", ylab="Amount (inches)", pch=16, col=132, 
scales=list(y=list(at=0:4), 
x=list(at=seq(min(rain$date), max(rain$date), by='week'), 
rot=90) )
  )




> I
> expected it to be in chapter 8. Or, if there's another reference I should
> read, please point me to that.


> 
>  For some reason I've not yet tracked down, there is no longer help
> available within the R session (running in emacs with ESS) when I type, for
> example, ?xyplot. R returns the message that there's no documentation in the
> specified packages and libraries. Obviously something changed since I last
> used R.
> 
> Rich__
> 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

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