Try this: ifelse(!u$POSITION, 'Positions are wrong', '')
On Wed, May 26, 2010 at 9:31 AM, arnaud Gaboury <arnaud.gabo...@gmail.com>wrote: > Dear group, > > Here is my data frame: > > > dput(u) > structure(list(DESCRIPTION = structure(c(2L, 5L, 6L, 7L, 9L, > 11L, 12L, 15L, 14L, 16L, 1L, 10L, 3L, 4L, 13L, 8L, 17L), .Label = c("COFFEE > C Jul/10", > "COPPER May/10", "CORN Jul/10", "CORN May/10", "COTTON NO.2 Jul/10", > "CRUDE OIL miNY May/10", "GOLD Jun/10", "HENRY HUB NATURAL GAS May/10", > "ROBUSTA COFFEE (10) Jul/10", "SILVER May/10", "SOYBEANS Jul/10", > "SPCL HIGH GRADE ZINC USD", "STANDARD LEAD USD", "SUGAR NO.11 Jul/10", > "SUGAR NO.11 May/10", "WHEAT Jul/10", "WHEAT May/10"), class = "factor"), > PL = c(3500, -1874.99999999999, -2612.50000000003, -2169.99999999998, > -680, 425, 1025, 1008.00000000000, -3057.59999999999, 3212.5, > -1781.25000000001, -2265.0, 75, -387.5, 2950, 490.000000000013, > 0), POSITION = c(-2, 3, 2, 2, 18, 3, -1, -1, 5, 5, 0, 0, > 0, 0, 0, 0, 0)), .Names = c("DESCRIPTION", "PL", "POSITION" > ), class = "data.frame", row.names = c(NA, -17L)) > > I want to give a warning message if one of the element of the POSITION > column is different from zero. > > I tried using mapply with some line like this : > > > mapply(if,u$POSITION,==0,print("WARNING:POSITIONS ARE WRONG",quote=F)) > But it seems it is not the correct way to pass the various arguments. > > Any help is appreciated > > > > > *************************** > Arnaud Gaboury > Mobile: +41 79 392 79 56 > BBM: 255B488F > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ 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.