-2

I use two variables from a dataset: I got the graph for one of them:

barchart(data_derm$PP_SD_ARBVLZ=="1")

I want to put the graph for this variable data_derm$PP_SD_ARBTLZ=="1" next to the other graph to one graph

thanks a lot for any help!

user2373707
  • 105
  • 1
  • 1
  • 8

2 Answers2

0

Without a reproducible example, this question will be difficult to answer definitively. One possibility is to use something like ?layout:

layout(matrix(1:2, nrow=1))
barchart(data_derm$PP_SD_ARBVLZ=="1")
barchart(data_derm$PP_SD_ARBTLZ=="1")

See the Quick-R website for more.

gung - Reinstate Monica
  • 11,583
  • 7
  • 60
  • 79
0

So you want two graphs in one figure if I am understanding you correctly. If you want the commands from the base package. You can use:

> data(mtcars)
# par(mfrow=c(row, col))  and "row" is the number of plots you put in a row and same for "col"
> par(mfrow=c(1,2))
> barplot(mtcars$mpg)
> boxplot(mtcars$mpg ~ as.factor(mtcars$cyl))

You can use other functions if you don't mind using with GGPLOT2.. etc. enter image description here

B.Mr.W.
  • 18,910
  • 35
  • 114
  • 178