Re: [R] Replace a variable by its value

2012-05-21 Thread anindya55
Sorry, wasn't clear .. .Rui's code as worked -- View this message in context: http://r.789695.n4.nabble.com/Replace-a-variable-by-its-value-tp4630734p4630748.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] Replace a variable by its value

2012-05-21 Thread Petr PIKAL
Hi > > 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

Re: [R] Replace a variable by its value

2012-05-21 Thread Rui Barradas
Hello, Your doubt is a frequent one. 'col_name' is a character vector, it's elements are character strings, not symbols. These are all equivalent, and are what you want. raw_data[[ col_name[i] ]] # using a list-like syntax (data.frame subclasses list) raw_data[ , col_name[i] ] # seems more like

[R] Replace a variable by its value

2012-05-21 Thread anindya55
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 i

Re: [R] Replace a variable by its value

2012-05-21 Thread anindya55
Thanks Rui...I need chisqtest inside loop , I've given only example code here. -- View this message in context: http://r.789695.n4.nabble.com/Replace-a-variable-by-its-value-tp4630734p4630737.html Sent from the R help mailing list archive at Nabble.com. __