I have a data frame that contains about 100 factorial variables that I would like to change into numeric type. How can I do it to the whole data frame?
I know that I can do it per each variable by using this code for example: dat$.Var2<-as.numeric(dat$.Var2)
but I would like to do it for a lot of variables.
Here is an example data frame.
   dat <- read.table(text = " TargetVar  Tar_Var1    Var2       Var3
     0        0        0         7
     0        0        1         1
     0        1        0         3
     0        1        1         7
     1        0        0         5
     1        0        1         1
     1        1        0         0
     1        1        1         6
     0        0        0         8
     0        0        1         5
     1        1        1         4
     0        0        1         2
     1        0        0         9
     1        1        1         2  ", header = TRUE)
 
     
    