Here you go :)

require(stringr)
t(
apply(mydf, 1, function(x) {str_replace(x, "\\?", "-)")})
)





----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Sun, Apr 25, 2010 at 9:21 PM, Felipe Carrillo
<mazatlanmex...@yahoo.com>wrote:

> Hi:
> I have the following dataset in R( thanks Gabor for your help) but now
> the problem is that all the dashes are converted to questions marks ("?")
> I am trying to get the dashes back using:
>
> mydf <- data.frame(lapply(mydf,function(x) replace(mydf,"?"(x),"-")))
>
> but isn't working. I also tried:
>
> mydf <- replace(mydf,mydf=="?","-)")
>
> Thanks for any suggestions.
>
>
>
> mydf <-structure(list(IDDate = c("2/26/2010", "2/27/2010", "2/28/2010",
> "3/1/2010", "3/2/2010", "3/3/2010", "3/4/2010", "3/5/2010", "3/6/2010",
> "3/7/2010", "3/8/2010", "3/9/2010", "3/10/2010", "3/11/2010",
> "Biweekly Lower 90% Confidence Interval", "Biweekly Total", "Biweekly Upper
> 90% Confidence Interval",
> "Brood-year  Lower 90% Confidence Interval", "Brood Year Total",
> "Brood-year Upper 90% Confidence Interval"), First = c("0 ( ? )",
> "n (0 ? 0)", "357 (123 ? 123)", "144 (95 ? 152)", "73 (126 ? 152)",
> "43 (108 ? 108)", "n (0 ? 0)", "270 (101 ? 140)", "121 (111 ? 112)",
> "0 ( ? )", "34 (111 ? 111)", "102 (111 ? 140)", "0 ( ? )", "35 (125 ?
> 125)",
> "-537", "1425", "3388", "2578499", "4455877", "6333255"), Second = c("0 ( ?
> )",
> "n (0 ? 0)", "0 ( ? )", "99 (65 ? 71)", "0 ( ? )", "86 (66 ? 76)",
> "n (0 ? 0)", "0 ( ? )", "40 (66 ? 66)", "0 ( ? )", "33 (74 ? 74)",
> "0 ( ? )", "35 (66 ? 66)", "35 (70 ? 70)", "-549", "402", "1353",
> "74306", "314206", "541552"), Third = c("7,002 (33 ? 39)",
> "n (0 ? 0)", "130,342 (29 ? 57)", "22,741 (31 ? 56)", "8,365 (31 ? 53)",
> "5,962 (33 ? 60)", "n (0 ? 0)", "22,461 (30 ? 61)", "12,485 (31 ? 55)",
> "7,352 (31 ? 56)", "2,908 (32 ? 48)", "3,265 (27 ? 48)", "1,993 (30 ? 55)",
> "1,445 (33 ? 62)", "35097", "296085", "557074", "2249920", "7347719",
> "12058021"), Fourth = c("0 ( ? )", "n ( ? )", "0 ( ? )",
> "0 ( ? )", "0 ( ? )", "34 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )",
> "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "-250",
> "40", "330", "98786", "225913", "353040"), Fifth = c("0 ( ? )",
> "n (0 ? 0)", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "n (0 ? 0)",
> "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )",
> "0 ( ? )", "0", "0", "0", "-184", "977", "2138")), .Names = c("IDDate",
> "First", "Second", "Third", "Fourth", "Fifth"), class = "data.frame",
> row.names = c(NA,
> -20L))
> mydf
>
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
>
>
>
>
> ______________________________________________
> 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.
>

        [[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.

Reply via email to