# Create an example data frame
dat1 <- data.frame(citations = c(0, 1, 1, 2, 3, 5, 8),
keywords = c("a; b; c", "b; d", "c", "d", "e; g", "f", "g"),
id = c("abc123", "bcd234", "def345", "efg456", "fgh567", "ghi678", "hij789"),
categories = c("a; d; e", "b", "c", "d; g", "e", "f", "g"))
# Calculate x-index
xdc_index(df = dat1, p1 = "keywords", id = "id", cit = "citations")
# Calculate xd-index
xdc_index(df = dat1, p1 = "categories", id = "id", cit = "citations", hg = TRUE)
# Calculate x-index, xd-index, and xc-index together
xdc_index(df = dat1, p1 = "keywords", p2 = "categories", id = "id", cit = "citations", hg = TRUE)
Run the code above in your browser using DataLab