Displaying 20 results from an estimated 10000 matches similar to: "Function to find angle between coordinates?"
2009 Jan 26
2
RCurl unable to download a particular web page -- what is so special about this web page?
Dear R-help,
There seems to be a web page I am unable to download using RCurl. I
don't understand why it won't download:
> library(RCurl)
> my.url <- "http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html?_r=2"
> getURL(my.url)
[1] ""
Other web pages are ok to download but this is the first time I have
been unable to download a
2009 Sep 09
2
How to sum and group data by DATE in data frame
Dear all,
Lets say I have a data frame as follows:
> Date <- as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13', '2006-09-20'))
> Income <- c(73.79, 72.46, 76.32, 72.43, 72.62)
> data.frame(Date, Income)
Date Income
1 2006-08-23 73.79
2 2006-08-30 72.46
3 2006-09-06 76.32
4 2006-09-13 72.43
5 2006-09-20 72.62
>
2018 Jan 30
2
Calculating angle of a polyline
Assuming your polyline is defined by two vectors, one for the x
coordinates, one for the y coordinates, you can try the following
library(NISTunits)
polyangles <- function(xV,yV) {
stopifnot( (length(xV)==length(yV)) && (length(xV) >= 3))
v <- function(i) { c( xV[i]-xV[i-1], yV[i]-yV[i-1])}
vlen <- function(v) { sqrt(sum(v*v)) }
lV <- rep(NA_real_,length(xV))
for
2018 Jan 30
2
Calculating angle of a polyline
Dear R users
I am trying to find a formula to calculate the angle of a polyline. Is
there a way to do this?
Many thanks.
--
Best Regards
Javad Bayat
M.Sc. Environment Engineering
Alternative Mail: bayat194 at yahoo.com
[[alternative HTML version deleted]]
2018 Jan 30
0
Calculating angle of a polyline
A polyline by definition has many angles, so your question is ill-formed. And this is a question about math, not R, so is off topic here. I suggest reading Wikipedia.
--
Sent from my phone. Please excuse my brevity.
On January 29, 2018 11:10:02 PM PST, javad bayat <j.bayat194 at gmail.com> wrote:
>Dear R users
>I am trying to find a formula to calculate the angle of a polyline. Is
2018 Jan 30
0
Calculating angle of a polyline
I like to use complex numbers for 2-dimensional geometry. E.g.,
> polyAngles2
function (xV, yV)
{
stopifnot((length(xV) == length(yV)) && (length(xV) >= 3))
z <- complex(re = xV, im = yV)
c(NA, diff(Arg(diff(z))), NA) # radians, positive is counter-clockwise
}
> x <- c(0:3)
> y <- c(0,0,1,1)
> polyAngles2(x,y) / pi * 180
[1] NA 45 -45 NA
Bill
2009 Oct 22
2
How to find moving averages within each subgroup of a data frame
Dear all,
If I have the following data frame:
> set.seed(21)
> df1 <- data.frame(col1=c(rep('a',5), rep('b',5), rep('c',5)), col4=rnorm(1:15))
col1 col4
1 a 0.793013171
2 a 0.522251264
3 a 1.746222241
4 a -1.271336123
5 a 2.197389533
6 b 0.433130777
7 b -1.570199630
8 b -0.934905667
9 b 0.063493345
10 b
2008 Nov 15
1
Using n+1 instances of R to utilise n processors on one machine - something like R with tabbed browsing?
Dear R-help,
Please forgive me if any of the following sounds naieve/confused, i've
just got back from a mini-pub-crawl, slightly tipsy, and am feeling
brave to ask a possibly silly question... also, not to shiny on the
technical side of things.
Problem - I need to text mine a collection of 10,000 plain text
documents, all of which are sitting in a single folder. i don't have
any money
2012 Oct 08
1
3d polar coordinates in rgl function view3d()
Dear all:
I'm enjoying using rgl and I want to set a specific viewpoint.
I understand that view3d() will do so by setting the 3d polar
coordinate angles, theta and phi.
In standard polar coordinates, theta is the angle away from the X axis
in the X-Y plane and phi (inclination angle) is the angle between the
Z axis and the radius vector
It appears that when you use view3d() theta is
2005 Apr 14
1
Strange behavior of atan2
Dear all,
I've got a problem with the function atan2. For a couple of coordinates
x and y,
This function returns the angle between the vector of coordinates (x, y)
and the
abscissa axis, i.e. it is the same as atan(y/x) (as indicated on the
help page).
If we consider the vector with coordinates x = 0 and y = 0, we have
the following result:
> atan(0/0)
[1] NaN
This is expected.
2012 Dec 31
2
code to convert 3D geographical coordinates to Cartesian?
Is there packaged code to convert geographical coordinates (e.g.,
longitude, latitude, elevation) to Cartesian coordinates in 3-space?
I can see how to do this using
1. a spherical-to-Cartesian conversion like pracma::sph2cart(tpr)
http://cran.r-project.org/web/packages/pracma/
2. a geographical-to-spherical conversion. This seems to involve (in
roughly increasing order of difficulty or
2010 Mar 19
1
Howto get unnormalized eigenvectors?
Hi,
I try to calculate the angle between two first eigenvectors of different covariance matrices of biological phenotypic traits for different populations. My issue here is, that all possibilities to do so seem to normalize the eigenvectors to length 1. Although the helpfile of eigen() states, that using eigen(, symmetric = FALSE, EISPACK =TRUE) skips normalization this is (I guess) not applicable
2017 Jun 21
2
3D plot with coordinates
Thanks a lot for the reply.After ?looking at different parts of the code today I was able to start with simple 2D polar plots as the attached pdf file. ?In case the attachment is not visible I used the plot.polar function to create something like that.https://vijaybarve.files.wordpress.com/2013/04/polarplot-05.png
Now the idea now will be to put three of those (for X,Y,Z) in a 3d rotatable plane.
2010 Jun 03
1
plot polar coordinates
Hi,
I'd like to plot in in polar coordinates a line which is given as a
vector of lengths and angles.
library("plotrix")
2017 Jun 21
0
3D plot with coordinates
On 21/06/2017 5:23 AM, Alaios via R-help wrote:
> Thanks a lot for the reply.After looking at different parts of the code today I was able to start with simple 2D polar plots as the attached pdf file. In case the attachment is not visible I used the plot.polar function to create something like that.https://vijaybarve.files.wordpress.com/2013/04/polarplot-05.png
> Now the idea now will be
2017 Jun 21
2
3D plot with coordinates
Thanks Duncan for the replyI can not suppress anything these are radiation pattern measurements that are typically are taken at X,Y and Z planes. See an example here, where I want to plot the measurements for the red, green and blue planes (so the image below withouth the 3d green structure inside)https://www.researchgate.net/publication/258391165/figure/fig7/AS:322947316240401 at
2007 May 29
2
pie initial angle
Dear all,
I'd like to produce a simple pie chart for a customer (I know it's bad but
they insist), and I have some difficulties setting the initial angle.
For example:
pie(c(60, 40), init.angle=14)
and
pie(c(80, 20), init.angle=338)
both present the slices in the same direction, where:
pie(c(60, 40))
pie(c(80, 20))
present the slices in different directions.
I read everything I
2016 Apr 28
0
polygon angle option perpendicular to axis
Tena koe Simon
plot(1:10, 1:10, type='n')
polygon(c(2,3,6,8), c(2,5,5,3), density=20, angle=90)
polygon(c(2,3,6,8), 5+c(2,5,5,3), density=20, angle=0)
I don't understand your problem. Perhaps if you "provide[d] commented, minimal, self-contained, reproducible code" it would help.
HTH ....
Peter Alspach
-----Original Message-----
From: R-help [mailto:r-help-bounces at
2016 Apr 28
0
polygon angle option perpendicular to axis
Filling polygons with lines is a throwback to the time when the height
of quality graphics was the mechanical pen plotter (a device that used
a pen in a mechanical arm to draw the plot on a piece of paper).
Computing and printing technology has advanced quite a bit from that
day, so you may want to reconsider why you want polygons filled with
lines instead of just a solid color (and I consider
2002 Mar 21
1
legend - bug with argument angle (PR#1404)
When legend() is used with the angle argument as follows, not only the
boxes beside the legend text, but also the whole legend box is filled
with shading lines.
I think this is not intended:
plot(1:10)
legend(8, 4, c("A", "B"), angle=c(10, 80), fill=NULL, density=20)
I'd suggest as a fix (legend.R of R-1.5.0):
25c25
< rect2 <- function(left, top, dx, dy,