How can I store in a vector the result of a function in R. For instance. The function measures(out, 0.999)
give me the following result:
p quantile sfall
[1,] 0.99 2.826164 3.758789.
I want to store the value of 2.8261
, How can I do it?
@akrun is right, but I'd rather use a call to the name of the column. Moreover, if you want the result to be stored only up to the 4th decimal, you can wrap the result into a round
function, like the following code does:
stored_quantile <- round(measures(out, 0.999)$quantile,4)
EDIT : the reason for preferring my solution is that if the function measures
would produce a different output order between the columns you would always be sure to get the value you are interested in (ie: quantile
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.