user3196162
user3196162

Reputation: 33

Returning result in R

I have a 1 X 1000 vector = x of numbers from 1 to 1000, and a certain function = y into which I plug in these numbers, resulting in a 1 x 1000 vector of results. I would like for R to return the value of y at which the function is greater than a certain number. How can this be done?

Upvotes: 0

Views: 154

Answers (2)

IRTFM
IRTFM

Reputation: 263301

 res[ which(res > threshold)[1] ] #........

Upvotes: 2

JeremyS
JeremyS

Reputation: 3525

If you call the result from function y res

res_over_certain_number <- res[res > certain_number] 

Upvotes: 1

Related Questions