Monday, November 11, 2019

integration - What does '$' do in R?





I have been trying to understand integration in R and I have come across a code that looks like this:



Lambda=function(t) integrate(f=lambda,lower=0,upper=t)$value



What does $value mean here? What's the '$' sign doing? It's not explained anywhere in the help or on the internet. Please help.


Answer



From ?integrate (bold is mine).




Value:



A list of class ‘"integrate"’ with components




value: the final estimate of the integral.



abs.error: estimate of the modulus of the absolute error.



subdivisions: the number of subintervals produced in the subdivision
process.



message: ‘"OK"’ or a character string giving the error message.



call: the matched call.





In other words, integrate returns an object of class "integrate", of which element value contains the estimate of the integral.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...