Displaying 20 results from an estimated 3000 matches similar to: "Could R help with locating coordinates in a serial manner?"
2012 Jul 02
2
Constructing a list using a function...
Hi All
I have a dataframe:
myframe<-data.frame(ID=c("first","second"),x=c(1,2),y=c(3,4))
And I have a function myfun:
myfun<-function(x,y) x+y
I would like to write a function myfun2 that takes myframe and myfun
as parameters and returns a list as below:
mylist
$first
[1] 4
$second
[2] 6
Could you please help me with this? Doesn't seem like the
2012 Jun 10
3
Data.frames can not hold objects...What can be done in the following scenario?
R-Help community,
I understand that data.frames can hold elements of type double, string
etc but NOT objects (such as a matrix etc). This is not convenient for
me in the following situation. I have a function that takes 2 inputs
and returns a vector:
testfun <- function (x,y) seq(x,y,1)
I have a data.frame defined as follows:
testframe<-data.frame(xvalues=c(2,3),yvalues=c(4,5))
I would
2012 Jun 16
2
A basic design question for R
Hello R Community,
I have the following design question. I have a data set that looks
like this (shortened for the sake of example).
Gender Age
M 70
F 65
M 70
Each row represents a person with an age/gender combination. We could
put this data into a data frame.
Now, I would like to do some actuarial analysis on this data set. To
do so, I need to create and store
2012 Jun 09
1
Applying a function to a column of a data frame
Apologees the novice question. Currently climbing up the learning curve of R.
Suppose I have the following function and the data.frame:
testfun<-function(x=1,y=2) x+y
testframe=data.frame(col1=c(1,2),col2=c(3,4))
When evaluating testfun, I want to use the default value for y (which
is 2) and for x, I want to feed (one by one) the values in col2 of
testframe. How can I achieve this please?
2010 Oct 10
2
Mapping the coordinates!
Hello,
I have a series of coordinates
(latitudes and longitudes) each one/several associated to a code
(from 1 to 28). I used function points (latitude, longitudes) to
transfer them to a per-prepared map.
1- I wonder how I might be able to
automatically add codes (1-28) to the map too?
2-Moreover, mostly there are a few
codes from the identical coordinates. What is the function to
2018 May 22
0
How to average values from grid cells with coordinates
Hi Jim,
Thanks. It works. I now have more complex problems. If at each blackcell,
there are two variables such as pop and mood. For each variable, there are
daily records in one year, so 365 records for pop and 365 records for mood.
The averaged values for the redcells should be daily records too. What kind
of format do you recommend for this problem? Right now, I just get the
latitudes and
2008 Feb 18
2
how to plot image() without painting a map (the background)
Hello,
I'm trying to plot dayly evolution of the temperature over France from
Global Forecast System files ("I'm trying" is the right expression...).
akilonlat03 is the temperature for different latitudes and longitudes ? 3
o'clock.
akilonlat06 is the temperature for different latitudes and longitudes ? 6
o'clock.
I would like to plot akilonlat03 and then akilonlat06
2006 Apr 04
1
imaging and contouring
Dear R'Helpers and Colleagues,
I have looked in the documentation, asked to some colleagues in the
lab, but was unable to solve the following difficulty.
I am running R on a iMac G5 with OS 10.4.
The file below (73 rows x 144 col) shows the values of a climatic
index on the globe with a grid of 2,5 ? x 2,5 ? (NA = no value):
?
With image() and map() and running the following
2003 Jul 30
3
nested for() loops for returning a nearest point
I'm trying to do the following:
For each ordered pair of a data frame (D1) containing longitudes and
latitudes and unique point IDs, calculate the distance to every point in
another data frame (D2) also containing longitudes, latitudes and point
IDs, and return to a new variable in D1 the point ID of the nearest
element of D2.
Dramatis personae (mostly self-explanatory):
D1$long
2018 May 20
1
How to average values from grid cells with coordinates
Hi lily,
It's not too hard to do it using dataframes. Getting the indexing
right is usually that hardest part:
# these values are the centers of the black cells
lat<-rep(28:38,11)
lon<-rep(98:108,each=11)
pop<-sample(80:200,121)
# just use the data.frame function
blackcells<-data.frame(lat=lat,lon=lon,pop=pop)
plot(0,type="n",xlim=c(97.5,108.5),ylim=c(27.5,38.5),
2011 Aug 04
3
persp()
Hello
I am trying to draw a basic black and white map of two European countries.
After searching some key words in google and reading many pages I arrived to the conclusion that persp() could be used to draw that map.
I have prepared three small example files, which are supposed to be the files required for running that function.
xvector is a vector with the longitudes
yvector is a vector with
2012 Jun 05
2
Converiting longitude/latitude to utm
Dear all,
I have been trying to convert coordinates from longitude/latitude to utm
but I got an error. As soon as the longitude coordinate is greater than 90,
I get the folloowing error message: "error in pj_transform: latitude or
longitude exceeded limits"
Here is what I did:
SP<-SpatialPoints(cbind(126.59,-14.30),proj4string=CRS("+proj=longlat"))
2013 Apr 10
1
problem with the image command
Hello R-users,
I am trying to do an image plot where I have been given latitudes,
longitudes and the values at the corresponding locations. A sample of the
data is given as follows:
values=c(0,1,0,0,0,0,2,2,0,0)
lat=c(29.6660,29.6756,29.3492,29.2654,29.2827,29.4070,35.3510,35.6590,35.7587,38.2794)
2011 Jul 14
1
Error: "non-numeric argument to binary operator"
Hi
I am posting in the topic related to the "non-numeric argument to binary
operator" as I got similar problem while running the netcdf code. I have
attached the file with this post. It is a climate data from NOAA site. The code
follows as:
library(survival)
library(RNetCDF)
library(ncdf)
setwd("c:/projects/netcdfcsfiles")
Conn42 =
2017 Jun 01
3
Reversing one dimension of an array, in a generalized case
> On 1 Jun 2017, at 22:42, Roy Mendelssohn - NOAA Federal <roy.mendelssohn at noaa.gov> wrote:
>
> Thanks to all for responses/. There was a question of exactly what was wanted. It is the generalization of the obvious example I gave,
>
>>>> junk1 <- junk[, rev(seq_len(10), ]
>
>
> so that
>
> junk[1,1,1 ] = junk1[1,10,1]
> junk[1,2,1] =
2001 Feb 12
2
OziExplorer works on LINUX using WINE
I've succeeded in running the wonderful charting program
OziExplorer (3.85.3c), http://www.oziexplorer.com/ , on
LINUX (RedHat 6.2) using WINE 20010112. The times to load
the program and to load a map did take 5 to 8 times longer
using WINE than they did using WIN95. I was able to enable
the serial port and have the position computed by my GPS
displayed on the chart.
OziExplorer is a
2011 Jul 07
1
Select element out of several ncdf variables
Hi there
I'm working with ncdf data. I have different dataset for 4 runs, 4 seasons
and 3 timeslices (48 datasets in total). The datasets have the following
dimensions: 96 longitudes, 48 latitudes and 30 time steps. To read all of
them in, I wrote the following loop:
runs <- c("03","04","05","06")
years <- c(1851,1961,2061)
seasons <-
2009 Jun 21
1
Problems with bilinear interpolation of a grid
Dear all,
I'm having trouble interpolating a number of gridded datasets that I have. I'm quite new to R so any help/advice that can be offered would be much appreciated!
Firstly I'll describe my dataset. The data is a grid of the planet at 1 degree spatial resolution, with each grid cell containing a value describing a particular variable (e.g. population density) for coordinate
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
On the off chance that anyone is still interested, here is the corrected function using aperm():
z <- array(1:120,dim=2:5)
f2 <- function(a, wh) {
idx <- seq_len(length(dim(a)))
dims <- setdiff(idx, wh)
idx <- append(idx[-1], idx[1], wh-1)
aperm(apply(a, dims, rev), idx)
}
all.equal(f(z, 1), f2(z, 1))
# [1] TRUE
all.equal(f(z, 2), f2(z, 2))
# [1] TRUE
2012 Nov 18
2
[lattice] format and rotation of strip text
Thanks to the lattice gurus on this list, and having reference to the
excellent open-access Sarkar 2008
ISBN 978-0-387-75968-5
e-ISBN 978-0-387-75969-2
http://dx.doi.org/10.1007/978-0-387-75969-2
I now know how to label lattice panels by variable value: see thread
starting @
https://stat.ethz.ch/pipermail/r-help/2012-November/329450.html
(and demonstrated below). This allows me to use