changing name of all data.frames in a list()

I have a list() with 570 dataframes and i want to change the name of all these data.frames to a value that is refered inside of these dataframes.

im trying:

purrr

map(dicom_patient1_hdr, ~filter(.x, grepl("SeriesNumber|InstanceNumber", name))) -> numbers
numbers$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356202.44143.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 1
2 0020 0013 InstanceNumber IS 2 1

head(numbers, 20)
$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356202.44143.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 1
2 0020 0013 InstanceNumber IS 2 1

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356285.44256.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 1

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356285.44257.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 2

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356285.44258.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 3

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356285.44259.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 4

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356285.44260.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 5

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356285.44261.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 6

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356286.44262.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 7

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356286.44263.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 8

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356286.44264.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 9

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356286.44265.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 10

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356286.44266.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 11

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356286.44267.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 12

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356286.44268.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 13

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356287.44269.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 14

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356287.44270.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 15

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356287.44271.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 16

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356287.44272.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 17

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356287.44273.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 18

$data-files/patient1_jpeg_transformed_img//1.2.840.113704.1.111.28952.1503356287.44274.dcm
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 19

names(numbers) <- map(numbers, ~extract(.x, "value"))

head(numbers, 20)
$list(value = c("1", "1"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 1
2 0020 0013 InstanceNumber IS 2 1

$list(value = c("2", "1"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 1

$list(value = c("2", "2"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 2

$list(value = c("2", "3"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 3

$list(value = c("2", "4"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 4

$list(value = c("2", "5"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 5

$list(value = c("2", "6"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 6

$list(value = c("2", "7"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 7

$list(value = c("2", "8"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 8

$list(value = c("2", "9"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 9

$list(value = c("2", "10"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 10

$list(value = c("2", "11"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 11

$list(value = c("2", "12"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 12

$list(value = c("2", "13"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 13

$list(value = c("2", "14"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 14

$list(value = c("2", "15"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 15

$list(value = c("2", "16"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 16

$list(value = c("2", "17"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 17

$list(value = c("2", "18"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 18

$list(value = c("2", "19"))
group element name code length value sequence
1 0020 0011 SeriesNumber IS 2 2
2 0020 0013 InstanceNumber IS 2 19

####################################################

I want to change the name of the dataframe to "data.frame$SeriesNumber"_"InstanceNumber"
the result should be (example) 2_18

Is there a short string to solve that? tanks

Hello.
Thanks for providing code , but you could take further steps to make it more convenient for other forum users to help you.

Share some representative data that will enable your code to run and show the problematic behaviour.

You might use tools such as the library datapasta, or the base function dput() to share a portion of data in code form, i.e. that can be copied from forum and pasted to R session.

Reprex Guide

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.