[R] A Few Questions

Uwe Ligges ligges at amadeus.statistik.uni-dortmund.de
Thu Mar 21 22:14:00 CET 2002

Rishabh Gupta wrote:
> Hi All R Users,
>     I have a few questions, I'm sure that for most you they will be simple.
> 1.    I am trying to write an object to a file. The dimensions of the object
> have name (by using dimnames(x) = ....). The problem is when I save that
> data to a file, the dimension name are not written, just the value. This is
> not very usefull since I am sorting the object first and if the dimension
> names are not printed, I can not see the result of the sort operation. What
> I would like is something like
>     "Variables Name1"    Variable_Value1
>     "Variables Name2"    Variable_Value2
>     "Variables Name3"    Variable_Value3

Have a look at ?write.table.

> 2.    How can I perform a reverse sort? By default, the sort function sorts
> in ascending order, there appears to be no option to sort in descending
> order.

Right. But you can use rev() as in:

> 3.    This is more of a stats question rather than an R question. I want to
> analyse the relationship between two different variables. Basically I would
> like a function that will measure the dependency or non-dependency between
> two variables. I am not sure but I think the lm() function is approriate. If
> I am able to do summary(lm(x~y)) and measure the f value or t value. Will
> that give me some kind of dependency measurement between the two variables.

Well, if the dependency can be assumed to be *linear*.

> Essentially, i want to measure the deviation for a best-fit line between the
> two variables.

So you want to look at the residuals?

Uwe Ligges
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list