I want to do the following:
#choosing one column called "z" from select
select<-read.table(file='dane.txt', header=TRUE)
n=select$z
#defining f function
f<-function(redshift) {
0.2*(sqrt(0.3*((1+redshift)^3)+0.7*((1+redshift)^2)+1))^(-1)
}
# for all values from column "z" I want to calculate the integral from 0 up to value from column "z"
for(i in n){
int[i]<-integrate(f(i),0,i)
}
For all values from column "z" I want to calculate the integral from 0 up to value from column "z" and I want to save my results for each row from file, under the name int. Why it did't work? Right now it gives me the error: "Error in match.fun(f) : 'f(i)' is not a function, character or symbol" . Please, help.