[R] Line similarity

Bert Gunter gunter.berton at gene.com
Tue Apr 30 22:50:20 CEST 2013


1. Read "an Introduction to R" or other R tutorial to learn how R works.

2. You apparently wish to apply a function, f, to each row of a data
frame or matrix to classify it as growing, declining, etc. Only you
know what that function should look like. Write it.

3. Apply it using ?apply or perhaps the functionality of the plyR
package. There could be other ways to do it depending on what data
structure you use for your data. That is why you need to do some self
study.

?bert





On Tue, Apr 30, 2013 at 12:57 PM, Satsangi, Vivek (GE Capital)
<Vivek.Satsangi at ge.com> wrote:
> Folks,
>
>                 This is probably a "help me google this properly, please"-type of question.
>
>                 In TIBCO Spotfire, there is a procedure called "line similarity". I use this to determine which observations show a growing, stable or declining pattern... sort of like a mini-regression on the time-line for each observation.
>
>                 So of the input is something like this:
>
> Name Year_1_value Year_2_value Year_3_value
> A 1 2 3
> B 2 7 19
> C 3 4 2
> D 10 7 6
> E 4 4 5
> F NA 3 6
>
> Then the desired output is as follows:
> A Growing
> B Growing
> C Stable
> D Declining
> E Stable
> F Growing (or NA is also fine)
>
>                 The data can also be unstacked, i.e. the three years could be separate rows if necessary.
>                 Is there a package for R that implements something like the above? I can obviously try do a set of simple regressions to classify the rows, but I want to gain from the thoughts and learnings of others who may have taken the time to implement a package.
>                 I tried searching with the words "line similarity" or its variants to no avail.
>
>                 Thanks in advance for your pointers!
>
> Vivek Satsangi
> GE Capital
> Americas
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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
> 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



More information about the R-help mailing list