Hello everyone i have a matrix which contains 7 columns first one is time in seconds, second one time in minutes, Columns 3 to 6 describe the result obtained per test. It has 6 test for whole data, Is there a way i can select from the matriz only the data of test 3 por example? (Every test describes the obtained results of values per time)
Yes, you can do this with the aid of some packages.
Below you will find a stylized example
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(purrr)
library(magrittr)
#>
#> Attaching package: 'magrittr'
#> The following object is masked from 'package:purrr':
#>
#> set_names
p <- data.frame(
stringsAsFactors = F,
time_min = 1:6,
CH001 = c(0.1,-0.1,0,0.2,0.1,0.1),
Test = c("Test1","Test1","Test1","Test2","Test2","Test2" )
)
tests <- unique(p$Test)
purrr::walk(tests,
function (thistest)
{
thistestdata <- p %>%
filter(Test == thistest)
plot(thistestdata$time_min, thistestdata$CH001,
main=thistest)
})
Created on 2021-07-15 by the reprex package (v2.0.0)