search for: popcode

Displaying 2 results from an estimated 2 matches for "popcode".

Did you mean: opcode
2009 Apr 10
4
split a character variable into several character variable by a character
...lp-owner" is not the place for help, but: r-help at r-project.org (CC-ed here) In any case, strsplit() does the job, i.e.: > unlist(strsplit("BCPy01-01", "-")) [1] "BCPy01" "01" You can work with the whole variable, like: splitpop <- strsplit(df1$popcode, "-") then access the first part with > unlist(lapply(splitpop, "[", 1)) [1] "BCPy01" "BCPy01" "BCPy01" "BCPy01" "BCPy01" "BCPy01" "BCPy01" "BCPy01" [9] "BCPy01" "BCPy01" a...
2009 Apr 09
2
failed when merging two dataframes, why
Hi, R-listers, Failed, when I tried to merge df1 and df2 by "codetot" in df1 and "codetoto" in df2. I want to know the reason and how to merge them together. Data frames and codes I have used were listed as followed. Thanks a lot in advance. df1: popcode codetot p3need BCPy01-01 BCPy01-01-1 100.0000 BCPy01-01 BCPy01-01-2 100.0000 BCPy01-01 BCPy01-01-3 100.0000 BCPy01-02 BCPy01-02-1 92.5926 BCPy01-02 BCPy01-02-1 100.0000 BCPy01-02 BCPy01-02-2 92.5926 BCPy01-02 BCPy01-02-2 100.0000 BCPy01-02 BCPy01-02-3 92.5926 BCPy01-02 BCPy01-02-3 100.0000...