the latest ggplot from github (to be installed with
`devtools:install_github()`) has support for SF objects too, it's a treat!
However, sf is not exactly designed for raster data. Of course you can make
each of your cells be a square polygon, but it's not the most efficient way
for big datasets. Fo
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 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
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 1
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?), ho
The projection is UTM zone, but I meant that I don't have coordinates for
each grid cell, rather, I have coordinates for the upper left corner. The
attribute layer is elevation for each grid cell for example, I assume that
I need to create coordinates for the grid cells first? Thanks.
On Mon, Jan
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/speci
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
Also note that there is an R-sig-geo mailing list dedicated to this topic.
You might also like to look at [1] for more on coordinate projections.
[1]
https://www.nceas.ucsb.edu/~frazier/RSpatialGuides/OverviewCoordinateReferenceSystems.pdf
On Mon, 15 Jan 2018, Roman Lu?trik wrote:
You will n
It is not generally advisable to get too fancy with stat functions in
ggplot... things can easily get more complicated than ggplot is ready to
handle when it comes to calculations. It is better to create data that
corresponds directly to the graphical representations you are mapping
them to.
You will need to coerce your data into a "spatial" kind, as implemented in
`sp` or as of late, `sf` packages. You might want to give the vignettes a
whirl before you proceed.
Roughly, you will have to coerce the data to Spatial* (you could go for a
point, raster or grid type, I think) and also spec
Hi users,
I have no clear clue about plotting spatial data. For example, I just have
a table with attribute values of each grid cell, such as elevation. Then I
have coordinates of the upper left corner in UTM, the number of rows and
columns, and grid cell size. How to create spatial plot of elevat
Hi Kenneth,
I don't know about ggplot, but perhaps this will help:
kddf<-read.table(text="city n y
mon 100 200
tor 209 300
edm 98 87
mon 20 76
tor 50 96
edm 62 27",
header=TRUE,stringsAsFactors=FALSE)
library(plotrix)
barpos<-barp(t(kddf[,2:3]),names.arg=kddf[,1],xlab="City",ylab="Sum",
main="Sum
> On Jan 15, 2018, at 12:58 AM, Max Shell wrote:
>
> Suppose I have a dataset contain three variants, looks like
>> head(dta)
>
> SextumorsizeHistology time status
>01.52 12.1000 0
>11.81
https://stackoverflow.com/questions/25070547/ggplot-side-by-side-geom-bar
On Mon, Jan 15, 2018 at 9:39 PM, Kenneth Dyson wrote:
> Hi Eric,
>
> Thanks for the detailed response.
> This is not exactly what I want to do but is close.
> I want 2 bars for each city, 1 with the sum for "yes" , the oth
'position="dodge"' has no effect in the plot because the x-axis is a factor
variable. The bars do not need to be moved to avoid each other. The
'aes(fill=y)' is specifying that you want the color gradient to capture the
sums in the 'y' variable. You might be better off to use 'no' and 'yes'
rather
For your and perhaps other's reference, the RStudio version has nothing to
do with this. Rstudio is merely a a GUI IDE for R itself, and it's the R
(or R package) version that matters.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking
Dear Mariano,
See the function leveneTest() in the car package.
I hope that this helps,
John
-
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
Web: socialsciences.mcmaster.ca/jfox/
> -Original Message-
> From: R-help [mailto:r-he
Hi,
What package(s) must I install so that I can apply the Levene' test in my
data?
I tried 'lawstat' but dependency ‘VGAM’ is not available for this package.
I am using Rstudio Version 1.1.383
Tks
[[alternative HTML version deleted]]
__
"Good" tutorials are a matter of personal taste -- what's good for me may
be terrible for you, and vice-versa.
One set of recommendations is here:
https://www.rstudio.com/online-learning/#R
but you may do even better by web search on "R tutorials" or "Writing R
function tutorials" and the like.
Thank you, your suggestion is simpler and logically better. I had impression
that the last object in a function gets returned, so I did not add the print
function at the bottom line of the function definition. Returning an object
and graph the object are different process, I am a beginner for
That is certainly OK, but you can also just use
print(ggsurvplot(...))
as your final statement.
out <- RFS( ...)
would then return the ggsurvplot object *and* graph it.
Any good R tutorial or a web search will provide more details on function
returns, which you might find useful.
Cheers,
Ber
Hi Richard,
Thank you so much!! I understand the problem now, I assign a name to the
"ggsurvplot" object and then add print(fig) at bottom of function definition,
now figure gets printed on screen.
Ding
# function to generate RFS curves
RFS <- function( inputfile, N ) {
cluster<- survfit(S
I am trying to create a barplot displaying the sums of 2 columns of data
grouped by a variable. the data is set up like this:
"city" "n" "y"
mon 100 200
tor 209 300
edm 98 87
mon 20 76
tor 50 96
edm 62 27
the resulting plot should have city as the x-axis, 2 bars per city, 1
representing
Your message seems unclear, and as evidence the respondents are giving various
answers. You should provide a small sample of input and output data as it would
look in R to avoid this kind of thrashing about. See [1][2][3] for guidance.
Note that you also really need to figure out how to make sur
> Michal Burda
> on Mon, 15 Jan 2018 12:04:13 +0100 writes:
> Dear R users, is the following OK?
>> max(NA, NaN)
> [1] NA
>> max(NaN, NA)
> [1] NA
>> pmax(NaN, NA)
> [1] NA
>> pmax(NA, NaN)
> [1] NaN
> ...or is it a bug?
> Documentation
Hi
see in line
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Alejandra
> Lopez-Galan
> Sent: Monday, January 15, 2018 10:29 AM
> To: r-help@r-project.org
> Subject: [R] sum multiple csv files
>
> Hi, I am pretty new to R and I would apreciatte very
Alejandra Lopez-Galan writes:
Hello,
I'm not sure to fully answer you question but I'll give it a try. I'll
use the library "data.table" as I forgot how to do it in base R. If you
don't have it you will have to install it by doing
> install.packages(data.table,repos ="http://cran.us.r-project.or
Dear R users,
is the following OK?
> max(NA, NaN)
[1] NA
> max(NaN, NA)
[1] NA
> pmax(NaN, NA)
[1] NA
> pmax(NA, NaN)
[1] NaN
...or is it a bug? Documentation says that NA has a higher priority over
NaN.
Best regards, Michal Burda
[[alternative HTML version deleted]]
___
Hi, I am pretty new to R and I would apreciatte very much your help to
solve my problem. I have 40 csv files that have the same structure, and I
want to merge them into a single data frame.
I already have load and combined all the cvs files into a large list, and I
created two
filenames <- list.f
Suppose I have a dataset contain three variants, looks like
> head(dta)
SextumorsizeHistology time status
01.52 12.1000 0
11.81 38.4000 0
.
Sex: 1
Dear Sir,
Many thanks and Best Regards,
Ashim.
On Sun, Jan 14, 2018 at 9:05 PM, Fox, John wrote:
> Dear Ashim,
>
> I’ll address your questions briefly but they’re really not appropriate for
> this list, which is for questions about using R, not general statistical
> questions.
>
> (1) The relev
31 matches
Mail list logo