This function prepares the data to compute correlation by introducing NA's when lags are needed
prep.data(data, lags, timepoints)
data | a matrix or data frame with rows representing genes and columns
representing different timepoints. If data is a data frame, the gene names
can be specified using the |
---|---|
lags | a vector of same length as the number of rows in the data column indicating the best lags |
timepoints | a vector of time points used in the dataset |
a list of two matrices, one matrix with NA's for the lags for the dataset and another matrix with the timepoints used for each row in the dataset
#> $data #> [,1] [,2] [,3] [,4] #> [1,] -0.5514917 1.8034834 1.1004919 -0.9754230 #> [2,] -0.8657535 -0.1050687 -0.1738201 -0.3385765 #> [3,] -0.3438315 0.9824534 0.1788120 1.1523471 #> [4,] -1.7133026 -0.6984294 0.4051012 NA #> [5,] NA 0.8130582 -0.8320195 -0.9604492 #> #> $time #> [,1] [,2] [,3] [,4] #> [1,] 0 5 15 30 #> [2,] 0 5 15 30 #> [3,] 0 5 15 30 #> [4,] 5 15 30 NA #> [5,] NA 0 5 15 #>prep.data(array(runif(100, 0, 10), c(10, 10)), sample((-2:2), size = 10, replace = TRUE), timepoints = c(0, 5, 15, 30, 45, 60, 75, 80, 100, 120))#> $data #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] #> [1,] 2.467509 2.404612 4.194859 8.4554005 2.6969463 3.1611551 8.1423137 #> [2,] 1.432664 3.979936 6.388837 4.9555987 3.4585360 4.8828865 9.2452039 #> [3,] NA NA 8.900290 6.5029870 6.3209288 5.0339508 3.5270469 #> [4,] 1.552945 9.485788 2.505233 2.4873487 0.2701945 0.0247683 0.9196980 #> [5,] 5.083099 3.401192 9.790338 9.5872790 1.1804457 4.9583467 7.3779515 #> [6,] 6.273660 6.565796 3.599601 0.1369537 2.4379128 5.6974054 9.3642889 #> [7,] 3.642624 5.030267 8.249154 0.8984890 1.9898624 7.3572937 2.5574926 #> [8,] NA NA 6.229228 0.3857188 1.4511538 6.3054293 7.2628532 #> [9,] 8.240329 9.671391 8.767677 1.6813245 9.8219060 2.5157763 0.3994066 #> [10,] NA NA 1.634123 2.8598557 0.8603899 9.3028154 2.2648133 #> [,8] [,9] [,10] #> [1,] 1.5927475 NA NA #> [2,] 5.6658628 4.0159801 NA #> [3,] 0.6731983 0.5106245 9.064917 #> [4,] 8.8030903 4.1796604 NA #> [5,] 7.1931796 7.6393436 NA #> [6,] 7.9447767 NA NA #> [7,] 6.9648858 4.2943161 2.425870 #> [8,] 9.2396077 5.5231878 7.007675 #> [9,] 7.7064318 0.2910415 NA #> [10,] 4.0527020 6.2845017 4.315224 #> #> $time #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 15 30 45 60 75 80 100 120 NA NA #> [2,] 5 15 30 45 60 75 80 100 120 NA #> [3,] NA NA 0 5 15 30 45 60 75 80 #> [4,] 5 15 30 45 60 75 80 100 120 NA #> [5,] 5 15 30 45 60 75 80 100 120 NA #> [6,] 15 30 45 60 75 80 100 120 NA NA #> [7,] 0 5 15 30 45 60 75 80 100 120 #> [8,] NA NA 0 5 15 30 45 60 75 80 #> [9,] 5 15 30 45 60 75 80 100 120 NA #> [10,] NA NA 0 5 15 30 45 60 75 80 #>