Unable to edit metadata in corpus

90 views Asked by At

I have the following corpus:

library(jsonlite)
library(tm)

query = "https://www.ebi.ac.uk/ebisearch/ws/rest/pride?query=submitter_country:Norway&size=1000&fields=submitter_keywords&format=json"
datasets.raw <- fromJSON(query, flatten = TRUE, simplifyDataFrame = TRUE)

datasets.df <- datasets.raw$entries
datasets.df
keywords.corp <- Corpus(VectorSource(datasets.df$fields.submitter_keywords))

I'd like to edit the metadata of this corpus with some custom values. However, running this does not do the trick

meta(keywords.corp[[1]], "description") <- "hello"
meta(keywords.corp[[1]], "description")
"character(0)"

This is a bit unexpected behavior, as I'm able to do this on some example data:

data("crude")
meta(crude[[1]], "description") <- "hello"
meta(crude[[1]], "description)
[1] "hello"

What's going on here?

0

There are 0 answers