An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110510/9415c17f/attachment.pl>
help to change value in a Data.frame
2 messages · gianni lavaredo, Lyndon Estes
Hi Gianni, Try this mydf[mydf$value < 0, "value"] <- 100 or this mydf[mydf$value %in% c(-4, -5), "value"] <- 100 Cheers, Lyndon On Tue, May 10, 2011 at 12:30 PM, gianni lavaredo
<gianni.lavaredo at gmail.com> wrote:
Dear researchers, sorry I know it's no the right mailist but I have this problem. mydf <- data.frame(id=c(1,2,3,4,5),value=c(2,3,-5,6,-4)) ?id value 1 ?1 ? ? 2 2 ?2 ? ? 3 3 ?3 ? ?-5 4 ?4 ? ? 6 5 ?5 ? ?-4 I wish to select and change the value of negative number mydf[mydf$value >= -4 & mydf$value <= -5, c(2)] <- 100 to have ?id value 1 ?1 ? ? 2 2 ?2 ? ? 3 3 ?3 ? ?100 4 ?4 ? ? 6 5 ?5 ? ?100 but the normal expression doesn't work because they are negative value thanks in advance Gianni ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Lyndon Estes Research Associate Woodrow Wilson School Princeton University +1-609-258-2392 (o) +1-609-258-6082 (f) +1-202-431-0496 (m) lestes at princeton.edu