tsSample-class         package:TargetSearch         R Documentation

_C_l_a_s_s _f_o_r _r_e_p_r_e_s_e_n_t_i_n_g _s_a_m_p_l_e_s

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

     This is a class to represent a set of samples.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects can be created by the function 'ImportSamples' or by
     calling the object generator function.

     ' new("tsSample", Names = [sample names], CDFfiles = [list of CDF
     file names], RIfiles = [list of RI file names], CDFpath = [CDF
     files path], RIpath = [RI files path], days = [measurement days],
     data = [additional sample information])'

_S_l_o_t_s:


     '_N_a_m_e_s': '"character"', the sample names.

     '_C_D_F_f_i_l_e_s': '"character"', the list of CDF file names. 

     '_R_I_f_i_l_e_s': '"character"', the list of RI file names. 

     '_C_D_F_p_a_t_h': '"character"', CDF files path. 

     '_R_I_p_a_t_h': '"character"', RI file path. 

     '_d_a_y_s': '"character"', measurement days.

     '_d_a_t_a': '"data.frame"', additional sample information.

_M_e_t_h_o_d_s:


     '[' 'signature(x = "tsSample")': Selects a subset of samples.

     '$_n_a_m_e' 'signature(x = "tsSample")': Access column 'name' of
          'sampleData' slot.

     '_C_D_F_f_i_l_e_s' 'signature(obj = "tsSample")': list of CDF files. 

     '_R_I_f_i_l_e_s' 'signature(obj = "tsSample")': list of RI files. 

     '_R_I_p_a_t_h' 'signature(obj = "tsSample")': The RI file path. 

     '_C_D_F_p_a_t_h' 'signature(obj = "tsSample")': The CDF file path. 

     '_l_e_n_g_t_h' 'signature(x = "tsSample")': number of samples.

     '_s_a_m_p_l_e_D_a_t_a' 'signature(obj = "tsSample")': additiona sample
          information. 

     '_s_a_m_p_l_e_D_a_y_s' 'signature(obj = "tsSample")': measurement days. 

     '_s_a_m_p_l_e_N_a_m_e_s' 'signature(obj = "tsSample")': sample names.

     '_s_h_o_w' 'signature(object = "tsSample")': the show funtion. 

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

     Alvaro Cuadros-Inostroza, Matthew Hannah, Henning Redestig

_S_e_e _A_l_s_o:

     'ImportSamples'

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

     showClass("tsSample")

     # get a list of CDF files from a directory
     require(TargetSearchData)
     CDFpath <- system.file("gc-ms-data", package = "TargetSearchData")
     cdffiles <- dir(CDFpath, "cdf")

     # define the RI files and the RI path
     RIfiles <- sub("cdf$", "txt", paste("RI_", cdffiles, sep = ""))
     RIpath  <- "."

     # get the measurement days (the four first numbers of the cdf files, in this
     # example)
     days <- substring(cdffiles, 1, 4)

     # sample names 
     smp_names <- sub("\.cdf", "", cdffiles)

     # add some sample info
     smp_data <- data.frame(CDF_FILE =cdffiles, GROUP = gl(5,3))

     # create the sample object
     sampleDescription <- new("tsSample", Names = smp_names, CDFfiles = cdffiles, CDFpath = CDFpath,
         RIpath = RIpath, days = days, RIfiles = RIfiles, data = smp_data)

     # changing the sample names
     sampleNames(sampleDescription) <- paste("Sample", 1:length(sampleDescription), sep = "_")

     # changing the file paths (relative to the working path)
     CDFpath(sampleDescription) <- "my_cdfs/"
     RIpath(sampleDescription)  <- "my_RIs/"

