Skip to content

strip levels

4 messages · Christine Lee, Sarah Goslee, Michael Dewey +1 more

#
Thank you very much to Both Sarah and Michael,

Your responses are deeply appreciated.  TxT

I have omitted the reinstatement of the data source as follows:

library(lattice)
histogram(~Width|Station*Year, data=Raw.no10, layout=c(4,2),nin=30,xlab="Prosomal Width (mm)", strip=strip.custom(bg='white'),ylab="Frequencies",tick=-1,col='grey',as.table=TRUE) 

Instead of showing respective year of 2002 and 2014 in each of the lattice plot, it just shows "Year" in all lattice plot as attached.  TxT

Do you know what has gone wrong?

Many thanks.

Regards,
Christine




--------------------------------------------
2015?4?6? ????Michael Dewey <lists at dewey.myzen.co.uk> ???

 ??: Re: [R] strip levels
 ???: "Sarah Goslee" <sarah.goslee at gmail.com>, "Chr
 ??(CC): "r-help" <r-help at r-project.org>
 ??: 2015?4?6?,???,??11:15

 See inline

 On 06/04/2015 15:39, Sarah
Goslee wrote:
> Hi,
 >
 > On Mon, Apr 6, 2015
 at 7:44 AM, Christine Lee via R-help
 >
 <r-help at r-project.org>
 wrote:
 >> To whom it may help,
 >>
 >> I am new to
 R.
 >>
 >> I have
 been tring to have a lattice plot in two strip levels: 4
 stations in 2 years.
 >>
 >> I type in:
 >>
 >>
 histogram(~Raw.no10$Width|Raw.no10$Station*Raw.no10$Year,
 data=Raw.no10, layout=c(4,2),nin=30,xlab="Prosomal
 Width (mm)",
 strip=strip.custom(bg='white'),ylab="Frequencies",tick=-1,col='grey',as.table=TRUE)
 >
 > In both examples,
 you're mis-stating the data. Given the data
 > argument, you do not need to restate the
 data source.
 >
 >
 histogram(~Width | Station*Raw.no10$Year, data=Raw.no10,

 I think Sarah meant to type
 Station * Year and not as above

 >
 layout=c(4,2),nin=30,xlab="Prosomal Width
 (mm)",
 >
 strip=strip.custom(bg='white'),ylab="Frequencies",tick=-1,col='grey',as.table=TRUE)
 >
 > If that doesn't
 solve your problem, then please use
 >
 dput(head(Raw.no10), 20) to provide some example data, or
 create fake
 > data of the same
 structure.
 >
 > Without
 a reproducible example that includes some sample data (fake
 is
 > fine), the code you used, and some
 clear idea of what output you
 > expect,
 it's impossible to figure out how to help you. Here are
 some
 > suggestions for creating a good
 reproducible example:
 > http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 >
 >
 >> The second level, i.e. Year, showed as
 "Raw.no10$Year" in the each of the lattice plot,
 instead of its respective year, such as "2002" and
 "2014".
 >>
 >> I changed to the following programme
 language, therefore:
 >>
 >>
 histogram(~Raw.no10$Width|Raw.no10$Station*Raw.no10$Year,
 data=Raw.no10, layout=c(4,2),nin=30,xlab="Prosomal
 Width (mm)",
 strip=strip.custom(bg='white',var.name=c("2002","2014")),ylab="Frequencies",tick=-1,col='grey',as.table=TRUE)
 >>
 >> in order to
 specify the variable names of the strip.
 >>
 >> Instead of
 showing "Raw.no10$Year", each of the lattice plot
 states "2014"!? They should have 4 plots showing
 "2002" and another 4 showing "2014".
 >>
 >> Could any one
 help indicating what has gone wrong?
 >>
 >> I am really
 helpless and frustrated now.? T_T
 >>
 >> Regards,
 >> Christine
 >
 >

 -- 
 Michael
 http://www.dewey.myzen.co.uk/home.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Histogram-no10-1.pdf
Type: application/pdf
Size: 6924 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150406/15ddc7d2/attachment.pdf>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testing.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150406/15ddc7d2/attachment.txt>
#
Please use dput() to provide your data, as already requested. Just
providing the text file doesn't tell us enough about the structure:
are some columns factors? etc.

Or, if you must provide an attachment (really not preferred, as many
attachments won't make it to the list, and many people do not want to
open unsolicited attachments), also include the code to import it
*exactly the way you did*.


Without a reproducible example that includes some sample data (fake is
fine), the code you used, and some clear idea of what output you
expect, it's impossible to figure out how to help you. Here are some
suggestions for creating a good reproducible example:
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example



Sarah
On Mon, Apr 6, 2015 at 12:40 PM, Christine Lee <leptostracan at yahoo.com> wrote:
#
Dear Christine
Are you sure that your variable Year is not numeric? You example plot 
looks to me as though it is treating it as a shingle.

What does str(Raw.no10) tell you about Year?
On 06/04/2015 17:40, Christine Lee wrote:

  
    
  
#
Hi

As Michael suggested your Year variable is probably numeric. Quick fix could be.

histogram(~Width|Station*as.factor(Year), data=Raw.no10, layout=c(4,2),nin=30,xlab="Prosomal Width (mm)", strip=strip.custom(bg='white'),ylab="Frequencies",tick=-1,col='grey',as.table=TRUE)

Cheers
Petr
________________________________
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.