[R] Basic matematical functions with NAs

Alexander.Herr@csiro.au Alexander.Herr at csiro.au
Thu May 26 00:45:06 CEST 2005


Conceptually your assumption is wrong: If you have the traps out and don't catch fruit in the trap than you have 0 captures. NA would come for example from a trap not functioning properly at a certain day.

To get R to recognize NA you need to define your variables as numeric or factors. Quickest I find to produce the data in a spreadsheet/database and have NAs defined as -99999. Than import into R via CSV format and replace -99999 with NA. Do read the R documentation on http://www.r-project.org/. Introduction to R is most helpful...

Herry

-------------------------------------------
Alexander Herr - Herry
Northern Futures
Davies Laboratory, CSIRO
PMB, Aitkenvale, QLD 4814
Phone (07) 4753 8510
Fax   (07) 4753 8650
Home: http://herry.ausbats.org.au
Webadmin ABS: http://ausbats.org.au
Sustainable Ecosystems: http://www.cse.csiro.au/
--------------------------------------------

XXXXXXXXXXXXXXXXXXXXXXXXOriginal messageXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Message: 19
Date: Tue, 24 May 2005 10:22:53 -0700
From: "Paulo Brando" <pmbrando at ipam.org.br>
Subject: [R] Basic matematical functions with NAs
To: <r-help at stat.math.ethz.ch>
Message-ID: <003001c56085$38ea1930$f10aa8c0 at paulobrando>
Content-Type: text/plain

Dear All,

I've tried to sum columns -- different species of flowers, fruits plus twigs -- with NAs to get litterfall/trap, and then after use litterfall to calculate production (litterfall (grams)/ hectare/ day. But R 'sees' litterfall/trap as a string. 

My question: How to use basic mathematical functions to deal with NAs in data management. 

Example (as you can note I have many missing values -- no fruit  fell in the trap.


      area ponto date pseco psaco pliquido florg1 flor1 florg2 flor2 florg3 flor3 frutog1 fruto1 frutog2 fruto2 frutog3 fruto3 frutog4 fruto4 frutog5 fruto5 frutog6 fruto6 frutog7 fruto7 frutog8 fruto8 twigs  
      A A 1 38233 17.7 1.6 7.1 0.266 1                       
      A AA 1 38233 12.5 8.7 3.8                         
      A AB 1 38233 13.9 1.7 3.2       0.421 3                 
      A B 1 38233 12.1 1.6 1.5       0.248 2 0.435 7 0.16 1             
      A BORDA 1 38233                            
      A C 1 38233 15.6 1.7 4.9       0.374 2 0.298 3 0.231 1             
      A F 1 38233 14 1.5 3.5 0.366 45     0.153 1 0.15 1               



Paulo Brando
Inst. de Pesquisa Ambiental da Amazônia (IPAM)
Rua Rui Barbosa,136.
68.005.080 Santarém, PA, Brazil.
Fone/Fax ++ 55 93 522 5538
www.ipam.org.br
	[[alternative HTML version deleted]]



-
 




More information about the R-help mailing list