Description Usage Arguments Details Examples
View source: R/join_metadata.R
This functions takes the output from dist_long
, plus a
data.frame with metadata, and attaches it to the data.frame output from
dist_long
. It uses a column in the metadata data.frame as a key to
join the two data.frames. So, it requires a column of data in the metadata
data.frame to have same ID labels as those in the pairwise comparison table.
1 2 | join_metadata(dist, meta, isolate = "ISOLATES", group = "CLUSTER",
remove_ind = TRUE)
|
dist |
A data.frame produced by dist_long function |
meta |
A data.frame with one column of IDs that match the IDs in |
isolate |
A character string with the name of the column in the meta data.frame with the ID data |
group |
A character string with the name of column containing the grouping variable |
remove_ind |
A boolean whether to remove all non-essential columns |
The output from dist_long
with an additional column containing
a factor, with levels composed of joining the categories in the group
colum of the metadata data.frame for each pairwise comparison. For example,
if one row has distance between samples id1 and id2, and in the grouping column
of the metadata id1 is identified as part of group 'A', and id2 is identified
as part of group 'B', then the output from that row will 'AB'. If they were
from the same group, say 'A', the output would be just 'A'. In this way
it is easy to identify pairs of isolates that are from the same group, and
pairs of isolates that are from different groups.
1 2 3 4 5 6 7 | ## Not run:
data(woodmouse)
data(woodmouse_meta)
dist_df <- dist_long(woodmouse)
join_metadata(dist_df, woodmouse_meta, isolate = 'SAMPLE_ID', group = 'CLUSTER', remove_ind = TRUE)
## End(Not run)
|
Registered S3 method overwritten by 'treeio':
method from
root.phylo ape
# A tibble: 105 x 3
iso1 iso2 CLUSTER
<chr> <chr> <fct>
1 No304 No305 AB
2 No306 No305 AB
3 No0906S No305 AB
4 No0908S No305 AB
5 No0909S No305 AC
6 No0910S No305 AB
7 No0912S No305 AC
8 No0913S No305 AB
9 No1103S No305 AC
10 No1007S No305 AC
# … with 95 more rows
Warning message:
`funs()` is deprecated as of dplyr 0.8.0.
Please use a list of either functions or lambdas:
# Simple named list:
list(mean = mean, median = median)
# Auto named with `tibble::lst()`:
tibble::lst(mean, median)
# Using lambdas
list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.