I think this will do it.
mysub <- function(x) {sub(",",".",x)}
mydata <- (apply(kk, 2, mysub ))
kk1 <- data.frame(apply(mydata, 2, as.numeric))
--- Tom Cohen <[EMAIL PROTECTED]> wrote:
> Dear list,
>
> I have imported a spss data file in R, where a
> comma is used to separate the decima
Tom Cohen wrote:
> Dear list,
>
> I have imported a spss data file in R, where a comma is used to separate
> the decimal numbers, e.g. 3,567 instead of 3.567 as in R. How can I replace
> the comma with a dot for all values in the data frame
>
How did you read the data in the first place
apply(apply(df, 2, gsub, patt=",", replace="."), 2, as.numeric)
or you can read the data file with read.table using dec argument:
df <- read.table('clipboard', dec=",", header=T, row.names=1)
On 23/01/2008, Tom Cohen <[EMAIL PROTECTED]> wrote:
> Dear list,
>
> I have imported a spss data fi
3 matches
Mail list logo