Try this:

riskFactors <- c("A", "B", "C")
table(file[[riskFactor[1]]])

in a loop

for (i in riskFactor) table(file[[riskFactor[i]]])

On Mon, Jun 9, 2008 at 10:44 AM, EVANS David-William <
david-william.evans@sncf.fr> wrote:

> Hello all,
>
>
>
> After some months doing ok with R, I am embarrassed that I have to make
> this my first posting to the help list.  I am trying to run the
> following (actually in a loop but shortened for the post):
>
>
>
> risk.factors  <-  c("file$A", "file$B", "file$C", "file$D", "file$E")
>
>    table(paste(risk.factors[1]))
>
>
>
> but run into problems with the table (paste...) line as I get the
> following output:
>
>
>
> > table(paste(risk.factors[1]))
>
>
>
> file$A
>
>             1
>
>
>
> I think it's a problem with paste including " " around the file name but
> cannot get around it.  Apologies for the simple nature of this question
> and thanks to anyone who can take a moment to help.
>
>
>
> David.
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

