[R] Regex and gsub
arnaud Gaboury
arnaud.gaboury at gmail.com
Tue May 11 10:37:28 CEST 2010
Dear group,
Here is my df :
df3 <-
structure(list(DESCRIPTION = c("COPPER May/10", "COTTON NO.2 Jul/10",
"CRUDE OIL miNY May/10", "GOLD Jun/10", "ROBUSTA COFFEE (10) Jul/10",
"SOYBEANS Jul/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 May/10",
"WHEAT Jul/10", "SPCL HIGH GRADE ZINC USD", "STANDARD LEAD USD",
"CORN May/10", "SILVER May/10", "WHEAT May/10", "COFFEE C Jul/10",
"CORN Jul/10", "HENRY HUB NATURAL GAS May/10"), POSITION = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), prix = c(-14,
3.74999999999997, 5.22500000000005, 21.6999999999998, 68, -8.5,
2.72999999999999, -0.900000000000002, -64.25, -41, -118, 7.75,
45.300, 0, 4.75000000000003, -1.5, -0.0490000000000013)), .Names =
c("DESCRIPTION",
"POSITION", "prix"), row.names = c(NA, -17L), class = "data.frame")
I want to remove all the dates in $DESCRIPTION. I was thinking using
something like this:
>df3$DESCRIPTION<- gsub("here is a regex expression","",df3$DESCRIPTION).
Can't write the pattern argument in regex.
Any help would be appreciated.
TY
***************************
Arnaud Gaboury
Mobile: +41 79 392 79 56
BBM: 255B488F
More information about the R-help
mailing list