Hi Robert,
             That worked perfectly. Thanks a lot.
-Arnav

On 5/10/06, Robert Citek <[EMAIL PROTECTED]> wrote:
>
>
> Hello Arnav,
>
> On May 10, 2006, at 3:56 PM, Arnav Ghosh wrote:
> > The code is as follows:
> > n=1000
> > x=rgamma(n,1.5,2)
> > y=vector("numeric",n)
> > for (i in 1:n){
> > y[i]=(2937/50000*exp(-1/1000*x[i])/x[i])
> > }
> > now I want to know how I can use "write"/"write.data" or anything
> > similar to
> > write the output from x[i] and y[i] to two different colums
> > simultaneously
> > in an output file (say "output.txt").
>
> One way would be to create a data frame.  I tend to think of
> data.frames like sheets in a spreadsheet or tables in a database.
> Once you have your data in a data.frame, then you could write to/read
> from a file.  For example, within R:
>
> # create the data.frame
> myDataFrame <- data.frame(x,y)
> # write it to a file
> write.table(myDataFrame, file = "output.txt")
> # read it from a file into a new data.frame
> newDataFrame <- read.table("output.txt")
>
> BTW, one new resource I discovered was the wiki.  The page you may be
> interested in:
>
> http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:import_table
>
> Regards,
> - Robert
> http://www.cwelug.org/downloads
> Help others get OpenSource software.  Distribute FLOSS
> for Windows, Linux, *BSD, and MacOS X with BitTorrent
>
>

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to