I want the bar chart in such a way that the variables "kan_sp","kan_read" come side by side in a single plot. But I am unable to do it.
library(tidyverse)
nithin<-tibble::tribble(
~student_id, ~kan_sp, ~kan_read, ~eng_sp, ~eng_read,
"st001", 1L, 0L, 1L, 0L,
"st002", 1L, 0L, 1L, 0L,
"st003", 1L, 0L, 1L, 0L,
"st004", 1L, 1L, 1L, 0L,
"st005", 1L, 0L, 1L, 0L,
"st006", 1L, 1L, 1L, 0L,
"st007", 1L, 0L, 1L, 0L,
"st008", 1L, 0L, 0L, 1L,
"st009", 0L, 0L, 0L, 1L,
"st010", 0L, 1L, 1L, 1L,
"st011", 0L, 1L, 1L, 1L,
"st012", 0L, 1L, 0L, 0L,
"st013", 1L, 1L, 0L, 0L,
"st014", 1L, 1L, 1L, 1L,
"st015", 1L, 1L, 1L, 1L
)
nithin %>%
ggplot()+geom_bar(kan_sp,position="dodge")+geom_bar(kan_read,position="dodge")+
geom_bar(eng_sp,position="dodge")+
geom_bar(eng_read,position="dodge")
#> Error in layer(data = data, mapping = mapping, stat = stat, geom = GeomBar, : object 'kan_sp' not found