there is a file which contain such lines:

test <-function(x,f){
   n<- length(x);
   sum(f*(x[1:(n-1)]+x[2:n])/2)/sum(f) -> result;
   return(result);
   }

i can read it into terminal , cat test.R
how can i do it in R?

> readLines("c:/test.R",n=-1)
[1] "test <-function(x,f){"                             "   n<- length(x);"                                
[3] "   sum(f*(x[1:(n-1)]+x[2:n])/2)/sum(f) -> result;" "   return(result);"                               
[5] "   }"                                             
>  paste(readLines("c:/test.R",n=-1),collapse="")
[1] "test <-function(x,f){   n<- length(x);   sum(f*(x[1:(n-1)]+x[2:n])/2)/sum(f) -> result;   return(result);   }"
> 

is there better way to do ?can i get better format ?
	[[alternative HTML version deleted]]

