Skip to content
Prev 310332 / 398506 Next

Beginner help about output in R

That is the approach I was going to suggest.  Put your x values into a vector, x, and then something like this.

I just made up some functions for computing 2 values, then create an x vector of ten values, then a function for computing and writing the values (trying to follow the OP's original request as closely as possible)

# makeup some functions
value1 <- function (z) 1/(1+exp(z))
value2 <- function (z) 1/z^.5

# create some data values
x <- runif(10)

# define write function
myWrite <- function(y,file) write.table(data.frame(value1=value1(y),value2=value2(y)),file)

# call the function t calculate and write out the values 
myWrite(x,"c:/tmp/test.txt")


Hope this is helpful,

Dan

Daniel Nordlund
Olympia, WA 98504-5204