Quantcast

Returning the coef from two coordinates

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Returning the coef from two coordinates

Hans Thompson
Thank you to everyone in this forum that has been helping me with the basic R skills while I learn to apply them.  

I would like to take the coefficient of two coordinates.  One of them comes from two different columns in a table:


>A
     x   y  
a  1   3
b  2   2
c  3   1

the other is set and for this question I'll just call it (1,1)

I've been trying to find a way to return the coefficient values for a,b, and c through (1,1).

 Also, it looks like my questions are very basic compared to the others being asked on this forum so please let me know if I am out of place.  :)

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Returning the coef from two coordinates

Rui Barradas
Hello,

Hans Thompson wrote
Thank you to everyone in this forum that has been helping me with the basic R skills while I learn to apply them.  

I would like to take the coefficient of two coordinates.  One of them comes from two different columns in a table:


>A
     x   y  
a  1   3
b  2   2
c  3   1

the other is set and for this question I'll just call it (1,1)

I've been trying to find a way to return the coefficient values for a,b, and c through (1,1).

 Also, it looks like my questions are very basic compared to the others being asked on this forum so please let me know if I am out of place.  :)
Sorry, but I'm not understanding what (1, 1) is. Are those the matrix A coordinates, (row, col)?
If so, use an index matrix, with two columns. Here is an example.

elm1 <- c(1, 1)
elm2 <- c(2, 1)
inx <- matrix(c(elm1, elm2), ncol=2, byrow=TRUE)
colnames(inx) <- c("Row", "Col")
inx

A[inx]

Hope this helps,

Rui Barradas
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Returning the coef from two coordinates

Hans Thompson
I meant (1,1) as an (x,y) coordinate.  I am trying to find the function to return the coefficient of the line running through:

>B
    x  y
a  1  1

and all the points in:

>A
     x   y  
a  1   3
b  2   2
c  3   1

hope that is more clear.  Thanks again Rui.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Returning the coef from two coordinates

Bert Gunter
In reply to this post by Hans Thompson
Have you read "An Introduction to R" or other basic R tutorial? I
don't completely understand what you're asking (I was unable to
decipher"coefficients of two coordinates") , but it seems shockingly
basic. Before posting to this list, you should at least make some
effort to learn basic skills on your own.

... and when you do post, please follow the posting guide and frame
your questions more clearly (although maybe it's just me here...).

-- Bert

On Fri, Apr 27, 2012 at 12:04 PM, Hans Thompson
<[hidden email]> wrote:

> Thank you to everyone in this forum that has been helping me with the basic R
> skills while I learn to apply them.
>
> I would like to take the coefficient of two coordinates.  One of them comes
> from two different columns in a table:
>
>
>>A
>     x   y
> a  1   3
> b  2   2
> c  3   1
>
> the other is set and for this question I'll just call it (1,1)
>
> I've been trying to find a way to return the coefficient values for a,b, and
> c through (1,1).
>
>  Also, it looks like my questions are very basic compared to the others
> being asked on this forum so please let me know if I am out of place.  :)
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Returning-the-coef-from-two-coordinates-tp4593504p4593504.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Returning the coef from two coordinates

Sarah Goslee
In reply to this post by Hans Thompson
You mean like a linear regression?
?lm

You might benefit from reading at the very least An Introduction to R
and the posting guide to this list.

Sarah


On Fri, Apr 27, 2012 at 5:08 PM, Hans Thompson <[hidden email]> wrote:

> I meant (1,1) as an (x,y) coordinate.  I am trying to find the function to
> return the coefficient of the line running through:
>
>>B
>    x  y
> a  1  1
>
> and all the points in:
>
>>A
>     x   y
> a  1   3
> b  2   2
> c  3   1
>
> hope that is more clear.  Thanks again Rui.
>
--
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Returning the coef from two coordinates

Hans Thompson
Where can I find the posting guide?  I've been trying to use "A handbook of Statistical Analyses Using R" and google searching but I will be reading "An Introduction to R" now that I see its better to starting out then using the "?function".  sorry.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Returning the coef from two coordinates

David Winsemius
In reply to this post by Hans Thompson

On Apr 27, 2012, at 3:04 PM, Hans Thompson wrote:

> Thank you to everyone in this forum that has been helping me with  
> the basic R
> skills while I learn to apply them.
>
> I would like to take the coefficient of two coordinates.


The coefficient .... of what?

>  One of them comes

Them?

> from two different columns in a table:
>
>
>> A
>     x   y
> a  1   3
> b  2   2
> c  3   1
>
> the other is set and for this question I'll just call it (1,1)

The other .... what?

>
> I've been trying to find a way to return the coefficient values for  
> a,b, and
> c through (1,1).
>
> Also, it looks like my questions are very basic compared to the others
> being asked on this forum so please let me know if I am out of  
> place.  :)

You are perhaps out of place if you are expecting us to read your  
mind. (I have often wondered whether a ban on the indefinite pronoun  
would be a good rule for rhelp.)

--

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Returning the coef from two coordinates

Michael Weylandt
In reply to this post by Hans Thompson
There's a link to it at the end of every R-Help posting.

Michael

On Apr 27, 2012, at 5:47 PM, Hans Thompson <[hidden email]> wrote:

> Where can I find the posting guide?  I've been trying to use "A handbook of
> Statistical Analyses Using R" and google searching but I will be reading "An
> Introduction to R" now that I see its better to starting out then using the
> "?function".  sorry.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Returning-the-coef-from-two-coordinates-tp4593504p4593801.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Returning the coef from two coordinates

Petr Savicky
In reply to this post by Hans Thompson
On Fri, Apr 27, 2012 at 02:08:09PM -0700, Hans Thompson wrote:

> I meant (1,1) as an (x,y) coordinate.  I am trying to find the function to
> return the coefficient of the line running through:
>
> >B
>     x  y
> a  1  1
>
> and all the points in:
>
> >A
>      x   y  
> a  1   3
> b  2   2
> c  3   1

Hi.

If you want three coefficients, one for each point in A, then try

  C <- sweep(A, 2, B)
  C[, 2]/C[, 1]

  [1] Inf   1   0

Petr Savicky.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...