I have a large table with different columns and some rows. The columns represent different characteristics of each row. The row are my different items i would say.
The overall buildup or relevant columns are like so:
ColumnID Classification will_use_b Region 1 A TRUE A 2 A FALSE X 3 B TRUE X 4 C TRUE A 5 D FALSE A 6 A TRUE A
The aim for me is for example to print barchart havin the column Classification
at the x-axis and show the number of occurences on the y-axis. More, beforehand I wanted to filter that only items are used with the parameter will_use_b
are TRUE
.
WIth the current table format I don't get this to work for me, more I am not sure how to define these conditions with column will_ues_b
My first try was to make use of tibble from tidyverse:
df <- read.csv2("file.csv", header = TRUE)
data <- tibble(
colID= df$ColumnID,
class= df$Classification,
willUse = df$will_use_b,
reg= df$Region,
)
##and then
grouped <- data %>%
group_by(class) %>% mutate(classsum=sum(class))
But that does not work and I am not sure how to filter beforehand.
I was reading about the gather()
function, could this help in my case?
The overall aim is just to have some kind of Barplot with the amount of each Classification.