[R] warnings from hist(): parameter XXX couldn't be set in high-level plot functionN

From: <George_Heine_at_blm.gov>
Date: Fri 27 May 2005 - 01:31:55 EST

Hello -

This is not a real problem, just an annoyance. Sometimes, but not always, I get a set of strange warnings from hist(). Example follows.

############################

#Produce a histogram of start dates for a set of field measurements.

# I didn't reproduce all the dates, because not sure it's relevant, but here's a sample.
# Note the invalid date in the fifth element.
> StartDate[sample(1:length(StartDate),20)]

 [1] "2004-08-26" "1997-09-08" "2004-08-19" "1997-09-08" "0999-07-20"
 [6] "2001-11-28" "2000-11-02" "1997-09-08" "2004-08-19" "2004-10-28"
[11] "1997-09-08" "1997-09-09" "1997-09-08" "1998-09-08" "1997-09-09"
[16] "1997-09-08" "2004-10-28" "1997-09-08" "2004-08-19" "1997-09-08"

> years<-as.Date(c(#
+    "1995-01-01","1996-01-01","1996-01-01",
+    "1997-01-01","1998-01-01","1999-01-01","2000-01-01","2001-01-01",
+    "2002-01-01","2003-01-01","2004-01-01","2005-01-01"))

> years

 [1] "1995-01-01" "1996-01-01" "1996-01-01" "1997-01-01" "1998-01-01"
 [6] "1999-01-01" "2000-01-01" "2001-01-01" "2002-01-01" "2003-01-01"
[11] "2004-01-01" "2005-01-01"

> TimeSpan<-as.integer(difftime(StopDate,StartDate))
Warning message:
NAs introduced by coercion
# Note: NAs correspond to 3 invalid dates, apparently typos

> h<-hist(StartDate[TimeSpan>0 & StartDate>years[1]], breaks=years, freq=T,
+ main="",xlab="",ylab="number of sites", col="grey") Warning messages:

1: parameter "main" couldn't be set in high-level plot() function
2: parameter "ylab" couldn't be set in high-level plot() function
3: parameter "main" couldn't be set in high-level plot() function
4: parameter "ylab" couldn't be set in high-level plot() function
#########################################3

The resulting histogram was generated, and the plot labels main, xlab, ylab, were as expected. Just curious about what the warning messages mean. Why are there two warnings each about 'main' and 'ylab', and none about 'xlab'? Another puzzling thing is that this message does not always occur,
Searched the FAQ and the mail archives and couldn't find anything helpful.

 By the way, is there a way to use seq() to generate something like the "years" sequence above?

I'm using R 2.0.1 (precompiled version for windows.)

Thanks for your help !
<>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>
George Heine, PhD
Mathematical Analyst
National IRM Center
U.S. Bureau of Land Management
voice (303) 236-0099

fax       (303) 236-1974
cell      (303) 905-5382

pager gheine@my2way.com
<>=<>=<>=<>=<>=<>=<>=<>=<>=<>=<>

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri May 27 02:13:06 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:07 EST