RcppExample           package:RcppTemplate           R Documentation

_R_c_p_p _R/_C++ _i_n_t_e_r_f_a_c_e _e_x_a_m_p_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     'RcppExample' illustrates how the 'Rcpp' R/C++ interface class
     library is used.

_U_s_a_g_e:

     RcppExample(params, nlist, vec, mat)

_A_r_g_u_m_e_n_t_s:

  params: A parameter list specifying 'method' (string), 'tolerance'
          (double), 'maxIter' (int)

   nlist: a list of named numeric values (double or int)

     vec: a numeric 1D vector (double or int)

     mat: a numeric 2D matrix (double or int)

_D_e_t_a_i_l_s:

     See the document 'Rcpp: R/C++ Interface Classes: Using C++
     Libraries from R' for more information. The source files for this
     example can be found in the  'doc' package subdirectory.

_V_a_l_u_e:

     'RcppExample' returns a list containing: 

nlFirstName: first name in nlist

nlFirstValue: first value in nlist

    matD: R matrix from an RcppMatrix<double> object

  stlvec: R vector from a vector<double> object

  stlmat: R matrix from a vector<vector<double> > object

       a: R matrix from C/C++ matrix

       v: R vector from C/C++ vector

settleDays: An integer-valued parameter

   price: A real-valued parameter

riskFreeRate: A real-valued parameter

dividendYield: A real-valued parameter

  params: The input parameter list

_A_u_t_h_o_r(_s):

     Dominick Samperi

_E_x_a_m_p_l_e_s:

     # We omit the Date parameters here since this requires QuantLib (see docs)
     params <- list(optType='call',
     #              tradeDate=c(5,15,1998),
     #              exerciseDate=c(5,17,1999),
                    settleDays=2,
                    strikePrice=8,
                    price= 7,
                    volatility=0.10,
                    riskFreeRate=0.05,
                    dividendYield=0.05)

     nlist <- list(ibm = 80.50, hp = 53.64, c = 45.41)

     vec <- seq(1,5)

     mat <- matrix(seq(1,20),4,5)

     result <- RcppExample(params, nlist, vec, mat)

     result

