[R] Replace a variable by its value

anindya55 anindya55 at gmail.com
Mon May 21 13:24:18 CEST 2012


I have a dataset called "raw-data" . I am trying to use the following code -


col_name<-names(raw_data)
for (i in 1:(length(names(raw_data))-2))
{
  tbl=table(raw_data$Pay.Late.Dummy, raw_data$col_name[i])
  
  chisqtest<-chisq.test(tbl)
}


Say the 1st column of my raw_data is Column1. The idea is when i=1 then
raw_data$col_name[i] will automatically become raw_data$Column1 , which is
not happening. Kindly help?

--
View this message in context: http://r.789695.n4.nabble.com/Replace-a-variable-by-its-value-tp4630734.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list