Torleif Markussen Lunde
2006-May-10 07:33 UTC
[R] How to use function to change density in sm.density?
I have trawl data (fish) for different areas. In each catch length of the different fish is registerd. However the real catch has to be calibrated because the trawl is selective. For fish<=15cm the adjusted catch is (old.frequency*35/19) for fish>15cm and <62cm the adjusted catch is (old.frequency*35/( 5.91*frequency^0.43) and for fish=>62cm the catch need no adjustment. Basically what I need is to know how to write an expression i R that says something like if (fishlength<=15) new.dens<-old.density*35/19 if (fishlength>15&fishlength<62) update the new.dens with old.dens*35/( 5.91*density^0.43) else old.density=old.density (this should also be updated in new.dens) After these steps I wold like to draw the new adjusted densityline. Any suggestions are welcome. Best regards T M Lunde [[alternative HTML version deleted]]