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
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
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
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
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.
__
5 matches
Mail list logo