[R] help in building a function

Zhen Pang nusbj at hotmail.com
Sat Sep 11 16:10:50 CEST 2004

>From: assuncao.senra at portugalmail.com
>To: R help <r-help at stat.math.ethz.ch>
>Subject: [R] help in building a function
>Date: Sat, 11 Sep 2004 14:22:13 +0100
>i'm new in writting functions in R. I read the R-help manuals but still
>couldn't get it right.
>The problem is:
>I have data on 16 categorical variables for 335 individuals. the data are
>lines for individuals and columns for variables.
>I want to calculate the correlation between two variables using a formula
>given by Agresti for ordinal categorical variables.
>I have to calcule the value for each pair of variables and save the result 
>a vector...
>I wrote the following code
>for (i in 1:15){
>for (j in i+1:16){

note i+1:16 stands for i+(1:16)


t is useless here, also you did not use t at other place

>The correlation is r.I have a result, but there is a warning regarding r5
>about sintax.
>Plus, it doesn´t perform the loops and I don't know how to save the results 
>a vector.
>thanks for any help
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide! 

More information about the R-help mailing list