An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110921/3aa316c2/attachment.pl>
help to change charactwer name in a row of data.frame
4 messages · gianni lavaredo, Piero Campalani, Ndjido Ardo BAR +1 more
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110921/143ff6f8/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110921/587b74dc/attachment.pl>
On 09/21/2011 03:05 PM, Ndjido Ardo BAR wrote:
Dear Gianni,
you can also convert your x-column to be a character and then assign any
value to the line you will, just as follows
df <- data.frame(x=c("a","b","c"),y=c(1,2,3))
df$x<-as.character(df$x)
df[which(df$x=="b"),'x']<-"b%" # notice the whith() statement can be
replace by any number of line, as you may know
The which statement is superfluous, the vector (df$x == "b") is sufficient. cheers, Paul
df x y 1 a 1 2 b% 2 3 c 3 Cheers, Ardo. On Wed, Sep 21, 2011 at 4:18 PM, gianni lavaredo <gianni.lavaredo at gmail.com>wrote:
Dear Reaserchers,
sorry for desturb you, but i tryed several solution but without results. I
have a data.frame (it's an example to explain)
df <- data.frame(x=c("a","b","c"),y=c(1,2,3))
df
x y 1 a 1 2 b 2 3 c 3 and i wish to change same paramters in the column "x" as the following result
df
x y
1 a 1
2 b% 2
3 c 3
thanks in advance. Normally to result easy stuff we spent a afternoon when
you need to send the result in the night
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
[[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
Paul Hiemstra, Ph.D. Global Climate Division Royal Netherlands Meteorological Institute (KNMI) Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39 P.O. Box 201 | 3730 AE | De Bilt tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770