Hi Jim -
This would benefit from a reprex, as it is not clear which data go in which columns.
I am guessing at what you (might) want in the reprex below. Hopefully it gives you a starting point.
library(tidyverse)
library(janitor)
#>
#> Attaching package: 'janitor'
#> The following objects are masked from 'package:stats':
#>
#> chisq.test, fisher.test
df <- data.frame(
`Group, Element` = c(20001, 20002),
Description = c('FileMetaInformationVersion',
'MediaStorageSOPClassUID'),
Data = c('2 bytes - 00 01', '1378549247')
)
df
#> Group..Element Description Data
#> 1 20001 FileMetaInformationVersion 2 bytes - 00 01
#> 2 20002 MediaStorageSOPClassUID 1378549247
df2 <- data.frame(
group_element = c(20001, 20002),
description = c('FileMetaInformationVersion',
'MediaStorageSOPClassUID'),
scan_type = c('MR Enterography', 'Abdominal X-ray'))
df2
#> group_element description scan_type
#> 1 20001 FileMetaInformationVersion MR Enterography
#> 2 20002 MediaStorageSOPClassUID Abdominal X-ray
df %>%
clean_names() %>%
left_join(df2) ->
joined_df
#> Joining, by = c("group_element", "description")
joined_df
#> group_element description data scan_type
#> 1 20001 FileMetaInformationVersion 2 bytes - 00 01 MR Enterography
#> 2 20002 MediaStorageSOPClassUID 1378549247 Abdominal X-ray
Created on 2019-10-31 by the reprex package (v0.3.0)
I used your data frame (df) and cleaned the names with janitor::clean_names, then left_joined it to df2, which adds a new column for scan_type.
Is this what you were intending?
If not, try to make a more specific minimal REProducible EXample, or reprex, with this guide.