# mean and SD in parenthese

Please how can i have mean and SD in the same column? with SD in the parenthese.

how can plot cencentratin Curve for many Countries in one Graphic?

How to compute Concentration Index for many countries in one time?

Hi, welcome!

We don't really have enough info to help you out. Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

For your first question, you can use the `glue` package to embed expressions within curly brackets, which then gets converted into a string

``````library(dplyr)
library(glue)

mydf <- data.frame(means = round(runif(n = 10, min = 10, max = 15), 2),
sd = round(runif(n = 10, min = 2, max = 5), 2))
means   sd
1  10.90 2.79
2  12.06 4.83
3  14.87 3.51
4  12.35 2.67
5  11.08 3.13
6  10.76 3.44
7  14.04 4.05
8  10.78 3.96
9  13.31 2.86
10 13.35 2.82

# create a new column called `together` with the means and SD in parentheses
mydf %>% mutate(together = glue("{means} ({sd})"))

means   sd     together
1  10.90 2.79  10.9 (2.79)
2  12.06 4.83 12.06 (4.83)
3  14.87 3.51 14.87 (3.51)
4  12.35 2.67 12.35 (2.67)
5  11.08 3.13 11.08 (3.13)
6  10.76 3.44 10.76 (3.44)
7  14.04 4.05 14.04 (4.05)
8  10.78 3.96 10.78 (3.96)
9  13.31 2.86 13.31 (2.86)
10 13.35 2.82 13.35 (2.82)
``````

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