Re: [R-sig-Geo] How do i plot a graph with x axis vertically labelled?

2018-08-13 Thread Sarah Goslee
The graphics parameters are all in the help file for par
?par

The one you need is las.

Without trying to wade thru your mangled HTML data (dput() is the best
way to provide reproducible data), check this out:

barplot(runif(5), names.arg = c("25/08/2004", "26/09/2004",
"02/11/2004", "11/11/2004", "22/11/2004"), main = 'Females 2005', ylab
= ' Age/Days', xlab = 'Birth/Hatch date', las=2)

You'll need to mess with label positioning, and with margin size, to
get everything looking as you wish.

But I'm not sure this is the most effective way to show
irregularly-spaced dates. Why not convert your dates to Date or other
time series, and plot them to scale as points?

Sarah
On Mon, Aug 13, 2018 at 6:25 AM Vasana Tutjavi via R-sig-Geo
 wrote:
>
> Dear R-sig-geo experts,
>
> I want to plot a bar graph with the labels on the x axis in a vertical 
> format. The data is the Ages of Squid (on the Y axis) and the date of Birth 
> on the X axis, I am struggling to change the labels on the x axis to a 
> vertical format and I want all the dates to show at all the bars. My data is 
> as follows:
> Birth
> Sex
> Age
> 25/08/2004
> F
> 2
> 26/09/2004
> F
> 3
> 02/11/2004
> F
> 3
> 11/11/2004
> F
> 1
> 22/11/2004
> F
> 3
> 04/12/2004
> F
> 1
> 08/12/2004
> F
> 4
> 15/12/2004
> F
> 4
> 21/12/2004
> F
> 5
> 24/12/2004
> F
> 1
> 04/01/2005
> F
> 1
> 06/01/2005
> F
> 3
> 13/01/2005
> F
> 2
> 18/01/2005
> F
> 1
> 19/01/2005
> F
> 3
> 09/02/2005
> F
> 2
> 11/02/2005
> F
> 1
> 13/02/2005
> F
> 1
> 17/02/2005
> F
> 1
> 18/02/2005
> F
> 8
> 19/02/2005
> F
> 5
> 24/02/2005
> F
> 1
> 28/02/2005
> F
> 42
> 01/03/2005
> F
> 1
> 07/03/2005
> F
> 1
> 08/03/2005
> F
> 2
> 09/03/2005
> F
> 1
> 14/03/2005
> F
> 7
> 16/03/2005
> F
> 1
> 25/03/2005
> F
> 3
> 01/04/2005
> F
> 1
> 06/04/2005
> F
> 5
> 07/04/2005
> F
> 1
> 08/04/2005
> F
> 1
> 13/04/2005
> F
> 1
> 14/04/2005
> F
> 1
> 27/04/2005
> F
> 1
> 01/05/2005
> F
> 2
> 07/05/2005
> F
> 1
> 08/05/2005
> F
> 2
> 16/05/2005
> F
> 1
> 30/05/2005
> F
> 8
> 06/06/2005
> F
> 1
> Here is the script I tried:
>
> barplot(Females2005$Age,  names.arg = c("25/08/2004", "26/09/2004", 
> "02/11/2004", "11/11/2004", "22/11/2004", "04/12/2004", "08/12/2004",
>"15/12/2004", "21/12/2004", 
> "24/12/2004", "04/01/2005", "06/01/2005", "13/01/2005", "18/01/2005",
>"19/01/2005", "09/02/2005", 
> "11/02/2005", "13/02/2005", "17/02/2005", "18/02/2005", "19/02/2005",
>   "24/02/2005", "28/02/2005", 
> "01/03/2005", "07/03/2005", "08/03/2005", "09/03/2005", "14/03/2005",
> "16/03/2005", "25/03/2005", "01/04/2005", 
> "06/04/2005", "07/04/2005", "08/04/2005", "13/04/2005",
>   "14/04/2005", "27/04/2005", 
> "01/05/2005", "07/05/2005", "08/05/2005", "16/05/2005", "30/05/2005",
> "06/06/2005"), main = 'Females 2005', 
> ylab = 'Age/Days', xlab = 'Birth/Hatch date')
>
> Many thanks
> Vasana
> Sent from Mail for Windows 10
>
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R-sig-Geo] How do i plot a graph with x axis vertically labelled?

2018-08-13 Thread Christopher W Ryan
Vasana--

May I ask why you want to produce such a graph? What relationship(s) in
your data are you trying to show?  I can't be sure from your original post,
but it seems to me that you are trying to do this the hard way.  R can help
you.

What happens when you run the code you posted? What error message do you
get, if any?

Your birthdates are not just nominal labels; they contain more information
than that--specifically, they are ordered, with certain elapsed duration
between them. Using them merely as names/labels on bars sacrifices
information. Also, if you don't have an observation for every birthdate in
a sequence of dates, then you will represent unequally-spaced dates with
equally-spaced bars--generally not a good thing. Conversely, could any of
your birthdates ever be duplicated?

Vertically-oriented bar labels can be difficult for your intended audience
to read, especially since you seem to want to put 30-40 of them along the
horizontal axis. Another option would be to flip your graph, putting
birthdates on the vertical axis so the date labels can be horizontal.

Here is a minimal working example to demonstrate one possible solution that
you might be able to modify to convey what you are trying to convey, and
that let's R do the work it is good at.

## generate some data
dd <- data.frame( birth = Sys.Date() + sort(sample(1:10, 6, replace =
TRUE)),  sex = factor(sample(c("M", "F"), 6, replace = TRUE)), age =
sample(1:9, 6, replace = TRUE) )
## show the data
dd
str(dd)
## a plot
 with(dd, plot(age ~ birth, type = "h"))

--Chris Ryan

On Mon, Aug 13, 2018 at 6:24 AM, Vasana Tutjavi via R-sig-Geo <
r-sig-geo@r-project.org> wrote:

> Dear R-sig-geo experts,
>
> I want to plot a bar graph with the labels on the x axis in a vertical
> format. The data is the Ages of Squid (on the Y axis) and the date of Birth
> on the X axis, I am struggling to change the labels on the x axis to a
> vertical format and I want all the dates to show at all the bars. My data
> is as follows:
> Birth
> Sex
> Age
> 25/08/2004
> F
> 2
> 26/09/2004
> F
> 3
> 02/11/2004
> F
> 3
> 11/11/2004
> F
> 1
> 22/11/2004
> F
> 3
> 04/12/2004
> F
> 1
> 08/12/2004
> F
> 4
> 15/12/2004
> F
> 4
> 21/12/2004
> F
> 5
> 24/12/2004
> F
> 1
> 04/01/2005
> F
> 1
> 06/01/2005
> F
> 3
> 13/01/2005
> F
> 2
> 18/01/2005
> F
> 1
> 19/01/2005
> F
> 3
> 09/02/2005
> F
> 2
> 11/02/2005
> F
> 1
> 13/02/2005
> F
> 1
> 17/02/2005
> F
> 1
> 18/02/2005
> F
> 8
> 19/02/2005
> F
> 5
> 24/02/2005
> F
> 1
> 28/02/2005
> F
> 42
> 01/03/2005
> F
> 1
> 07/03/2005
> F
> 1
> 08/03/2005
> F
> 2
> 09/03/2005
> F
> 1
> 14/03/2005
> F
> 7
> 16/03/2005
> F
> 1
> 25/03/2005
> F
> 3
> 01/04/2005
> F
> 1
> 06/04/2005
> F
> 5
> 07/04/2005
> F
> 1
> 08/04/2005
> F
> 1
> 13/04/2005
> F
> 1
> 14/04/2005
> F
> 1
> 27/04/2005
> F
> 1
> 01/05/2005
> F
> 2
> 07/05/2005
> F
> 1
> 08/05/2005
> F
> 2
> 16/05/2005
> F
> 1
> 30/05/2005
> F
> 8
> 06/06/2005
> F
> 1
> Here is the script I tried:
>
> barplot(Females2005$Age,  names.arg = c("25/08/2004", "26/09/2004",
> "02/11/2004", "11/11/2004", "22/11/2004", "04/12/2004", "08/12/2004",
>"15/12/2004", "21/12/2004",
> "24/12/2004", "04/01/2005", "06/01/2005", "13/01/2005", "18/01/2005",
>"19/01/2005", "09/02/2005",
> "11/02/2005", "13/02/2005", "17/02/2005", "18/02/2005", "19/02/2005",
>   "24/02/2005", "28/02/2005",
> "01/03/2005", "07/03/2005", "08/03/2005", "09/03/2005", "14/03/2005",
> "16/03/2005", "25/03/2005",
> "01/04/2005", "06/04/2005", "07/04/2005", "08/04/2005", "13/04/2005",
>   "14/04/2005", "27/04/2005",
> "01/05/2005", "07/05/2005", "08/05/2005", "16/05/2005", "30/05/2005",
> "06/06/2005"), main = 'Females 2005',
> ylab = 'Age/Days', xlab = 'Birth/Hatch date')
>
> Many thanks
> Vasana
> Sent from Mail for Windows 10
>
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

[[alternative HTML version deleted]]

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


Re: [R-sig-Geo] [localmoran.exact]

2018-08-13 Thread Roger Bivand

On Mon, 13 Aug 2018, Lisa Menez wrote:



Dear all,

I have been trying to obtain local Moran’s I with the exact approach 
(localmoran.exact) but I have some issues and would need your help.


A complete reproducible example is required (script and data, data may be 
downloaded, do not attach). Does the same thing happen with 
localmoran.sad()?




I am trying to bring to light how spatial patterns of wealth have 
evolved from 2000 to 2016 in the European Union.


Looking at the Regional Gross Domestic Product (GDP) of European regions, my lm 
model looks like this :

lm(log(EU_NUTS@data[,year[i]])~1+factor(EU_NUTS@data$NUTS_L1))

where log(EU_NUTS@data[,year[i]]) are log of regional GDPs



Never, ever use @ to access data. EU_NUTS@data$NUTS_L1 should be 
EU_NUTS$NUTS_L1 and should be (made a) factor first. It isn't clear what 
log(EU_NUTS@data[,year[i]]) will end up being - is "year" a character 
vector? If so, EU_NUTS[[year[i]]] is the correct syntax.



and factor(EU_NUTS@data$NUTS_L1) is the vector of country dummies.

Sadly, I obtain an error message that says :

Error in integrate(integrand, lower = 0, upper = upper) :
 a limit is missing
Moreover : Warning messages:
1: In sqrt(2 * t2 - t1^2) : production of NaN
2: In sqrt(2 * t2 - t1^2) : production of NaN

According to the GitHub source code ,


No, as you can see from https://cran.r-project.org/package=spdep, the 
development site of spdep is https://github.com/r-spatial/spdep/. Never 
use non-authorised copies. To see the source, simply type the function 
name. Use debug(localmoran.exact) to step through the function while it 
runs, to see the values of the objects you are in doubt about. Do not do 
this in RStudio, its debugging interface tries to be far too clever.


The following is illegible in plain text; post in plain text only.

Roger



   Vi <- listw2star (B, 
select[i], style=style, n, D , a,
zero.policy=zero.policy)
   Viu <- lag.listw (Vi, u, 
zero.policy=TRUE )
Ii <- c (crossprod 
(u, Viu) / utu)
   ViX <- lag.listw (Vi, X, 
zero.policy=TRUE )
   MViM <- t (X) %*% ViX %*% XtXinv
   t1 <- -sum (diag 
(MViM))
   sumsq.Vi <- function (x) {
   if  (is.null 
(x)) NA 
else  sum 
(x^2)
}
trVi2 <- sum (sapply 
(Vi$weights , 
sumsq.Vi), na.rm=TRUE )
t2a <- sum (diag 
(t (ViX) %*% ViX %*% 
XtXinv))
t2b <- sum (diag 
(MViM %*% MViM))
t2 <- trVi2 - 2*t2a + t2b
e1 <- 0.5 * (t1 + sqrt (2*t2 - 
t1^2))
en <- 0.5 * (t1 - sqrt (2*t2 - 
t1^2))

My guess is that my setting causes (2*t2http://hcc.cnrs.fr/wp-content/uploads/2018/08/mydata2018-1.txt 

and my code : http://hcc.cnrs.fr/wp-content/uploads/2018/08/myCode_2018.txt 


I thank you very much for your attention and your help.

Best Regards
Lisa

PhD Student
GREDEG, Université Côté d’Azur






[[alternative HTML version deleted]]

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



--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: roger.biv...@nhh.no
http://orcid.org/-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0J=en___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] [localmoran.exact]

2018-08-13 Thread Lisa Menez


Dear all, 

I have been trying to obtain local Moran’s I with the exact approach 
(localmoran.exact)
 but I have some issues and would need your help. 

I am trying to bring to light how spatial patterns of wealth have evolved from 
2000 to 2016 in the European Union. 

Looking at the Regional Gross Domestic Product (GDP) of European regions, my lm 
model looks like this : 

lm(log(EU_NUTS@data[,year[i]])~1+factor(EU_NUTS@data$NUTS_L1))

where log(EU_NUTS@data[,year[i]]) are log of regional GDPs

and factor(EU_NUTS@data$NUTS_L1) is the vector of country dummies.

Sadly, I obtain an error message that says : 

Error in integrate(integrand, lower = 0, upper = upper) : 
  a limit is missing
Moreover : Warning messages:
1: In sqrt(2 * t2 - t1^2) : production of NaN
2: In sqrt(2 * t2 - t1^2) : production of NaN 

According to the GitHub source code , 

Vi <- listw2star 
(B, select[i], style=style, 
n, D , a,
zero.policy=zero.policy)
Viu <- lag.listw (Vi, u, 
zero.policy=TRUE )
Ii <- c (crossprod 
(u, Viu) / utu)
ViX <- lag.listw (Vi, X, 
zero.policy=TRUE )
MViM <- t (X) %*% ViX %*% XtXinv
t1 <- -sum (diag 
(MViM))
sumsq.Vi <- function (x) {
if  (is.null 
(x)) NA 
else  sum 
(x^2)
}
trVi2 <- sum (sapply 
(Vi$weights 
, sumsq.Vi), na.rm=TRUE 
)
t2a <- sum (diag 
(t (ViX) %*% 
ViX %*% XtXinv))
t2b <- sum (diag 
(MViM %*% MViM))
t2 <- trVi2 - 2*t2a + t2b
e1 <- 0.5 * (t1 + sqrt (2*t2 - 
t1^2))
en <- 0.5 * (t1 - sqrt (2*t2 - 
t1^2))

My guess is that my setting causes (2*t2http://hcc.cnrs.fr/wp-content/uploads/2018/08/mydata2018-1.txt 

and my code : http://hcc.cnrs.fr/wp-content/uploads/2018/08/myCode_2018.txt 


I thank you very much for your attention and your help. 

Best Regards
Lisa 

PhD Student
GREDEG, Université Côté d’Azur 






[[alternative HTML version deleted]]

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


[R-sig-Geo] Question: How to parametrize rstoolbox for radCor operations of ASTERLB1 data

2018-08-13 Thread vonubu1100--- via R-sig-Geo
 
Hello good morning learned community of specialists. I would be glad to receive 
some guidance or code snippets to help me carry out radCor operations on 
ASTERLB1 data.
Thank you so much.On Monday, August 13, 2018, 6:06:32 PM GMT+8, 
r-sig-geo-requ...@r-project.org  wrote:  
 
 Send R-sig-Geo mailing list submissions to
    r-sig-geo@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
    https://stat.ethz.ch/mailman/listinfo/r-sig-geo
or, via email, send a message with subject or body 'help' to
    r-sig-geo-requ...@r-project.org

You can reach the person managing the list at
    r-sig-geo-ow...@r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-Geo digest..."


Today's Topics:

  1. Autocorrelation and stationarity in spatio temporal data
      (Bruno Sesti)

--

Message: 1
Date: Sun, 12 Aug 2018 17:45:31 +0200
From: Bruno Sesti 
To: r-sig-geo@r-project.org
Subject: [R-sig-Geo] Autocorrelation and stationarity in spatio
    temporal data
Message-ID:
    
Content-Type: text/plain; charset="utf-8"

Hi, I am working with spatio temoral data and I am experimenting spatio
temporal data analysis and interpolation. I would like to ask if there is
some technique/package/function in R to check if irregilar spatio temporal
data, in particolar air quality spatio temporal data from mobile sensors,
are stationary (second order stationary or intrinsic stationary) and if the
shows some form of (auto)correlation.

Kind regards.

    [[alternative HTML version deleted]]




--

Subject: Digest Footer

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


--

End of R-sig-Geo Digest, Vol 180, Issue 10
**
  
[[alternative HTML version deleted]]

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


[R-sig-Geo] How do i plot a graph with x axis vertically labelled?

2018-08-13 Thread Vasana Tutjavi via R-sig-Geo
Dear R-sig-geo experts, 

I want to plot a bar graph with the labels on the x axis in a vertical format. 
The data is the Ages of Squid (on the Y axis) and the date of Birth on the X 
axis, I am struggling to change the labels on the x axis to a vertical format 
and I want all the dates to show at all the bars. My data is as follows:
Birth
Sex
Age
25/08/2004
F
2
26/09/2004
F
3
02/11/2004
F
3
11/11/2004
F
1
22/11/2004
F
3
04/12/2004
F
1
08/12/2004
F
4
15/12/2004
F
4
21/12/2004
F
5
24/12/2004
F
1
04/01/2005
F
1
06/01/2005
F
3
13/01/2005
F
2
18/01/2005
F
1
19/01/2005
F
3
09/02/2005
F
2
11/02/2005
F
1
13/02/2005
F
1
17/02/2005
F
1
18/02/2005
F
8
19/02/2005
F
5
24/02/2005
F
1
28/02/2005
F
42
01/03/2005
F
1
07/03/2005
F
1
08/03/2005
F
2
09/03/2005
F
1
14/03/2005
F
7
16/03/2005
F
1
25/03/2005
F
3
01/04/2005
F
1
06/04/2005
F
5
07/04/2005
F
1
08/04/2005
F
1
13/04/2005
F
1
14/04/2005
F
1
27/04/2005
F
1
01/05/2005
F
2
07/05/2005
F
1
08/05/2005
F
2
16/05/2005
F
1
30/05/2005
F
8
06/06/2005
F
1
Here is the script I tried:

barplot(Females2005$Age,  names.arg = c("25/08/2004", "26/09/2004", 
"02/11/2004", "11/11/2004", "22/11/2004", "04/12/2004", "08/12/2004", 
   "15/12/2004", "21/12/2004", 
"24/12/2004", "04/01/2005", "06/01/2005", "13/01/2005", "18/01/2005",
   "19/01/2005", "09/02/2005", 
"11/02/2005", "13/02/2005", "17/02/2005", "18/02/2005", "19/02/2005", 
  "24/02/2005", "28/02/2005", "01/03/2005", 
"07/03/2005", "08/03/2005", "09/03/2005", "14/03/2005", 
"16/03/2005", "25/03/2005", "01/04/2005", 
"06/04/2005", "07/04/2005", "08/04/2005", "13/04/2005", 
  "14/04/2005", "27/04/2005", "01/05/2005", 
"07/05/2005", "08/05/2005", "16/05/2005", "30/05/2005", 
"06/06/2005"), main = 'Females 2005', ylab 
= 'Age/Days', xlab = 'Birth/Hatch date')

Many thanks
Vasana
Sent from Mail for Windows 10


[[alternative HTML version deleted]]

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