Hello,
I tried to make a histogram form the nummers i got out of my data set.
I get an error with that the number is not a numeric.
i made a screen shot to. maby the situation is more clear.
Hello,
I tried to make a histogram form the nummers i got out of my data set.
I get an error with that the number is not a numeric.
i made a screen shot to. maby the situation is more clear.
I see two problems:
hist(Strategy1$Total_EU_Sales)
, but there is a second problem.I dont think a histogram of a single summary value makes anysense but, you have omitted to identify the column of the data.frame to use
hist(Strategy1$Total_EU_Sales)
i tough to do it this way:
Simulation10 <- videogames %>%
filter(Genre == "Simulation") %>%
filter(Platform %in% c("NES", "SNES" , "N64", "Wii", "WiiU", "GB", "GBA", "GC", "3DS", "DS", "3DS")) %>%
summarise(Total_EU_Sales = sum(EU_Sales))
print (Simulation10) #57.49
Sports11 <- videogames %>%
filter(Genre == "Sports") %>%
filter(Platform %in% c("NES", "SNES" , "N64", "Wii", "WiiU", "GB", "GBA", "GC", "3DS", "DS", "3DS")) %>%
summarise(Total_EU_Sales = sum(EU_Sales))
print (Sports11) #123.87
Strategy12 <- videogames1 %>%
filter(Genre == "Strategy") %>%
filter(Platform %in% c("NES", "SNES" , "N64", "Wii", "WiiU", "GB", "GBA", "GC", "3DS", "DS", "3DS")) %>%
summarise(Total_EU_Sales = sum(EU_Sales))
print (Strategy12) #8.39
hist(Strategy12,Sports11,Simulation10$Total_EU_Sales)
so i have more input for the histogram.. but my way is not working
I think that you conceptually want a histogram, but hist() does binning for you and plotting, if you want to plot your own binned up numbers you would use barplot() or geom_col() of ggplot2
library(tidyverse)
(mydf<- tibble(label=c("A","B","C"),
value=c(3,1,2)))
#option 1
barplot(formula= value ~ label,
data=mydf)
#option 2
ggplot(data=mydf,mapping=aes(x=label,y=value)) +
geom_col()
This is not working for me.
i tried this one:
counts <- table(videogames1$EU_Sales)
barplot(counts, main="Verkoop",
xlab="Verkoop cijfers Eu sales videogames")
But what is want is these nummers in a histogram or a barplot:
Its hard to help if you dont explain...
you have omitted the formula which is used to tell barplot what to use as a value and what to use as a label however first deal with your main problem of constructing a single dataframe with your required labels and values
(to_plot <- vidgeogames %>%
group_by(Genre) %>%
filter(Platform %in% c("NES", "SNES" , "N64", "Wii", "WiiU",
"GB", "GBA", "GC", "3DS", "DS", "3DS")) %>%
summarise(value= sum(EU_Sales)) %>% rename(label=Genre))
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.