0

For a forest plot, I aim to paste the column of the Study Label ("Author (year)") with a column of superscript citation numbers. Basically, it works easy to paste the study label and citation numbers:

df <- data.frame(matrix(ncol = 2, nrow = 3))
colnames(df)[1:2] <- c("studylabel", "citation")
df$studylabel <- c("Autor A (1987)", "Author B (2002)", "Author C (2023)")
df$citation <- c(6, 13, 28)
df$goal <- paste0(df$studylabel, df$citation)
df$unicode <- c("\u2076", "\u00B9\u00B3", "\u00B2\u2078")

The unicode column works well for some citations, however, if the reference list contains more than 30 citations whose numbers are not sequential, this is a not too economical way to go.

In a similar question R forest plot author list superscript I did not found a solution. In addition, I did not succeed with expression and "^". When I include "^", an Error occurs: Error: unexpected '^'

Do you know an easy way to convert a column of numbers in a column of superscript numbers?

L Tyrone
  • 1,268
  • 3
  • 15
  • 24
Christine
  • 3
  • 2

1 Answers1

0
  1. Just add your vector of numbers:

    df$citation <- c(6, 13, 28)

  2. install and load library(reporter), then use the subscsr() function:

    df$citation <- supsc(as.character(df$citation))

Christine
  • 3
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 31 '23 at 09:41