Using profrep
This vignette documents the most common use cases and patterns for the profrep package.
Introduction
To use profrep, you will have to start with lab work! As described on the home page, one of the most common measurements that stress physiologists take is blood samples for corticosterone quantification during a stress response.
Basic Use: From a CSV
First, we will install the package from CRAN:
Next, we will load in a data set from a csv. This would take the form
of data <- read.csv(<path_to_csv>)
. Instead of
loading in new data, this vignette will make use of one of the three
example data sets provided with profrep
. We shall use the
synthetic data created for this purpose, which consists of 11
individuals, which had four replicates sampled at 4 different times.
To load in, we call the data from the profrep
package:
synthetic_data <- profrep::synthetic_data_four_point
print(synthetic_data)
#> Animal TIME A B C D
#> 1 A 0 9.00 10 11 12
#> 2 A 15 12.00 20 25 30
#> 3 A 30 16.00 30 40 50
#> 4 A 45 20.00 40 55 70
#> 5 B 0 9.00 11 13 15
#> 6 B 15 27.00 30 33 36
#> 7 B 30 30.00 33 36 39
#> 8 B 45 10.00 13 16 19
#> 9 C 0 9.00 11 13 15
#> 10 C 15 22.00 28 34 40
#> 11 C 30 27.00 35 41 47
#> 12 C 45 7.00 20 32 40
#> 13 D 0 12.00 16 19 24
#> 14 D 15 50.00 54 58 62
#> 15 D 30 20.00 24 28 32
#> 16 D 45 46.00 50 54 58
#> 17 E 0 12.00 13 14 15
#> 18 E 15 34.00 36 38 40
#> 19 E 30 39.00 41 43 45
#> 20 E 45 44.00 46 48 50
#> 21 F 0 0.01 13 14 15
#> 22 F 15 23.00 36 38 40
#> 23 F 30 28.00 41 43 45
#> 24 F 45 33.00 46 48 50
#> 25 G 0 2.00 16 20 24
#> 26 G 15 40.00 54 58 62
#> 27 G 30 10.00 24 28 32
#> 28 G 45 38.00 50 54 58
#> 29 H 0 5.00 20 35 50
#> 30 H 15 25.00 38 45 56
#> 31 H 30 46.00 52 57 63
#> 32 H 45 67.00 68 69 70
#> 33 I 0 6.00 14 22 30
#> 34 I 15 16.00 24 32 40
#> 35 I 30 28.00 36 44 52
#> 36 I 45 42.00 50 58 66
#> 37 J 0 6.00 14 22 30
#> 38 J 15 16.00 24 32 40
#> 39 J 30 28.00 36 44 52
#> 40 J 45 66.00 50 58 42
#> 41 K 0 6.00 14 22 30
#> 42 K 15 24.00 40 32 16
#> 43 K 30 44.00 28 36 52
#> 44 K 45 42.00 66 58 50
Here, we see that there are no missing replicates for any individual at any time. What clean data!
Since we know how many trials we performed, we can easily perform the profile repeatability calculation with
pr_score_df <- profrep::profrep(df=synthetic_data, n_timepoints=4)
If we wanted logs to be displayed in the terminal, we would have
changed the default verbosity factor from FALSE
to
TRUE
with verbose = True
.
The results of the calculation are below:
print(pr_score_df)
#> individual n_crossings max_variance ave_variance base_score final_score rank
#> 1 E 0 6.67 5.42 12.10 0.9925 1
#> 2 B 0 15.00 12.92 27.95 0.9912 2
#> 3 D 0 26.67 26.40 53.12 0.9887 3
#> 4 F 0 58.92 56.59 115.62 0.9790 4
#> 5 G 0 91.67 87.42 179.27 0.9611 5
#> 6 I 0 106.67 106.67 213.55 0.9461 6
#> 7 J 5 106.67 106.67 277.33 0.9026 7
#> 8 C 0 207.58 86.81 294.81 0.8861 8
#> 9 K 15 106.67 106.67 384.00 0.7613 9
#> 10 H 0 375.00 149.42 525.17 0.4374 10
#> 11 A 0 456.25 181.88 639.04 0.1993 11
We see that the individual E
is the highest-ranking
individual, with a profile-repeatability score of 0.9925!