Skip to content
Prev 12122 / 398502 Next

by/ NA/ barplot

Colleagues

----------------------------------
System info:
Version 1.3.0  (2001-06-22) on NT
ESS v. 5.1.18 using emacs ver. 20.4

----------------------------------
I have generated an object (class = by) with NA values and want to plot 
the output as a bargraph:

  x2 <- by(scl.nos, species, sum) 

These data are summed counts of fish by species
INDICES: AGI
[1] 0.729927
------------------------------------------------------------ 
INDICES: BAR
[1] NA
------------------------------------------------------------ 
INDICES: BYS
[1] 85.71429
------------------------------------------------------------ 
INDICES: CHA
[1] 2.919708
------------------------------------------------------------ 
INDICES: CIN
[1] 36.31983
------------------------------------------------------------ 
INDICES: CSU
[1] 2381.685
------------------------------------------------------------ 
INDICES: CYP
[1] 1.260504
------------------------------------------------------------ 
INDICES: ETB
[1] 11.62791
------------------------------------------------------------ 
INDICES: FRO
[1] 0.7142857
------------------------------------------------------------ 
INDICES: GSH
[1] NA
------------------------------------------------------------ 
INDICES: HAK
[1] 2.976854
------------------------------------------------------------ 
INDICES: HJO
[1] 85.78232
------------------------------------------------------------ 
INDICES: HOK
[1] 16.59766
------------------------------------------------------------ 
INDICES: IDI
[1] 4.379562
------------------------------------------------------------ 
INDICES: JMM
[1] 3.928571
------------------------------------------------------------ 
INDICES: LAN
[1] NA
------------------------------------------------------------ 
INDICES: LPA
[1] 0.729927
------------------------------------------------------------ 
INDICES: MAL
[1] 0.729927
------------------------------------------------------------ 
INDICES: MMU
[1] NA
------------------------------------------------------------ 
INDICES: NOS
[1] NA
------------------------------------------------------------ 
INDICES: ORH
[1] 2.980198
------------------------------------------------------------ 
INDICES: RBM
[1] 17.08163
------------------------------------------------------------ 
INDICES: RBT
[1] 17.14286
------------------------------------------------------------ 
INDICES: RBY
[1] 0.7142857
------------------------------------------------------------ 
INDICES: RCO
[1] NA
------------------------------------------------------------ 
INDICES: RHY
[1] 12.85714
------------------------------------------------------------ 
INDICES: RIB
[1] 0.729927
------------------------------------------------------------ 
INDICES: SAW
[1] 0.729927
------------------------------------------------------------ 
INDICES: SCH
[1] 0.3571429
------------------------------------------------------------ 
INDICES: SDO
[1] 399.7593
------------------------------------------------------------ 
INDICES: SSI
[1] 0.3571429
------------------------------------------------------------ 
INDICES: SWA
[1] 0.7142857
------------------------------------------------------------ 
INDICES: TUB
[1] 12.49747

When I try to plot them I get an error due to the NA values, I think:
+             xlab='fish length (SL or TL)  cm',
+             ylab='individuals per nm towed', col='black')
Error in plot.window(xlim, ylim, log, asp, ...) : 
	need finite ylim values

Plot.table gives me the same error and I tried na.rm=TRUE to no effect. 
Is this simple to solve? I guess I need to replace the NAs with zeros in 
one of the by attributes?

Help will be appreciated.
Thanks

Sam

Sam McClatchie, Research scientist (fisheries acoustics))))))))))
NIWA (National Institute of Water & Atmospheric Research Ltd)
PO Box 14 901, Kilbirnie, Wellington, New Zealand
s.mcclatchie at niwa.cri.nz 

                    /\
...>><xX(?> // \\
                 /// \\\   
                //// \\\\
               ///  <?)Xx><<
              /////  \\\\\\
        ><(((?>   
  >><(((?>   ...>><xX(?>O<?)Xx><<

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._