similar to: about adding a column for water year

Displaying 20 results from an estimated 10000 matches similar to: "about adding a column for water year"

2017 Jul 04
0
about adding a column for water year
Well, let's see: 1) You do not appear to understand basic flow control statements in R. Note that (from ?if): if(cond) expr if(cond) cons.expr else alt.expr where "cond A length-one logical vector that is not NA." Your cond is a vector of length nrow(DF), so you don't want if, you want ifelse(). Did you fail to show us your warning messages?? 2. Revising your code and
2017 Jul 04
0
about adding a column for water year
Hello, You have a '{' too many. for(i in 1972:1985){ if(DF$year==i & DF$month %in% 1:9){ DF$wyear <- i }else{ DF$wyear < i-1 } } } I believe this is it. Hope this helps, Rui Barradas Em 04-07-2017 19:31, lily li escreveu: > Hi R users, > I have a question about adding a column for water year. The dataframe has > the
2018 Mar 08
3
add single points to a level plot
Hi all, I'm trying to add single points with known coordinates to a level plot, but could not find the proper answer. I got to know that layer() function is good for this, but I don't know which package is related to this function. The source is here: https://stackoverflow.com/questions/28597149/add-xy-points-to-raster-map-generated-by-levelplot but my question is a little different as I
2018 Mar 08
0
add single points to a level plot
Hi all, I ran the code: > s <- stack(replicate(2, raster(matrix(runif(100), 10)))) > xy <- data.frame(coordinates(sampleRandom(s, 10, sp=TRUE)), + z1=runif(10), z2=runif(10)) > levelplot(s, margin=FALSE, at=seq(0, 1, 0.05)) + + layer(sp.points(xy, pch=ifelse(pts$z1 < 0.5, 2, 3), cex=2, col=1), columns=1) + + layer(sp.points(xy, pch=ifelse(pts$z2 < 0.5, 2,
2017 Jul 16
2
About doing figures
Hi Jim, For true color, I meant that the points in the figure do not correspond to the values from the dataframe. Also, why to use rainbow(9) here? And the legend is straight in the middle, is it possible to reformat it to the very bottom? Thanks again. On Sun, Jul 16, 2017 at 2:50 AM, Jim Lemon <drjimlemon at gmail.com> wrote: > Hi lily, > As I have no idea of what the "true
2017 Jul 16
0
About doing figures
For more than 10 records, how to reformat the colors? Also, how to show the first legend only, but at the bottom, while the second legend in your code is not necessary? In all, the same A values have the same color, but different symbols in DF==1 and DF==2. Thanks for your help. On Sun, Jul 16, 2017 at 9:28 AM, lily li <chocold12 at gmail.com> wrote: > Hi Jim, > > For true color,
2018 Mar 08
1
add single points to a level plot
You need to load the package 'rasterVis' > library(rasterVis) HTH, Eric On Thu, Mar 8, 2018 at 5:11 PM, lily li <chocold12 at gmail.com> wrote: > Hi all, > > I ran the code: > > s <- stack(replicate(2, raster(matrix(runif(100), 10)))) > > xy <- data.frame(coordinates(sampleRandom(s, 10, sp=TRUE)), > + z1=runif(10), z2=runif(10))
2017 Aug 06
2
about saving format
In the lower right panel of R-studio interface, there is the "Export" button. I saved as PDF from there directly, rather than using functions On Sat, Aug 5, 2017 at 6:18 PM, Ismail SEZEN <sezenismail at gmail.com> wrote: > > > On 6 Aug 2017, at 03:01, lily li <chocold12 at gmail.com> wrote: > > > > I am using the plot() function, but have a problem.
2018 Jan 16
2
Steps to create spatial plots
Hi Bert, I think you are correct that I can use levelplot, but I have a question about converting data. For example, the statement: levelplot(Z~X*Y), Z is row-wise from the lower left corner to the upper right corner. My dataset just have gridded Z data as a txt file (or can be called matrix?), how to convert them to the vector in order for levelplot to use? Thanks. On Mon, Jan 15, 2018 at 6:04
2017 Aug 06
2
about saving format
If the OP is using RStudio and not using R (i.e. pdf()) directly, it sounds like this query should be directed to RStudio support, not here. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sat, Aug 5, 2017 at 5:54 PM, Ismail
2017 Jul 16
2
About doing figures
Hi R users, I still have the problem about plotting. I wanted to put the datasets on one figure, x-axis represents values B, y-axis represents values C, while different colors label column A. Each record uses a circle on the figure, while hollow circles represent DF=1 and solid circles represent DF=2. I put my code below, but the A labels do not correspond to the true record, so I don't know
2018 Jan 16
0
Steps to create spatial plots
Sorry for the emails, I just wanted to have an example. layer$z 1 1 3 4 6 2 2 3 4 1 2 9 1 4 5 2 1 8 How to convert the matrix to layer$z = c(1, 4, 5, 2, 1, 8, 2, 3, 4, 1, 2, 9, 1, 1, 3, 4, 6, 2)? I think this vector is the order that levelplot can use. Thanks again. On Mon, Jan 15, 2018 at 10:58 PM, lily li <chocold12 at gmail.com> wrote: > Hi Bert, > > I think
2018 Jan 16
1
Steps to create spatial plots
If layer$z is a matrix and you want to reverse the order of the rows, you can do: n <- nrow(layer$z) layer$z <- layer$z[ n:1, ] HTH, Eric On Tue, Jan 16, 2018 at 8:43 AM, lily li <chocold12 at gmail.com> wrote: > Sorry for the emails, I just wanted to have an example. > layer$z > > 1 1 3 4 6 2 > 2 3 4 1 2 9 > 1 4 5 2 1 8 > > How to convert
2018 Jan 16
3
Steps to create spatial plots
Hi Roman, Thanks for your reply. For the spatial coordinates layer, I just have coordinates of the upper left corner, numbers of rows and columns of the spatial map, and grid cell size. How to create a spatial layer of coordinates from this data? Thanks. On Mon, Jan 15, 2018 at 3:26 PM, Roman Lu?trik <roman.lustrik at gmail.com> wrote: > You will need to coerce your data into a
2009 May 21
2
Naming a random effect in lmer
Dear guRus: I am using lmer for a mixed model that includes a random intercept for a set of effects that have the same distribution, Normal(0, sig2b). This set of effects is of variable size, so I am using an as.formula statement to create the formula for lmer. For example, if the set of random effects has dimension 8, then the lmer call is: Zs<-
2018 Feb 16
2
error in loading rgdal package
Hi R users, Could you help me to see this problem? I could now load "rgdal" even though I downloaded the compressed folder. Thanks for your help. Loading required package: sp Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/libs/rgdal.so': [[alternative HTML version deleted]]
2017 Aug 06
0
about saving format
> On 6 Aug 2017, at 03:47, lily li <chocold12 at gmail.com> wrote: > > In the lower right panel of R-studio interface, there is the "Export" button. I saved as PDF from there directly, rather than using functions > > On Sat, Aug 5, 2017 at 6:18 PM, Ismail SEZEN <sezenismail at gmail.com> wrote: > > > On 6 Aug 2017, at 03:01, lily li <chocold12 at
2018 Jan 16
0
Steps to create spatial plots
>From your description, I am **guessing** that you may not want a "spatial map" (including projections) at all, but rather something like a level plot. See ?levelplot in the lattice package for details. Both I am sure ggplot2 has something similar. Apologies if I havemisunderstood your intent/specifications. Cheers, Bert Bert Gunter "The trouble with having an open mind is
2017 Oct 11
2
about taylor.diagram
Hi R users, I don't know if you have used taylor.diagram function. Why my diagram is not like 1/4th of a round shape, but more flat, like 1/4th of an oval? Thanks. [[alternative HTML version deleted]]
2017 Aug 06
0
about saving format
On 05/08/2017 9:10 PM, Bert Gunter wrote: > If the OP is using RStudio and not using R (i.e. pdf()) directly, it > sounds like this query should be directed to RStudio support, not > here. Two things: First, to Lily: "?" is the "per mil" symbol, not percent; it's not an ASCII symbol, which is why there are issues displaying it. If you really mean percent, use