[R] Error with using windRose function from the open air package

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Tue Feb 24 06:38:15 CET 2015


I have no magic answer for you, just some suggestions until you can clarify your problem.

Your description of loading one column in at a time is a bit odd... It is much more typical to use one of the read.table variants.

Don't use cbind to make data frames. If you have any non-numeric columns then you will make them all into character or factor columns. That is almost never a good thing. In fact it is probably at the root of your current woes.

windSFO <- data.frame(ws,wd,stn,yearSite)

Learn to use the str function... e.g.

str(windSFO)

Not that we cannot tell how your data are stored given the way you gave supplied it to us. Read about the use of dput (e.g. [1]) and make your example reproducible (what package exactly are you talking about? package names don't have spaces in them).

Note that the Posting Guide directs you to verify that your problem occurs when you use the latest version (3.1.2 at this time). If you want to keep old versions around for some reason, at least install the latest version and verify that your problem happens with it before posting.

[1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On February 23, 2015 11:13:20 AM PST, Alexandra Catena <amc5981 at gmail.com> wrote:
>Hello All,
>
>I have a data frame called windSFO of four columns, wind speed, wind
>direction, station number, and date (yyyymmdd).  I downloaded the gz
>data from a site online and then unzipped it using readLines. I then
>concatenated these four columns from the unzipped data into a
>dataframe using cbind.
>
>windSFO = data.frame(cbind(ws,wd,stn,yearSite))
>
>Here are the first four rows as an example:
>
>       ws  wd          stn       yearSite
>
>1      36 290 724940-23234 20090101
>
>2      77 280 724940-23234 20090101
>
>3      72 290 724940-23234 20090101
>
>4      46 290 724940-23234 20090101
>
>
>I'm trying to make a wind rose using the windRose function but I keep
>getting an error that I don't understand. I type in:
>
>windRose(windSFO,ws='ws',wd='wd')
>
>I then get the error:
>
>Error in Summary.factor(c(27L, 35L, 34L, 29L, 28L, 25L, 25L, 24L, 24L, 
>:
>  max not meaningful for factors
>In addition: Warning messages:
>1: In Ops.factor(mydata[[wd]], 10) : %% not meaningful for factors
>2: In Ops.factor(mydata[[wd]], angle) : / not meaningful for factors
>
>Can anyone tell me what this means/what I'm doing wrong?
>
>Also, I have R version 3.1.1
>
>Thank you!
>Alexandra
>
>______________________________________________
>R-help at 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.



More information about the R-help mailing list