0

output of command list.files("C:\\Users\\Hp\\Documents\\Read") is

[1] "1.jpg"           "2.jpg"           "3.jpg"           "Untitled4-1.jpg" "Untitled4-2.jpg" "Untitled4-3.jpg"

How do I get an output "1" "2" "3" "Untitled4-1" "Untitled4-2"

Roshan
  • 79
  • 6
  • 1
    `tools::file_path_sans_ext(list.files("C:\\Users\\Hp\\Documents\\Read"))` – Ronak Shah Aug 24 '21 at 11:28
  • In base R you can remove the extensions with a regular expression using `sub` : `sub("(^.*)\\.[[:alnum:]]+$", "\\1", list.files("C:\\Users\\Hp\\Documents\\Read"))` – Allan Cameron Aug 24 '21 at 11:30

0 Answers0