removePunctuation doesn't work

hi everyone, I'm a beginner, so the question probably has a trivial answer.
Ubuntu 20.04, Rstudio 2022-07.1
I am trying the initial cleaning of a Corpus, but nothing happens. The working directory has permissions set to 777. I run the command, but the punctuation stays there ... it will be a silly mistake, but I don't see it. Thank you.

Here's my simple code:

setwd("~/transito/mb2")
library(tm)
Carico il pacchetto richiesto: NLP
mb <- Corpus(DirSource("./"))
mb
<>
Metadata: corpus specific: 1, document level (indexed): 0
Content: documents: 1
mb <- tm_map(mb, removePunctuation)

The fact that you mention the permissions of your working directory make me think that you may be under the misapprehension that the code you shared would have any effect on the text files in your directory as they are recorded on disk; it would not; your code would load them from disk into memory, and then remove the punctuation from the in-memory representation.

1 Like

Shame on me :frowning: That's it, thanks!!

This topic was automatically closed 7 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.