0

I recently started learning R, I installed ggplot and a few other packages and am able to use them correctly with the already included datasets in R studio. When trying to plot my data for work I have issues. Bar graphs only show up as a single bar and scatterplots only show as a single point even though there are multiple points in the data.

In this dataset there are multiple columns with the same name (either pH or chrolophyll).

Here is my code for one of the graphs:

library(ggplot2)
library(dplyr)

#base data that will be used for analysis
pH_and_chloro <-read.csv("C:\\Users\\home\\Downloads\\pH and Chlorophyll Data.csv")

#making a simple bar graph
ggplot(pH_and_chloro, aes('pH','Chrolophyll')) + 
geom_bar(stat = 'identity')

I have tried using YouTube and previous stack overflow questions to help, but I could not find people running into the same issue.

Huhson
  • 1
  • 1
  • 4
    Try replace aes('pH','Chrolophyll') with aes(pH,Chrolophyll). – NicChr Jul 13 '23 at 13:49
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. But as already pointed out, the problem is almost surely using quotes in your `aes()` call. Nearly all ggplot introductions should tell you not to use quotes around column names. – MrFlick Jul 13 '23 at 14:29
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jul 13 '23 at 14:52

0 Answers0