Off topic:writing a loop and the integrate function
0
0
Entering edit mode
5.9 years ago

I would like to calculate integral from two columns in my data frame the integral is based on a function; 1/x, I quess I need to write a loop . Can you help with writing a loop and the integrate function?

This is the sample data frame;

upper_concentration<-c(1:200, 1)
lower_concentration<-upper_concentration*0.9
df = data.frame(upper_concentration,lower_concentration)

 for (i in 1:(length(df))){
 integral <- function (x) {1/df$upper_concentration}
 result <- integrate(integral, lower = df$upper_concentration, upper =upper_concentration*0.9)
loop integral dataframe • 634 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2710 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6