Skip to content
Back to formatted view

Raw Message

Message-ID: <1203910306.5981284.1497615873090@mail.yahoo.com>
Date: 2017-06-16T12:24:33Z
From: Andras Farkas
Subject: "reverse" quantile function
In-Reply-To: <853049125.11118109.1497605629803@mail.yahoo.com>

Never mind, I think i figured:

z<-df

apply(df,1,function(x) approx(sort(x[1:4]), seq(0,1,,length(x[1:4])), x[5])$y) 
thanks again for the help
 
Andras Farkas, 


On Friday, June 16, 2017 5:34 AM, Andras Farkas via R-help <r-help at r-project.org> wrote:




Peter, 

thanks, very nice, this will work for me... could you also help with setting up the code to run the on liner "approx(sort(x), seq(0,1,,length(x)), q)$y" on the rows of a data frame using my example above? So if I cbind z and res, 

df<-cbind(z,res) 

the "x" in your one liner would be the first 4 column values of each row and "q" is the last (5fth) column value of each row.. 

thanks again for all the help, 

Andras Farkas

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.