-------- Original-Nachricht -------- > Datum: Thu, 31 May 2012 11:16:32 +0000 > Von: "ONKELINX, Thierry" <thierry.onkel...@inbo.be> > An: Johannes Radinger <jradin...@gmx.at>, "R-help@r-project.org" > <R-help@r-project.org> > Betreff: RE: [R] Transform counts into presence/absence
> Just use the logical operators. of course, that simple :) . thank you! > > Counts <- c(1,0,21,2,0,0,234,2,0) > Counts > 0 > 1 *(Counts > 0) > > ir. Thierry Onkelinx > Instituut voor natuur- en bosonderzoek / Research Institute for Nature and > Forest > team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance > Kliniekstraat 25 > 1070 Anderlecht > Belgium > + 32 2 525 02 51 > + 32 54 43 61 85 > thierry.onkel...@inbo.be > www.inbo.be > > To call in the statistician after the experiment is done may be no more > than asking him to perform a post-mortem examination: he may be able to say > what the experiment died of. > ~ Sir Ronald Aylmer Fisher > > The plural of anecdote is not data. > ~ Roger Brinner > > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > > -----Oorspronkelijk bericht----- > Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > Namens Johannes Radinger > Verzonden: donderdag 31 mei 2012 13:13 > Aan: R-help@r-project.org > Onderwerp: [R] Transform counts into presence/absence > > Hi, > > I am looking for a very easy way to transform a column in a dataframe from > counts (eg. c(1,0,21,2,0,0,234,2,0)) into a binary form to get > presence/absence values e.g. c(1,0,1,1,0,0,1,1,0). Is there a simple built-in > function? > or do I have do to it with a replaceement funciton using IF x > 0 THEN 1 > etc.? > > /johannes > -- > > Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a > > ______________________________________________ > R-help@r-project.org mailing list > 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. > * * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * * > Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver > weer en binden het INBO onder geen enkel beding, zolang dit bericht niet > bevestigd is door een geldig ondertekend document. > The views expressed in this message and any annex are purely those of the > writer and may not be regarded as stating an official position of INBO, as > long as the message is not confirmed by a duly signed document. -- Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a ______________________________________________ R-help@r-project.org mailing list 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.