[R-sig-Geo] Selecting a range of values in a specific column for R ggplot

r@i@1290 m@iii@g oii @im@com r@i@1290 m@iii@g oii @im@com
Thu Oct 13 19:08:38 CEST 2022


That you so much! Yes, this stopped the error from appearing. 
>From what I see, though, when I attempt to change the subset from [1:4] to, say, [17:21] or [30:34], I end up with the exact same plots. Why could that be? The idea would be to make different curves on the same plot by changing the subset.


-----Original Message-----
From: Bede-Fazekas Ákos <bfalevlist using gmail.com>
To: r-sig-geo using r-project.org
Sent: Thu, Oct 13, 2022 12:37 pm
Subject: Re: [R-sig-Geo] Selecting a range of values in a specific column for R ggplot

Hello,
try
newplot <- ggplot(data = GEV[1:4, ], aes(x = RL45)) + geom_density(color 
= "midnightblue") + xlab("Location (mm/day") + ggtitle("Global Location 
under RCP4.5") + xlim(300, 350)
HTH,
Ákos
-----------
Ákos Bede-Fazekas
Centre for Ecological Research, Hungary

2022.10.13. 18:27 keltezéssel, rain1290--- via R-sig-Geo írta:
> I am trying to select a range of values (i.e. the first 4 values) in a specific column from a table. The column is called "RL45". I tried the following code to create a plot in ggplot:
> newplot <- ggplot(data = GEV, aes(x = RL45[1:4])) + geom_density(color = "midnightblue") + xlab("Location (mm/day") + ggtitle("Global Location under RCP4.5") + xlim(300, 350)
>
> This results in this strange error:
>
> Error: Aesthetics must be either length 1 or the same as the data (34): x
>
> This is odd, as I selected the first 4 values in that "RL45" column.
> Any thoughts would be greatly appreciated!
> Thank you,
>     [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo using r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list