Skip to content

easy question

2 messages · De Amicis Fabrizio (G.I.T.), Ko-Kang Kevin Wang

#
Dear R.List,
I am starting to use R. I have an easy question. In a dataset of 15
variables, I am not able run correctly the index i of the do loop. 
Do you have any suggestion? 

NC <- function(x)

    for (i in 1:15) {  
    print(dim(table(dt[,"Vi"])))
    
}


Thank you in advance,
Fabrizio


---------------------------------------------------------------
Fabrizio De Amicis

IT Department
Generali Information Technologies - (GIT)

Centro Galleria 2,
Via Cantonale
CH - 6928 Manno - Switzerland
Tel  +41 91 806 6220
Fax +41 91 806 6298
E-mail: fabrizio.deamicis at git.generali.ch  




************************************************************************
The information in this email is confidential and may be legally... {{dropped}}
#
Hi,
On Tue, 29 Apr 2003, De Amicis Fabrizio (G.I.T.) wrote:

            
Why do you have "Vi" with quotes?  Your counter i isn't used anywhere in 
the loop.  I am assuming your dataset of 15 variables is a data frame or 
matrix?  Then you'll need dt[, i] instead.  It will read the $i^{th}$ 
column each time it runs through the loop.

On a side note.  The above function isn't right.  The NC function will 
need a variable x, which isn't used anywhere in the function.  You don't 
need to put the for() loop into the function at all.  (I'm assuming you 
have got a data frame or matrix called dt).