different formats for output files
////////////////////////////////

different formats for output files

Type               Extensions	R functions
-----------     ------------     ------------------
Text file          CSV           write.csv()
                                 write.table()
                                 write.delim()

Text file          txt           write.csv()
                                 write.table()
                                 write.delim()
                                 write()
                                 scan()
                                 sink()

Binary files  	  RData          save(),save.image()
          	  rds	         saveRDS()
	          xls, xlsx	 See Chapter 12: R and Excel

////////////////////////////////

read.table('clipboard')
///////////////////////////////
  Step 1: we highlight a data set
        from Notepad, Excel, Word, etc. 

  Step 2: issue the following line
         x<-read.table('clipboard')

  Example
1 2 3
3 4 5
5 6 6

/////////////////////////////////

help(read.table)
///////////////////////////////
 To find more about the read.table function, we issue the 
    following code

   help(read.table)

/////////////////////////////////

relationship between fv_annuity and fv_f
///////////////////////////////////////////
  To calculate the future value for a given present value, 
      we have the following formula

      fv_f= pv*(1+r)^i                   (1)

           Note that i is used instead of n to avoid confusion. 

 To calculate the futur value of an annuity (n periods), we 
      have the following formula
                   c
     fv_annuity = ---*( (1+R)^n -1 )      (2)
                   R

To calculate the future value of an annuity:
     Method I: apply Equation (2)             

     Method I: apply Equation (1)  n times, then summarize those
               n future values. 

///////////////////////////////////////////

Definition of annuity due, perpetuity due 
///////////////////////////////////////////
 When discussing perpetuity and annuity above, 
      we assume that each cash flow happens at 
      the end  of each  period. 
 However, for perpetuity due or annuity due
      those cash flows happen at the beginning of each
      period, show below. 

Normal perpetuity 
                  c       c     --> c
         |--------|-------|-------
         0        1       2      -> infinity 

perpetuity due
         c        c       c     --> c
         |--------|-------|-------
         0        1       2      -> infinity 

Normal annuity 
                  c       c        c
         |--------|-------|---=... |
         0        1       2        n

annuity due
         c         c       c       
         |--------|-------|---=... |
         0        1       2       n-1

///////////////////////////////////////////