Dear Milu,
If your objective is to match the places from one table to the nearest
place in the second table, you can generally use knn algorithm for 1
nearest neighbourhood.
But please, check what David suggests first.
Best regards,
Michal
2016-10-16 19:24 GMT+02:00 David Winsemius
> On Oct 16, 2016, at 6:32 AM, Miluji Sb wrote:
>
> Dear all,
>
> I have two dataframe 1 by latitude and longitude but they always do not
> match. Is it possible to merge them (e.g. nearest distance)?
>
> # Dataframe 1
> structure(list(lat = c(54L, 55L, 51L, 54L, 53L, 50L,
Dear all,
I have two dataframe 1 by latitude and longitude but they always do not
match. Is it possible to merge them (e.g. nearest distance)?
# Dataframe 1
structure(list(lat = c(54L, 55L, 51L, 54L, 53L, 50L, 47L, 51L,
49L, 54L), lon = c(14L, 8L, 15L, 7L, 6L, 5L, 13L, 5L, 13L, 11L
), PPP2000_40
Hello dear R-helpers,
I'm working with R-2.15.2 on Windows 7 OS. I'm stucked with a merge of two
data frames by characters.
In each data frame I got two different list of names, that is my main-key to
be merged.
To figure out what I'm saying, I build up a modified ?merge example, with
errors by
You might try the 'soundex' function in the RecordLinkage package:
soundex('ripley')
[1] R140
soundex('rippley')
[1] R140
soundex('venable')
[1] V514
soundex('venables')
[1] V514
soundex('terney')
[1] T650
soundex('tierney')
[1] T650
On Fri, Nov 2, 2012 at 2:20 PM, VictorDelgado
On Nov 2, 2012, at 11:20 AM, VictorDelgado wrote:
Hello dear R-helpers,
I'm working with R-2.15.2 on Windows 7 OS. I'm stucked with a merge of two
data frames by characters.
In each data frame I got two different list of names, that is my main-key to
be merged.
To figure out what I'm
David Winsemius wrote
On Nov 2, 2012, at 11:20 AM, VictorDelgado wrote:
Hello dear R-helpers,
I'm working with R-2.15.2 on Windows 7 OS. I'm stucked with a merge of
two
data frames by characters.
In each data frame I got two different list of names, that is my main-key
to
be merged.
Dear all,
I have some device measurements and the time stamps I get from it have the
below format:
MyStruct$TimeStamps[1,]
[1] 2011.000 10.000 6.000 16.000 23.000 30.539
I can convert them easily with ISOdate() to a number and do the calculations I
need.
One of my problems is that
On Oct 10, 2011, at 1:28 PM, Alaios wrote:
Dear all,
I have some device measurements and the time stamps I get from it
have the below format:
MyStruct$TimeStamps[1,]
[1] 2011.000 10.0006.000 16.000 23.000 30.539
I can convert them easily with ISOdate() to a number and do the
Thanks to both of you for your help!
Jim, my problem is to match some observations of a time serie (vector 'a' in
my example) with theoretical predictions of this process (vector 'b' in my
example), with a small time lag between them.
--
View this message in context:
Dear All,
Debuting in R, I'm facing a problem.
I have 2 vectors, say 'a' et 'b', and I'd like to merge them according to
the proximity of their variable 'time'.
How to do to keep elements which satisfy (for example) 'a$time-b$time0.5'?
For example :
a
time x
1 1.0 4
2 2.2 5
3 5.2 6
b
On Mar 12, 2011, at 4:14 PM, flymer wrote:
Dear All,
Debuting in R, I'm facing a problem.
I have 2 vectors, say 'a' et 'b', and I'd like to merge them
according to
the proximity of their variable 'time'.
How to do to keep elements which satisfy (for example) 'a$time-b
$time0.5'?
For
use the sqldf package:
require(sqldf)
a
time x
1 1.0 4
2 2.2 5
3 5.2 6
b
time y
10 1
21 3
32 5
44 7
55 9
sqldf(
+ select a.time, a.x, b.y
+ from a, b
+ where abs(a.time - b.time) 0.5
+ )
time x y
1 1.0 4 3
2 2.2 5 5
3 5.2 6 9
On Sat,
Hello Nasrin,
Please attach how each of your files look like (their first few rows), so we
could understand why the rbind doesn't work.
In general, be sure to keep the r-help e-mail also corresponded so others
might help if I don't know the answer (or if they answer before me).
Best,
Tal
Hello;
I have a problem merging data sets. I use this command:
FileNames - list.files(path=C:/updated_CFL_Rad_files/2007/11,
full.names=TRUE)
dataMerge - data.frame()
for(f in FileNames){
+ ReadInMerge - read.csv(file=f, header=T, na.strings=NULL)
+ dataMerge - merge(dataMerge,
Hello Nasrin,
I think you might be wanting to use
rbind
instead of
merge
Contact
Details:---
Contact me: tal.gal...@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
df1 -- dataframe with column date and several other columns. #rows 40k
Several of the dates are repeated.
df2 -- dataframe with two columns date and index. #rows ~130 This is really a
map from date to index.
I would like to create a column called index in df1 which has the corresponding
On Nov 10, 2009, at 12:36 PM, Chuck White wrote:
df1 -- dataframe with column date and several other columns. #rows
40k Several of the dates are repeated.
df2 -- dataframe with two columns date and index. #rows ~130 This
is really a map from date to index.
I would like to create a
David -- thank you for your response.
merge does work but it creates another dataframe. df1 is very large and I did
not want another copy created. What I ended up doing is:
df1 - merge(df1, df2, by=week)
In terms of memory allocation, will memory for two dataframes be allocated or
will the
On 2009-September-11 , at 13:55 , wrote:
Maybe:
do.call(rbind, lapply(with(xy - rbind(x, y), split(xy, list(a, b),
drop = TRUE)), tail, 1))
On Fri, Sep 11, 2009 at 3:45 AM, jo jo.li...@gmail.com wrote:
Thanks for the post-processing ideas. But is there any way to do that
in one step?
No you cannot. You may want to write a merge function with the special
capability but there is no better way than the one suggested by
Henrique.
On Sep 14, 12:18 pm, JiHO jo.li...@gmail.com wrote:
On 2009-September-11 , at 13:55 , wrote:
Maybe:
do.call(rbind, lapply(with(xy - rbind(x,
Thanks for the post-processing ideas. But is there any way to do that
in one step?
On Thu, Sep 10, 2009 at 7:20 PM, Henrique Dallazuanna www...@gmail.com wrote:
Try this:
xy - merge(x, y, by = c(a,b),all = TRUE)
xy$c - ifelse(rowSums(!is.na(.x - xy[, c('c.x', 'c.y')])) 1, .x[,1],
Maybe:
do.call(rbind, lapply(with(xy - rbind(x, y), split(xy, list(a, b), drop =
TRUE)), tail, 1))
On Fri, Sep 11, 2009 at 3:45 AM, jo jo.li...@gmail.com wrote:
Thanks for the post-processing ideas. But is there any way to do that
in one step?
On Thu, Sep 10, 2009 at 7:20 PM, Henrique
Hello everyone,
My problem is better explained with an example:
x=data.frame(a=1:4,b=1:4,c=rnorm(4))
x
a b c
1 1 1 -0.8821089
2 2 2 -0.7082583
3 3 3 -0.5948835
4 4 4 -1.8571443
y=data.frame(a=c(1,3),b=3,c=rnorm(2))
y
a bc
1 1 3 -0.273155973
2 3 3 0.009517862
Now I
Try this:
xy - merge(x, y, by = c(a,b),all = TRUE)
xy$c - ifelse(rowSums(!is.na(.x - xy[, c('c.x', 'c.y')])) 1, .x[,1],
rowSums(.x, na.rm = TRUE))
xy
On Thu, Sep 10, 2009 at 12:21 PM, JiHO jo.li...@gmail.com wrote:
Hello everyone,
My problem is better explained with an example:
Dear all,
Question: How to merge two data frames such that new column are added
in a particular way?
I'm not actually sure how to best articulate my question to be honest,
so i hope showing you what I want to achieve will communicate my
question better.
Lets say I have two data frames:
DF1 -
Try this:
xtabs(as.numeric(Measure) ~ Show + Datetime, data = DF3)
On Thu, Aug 27, 2009 at 8:04 AM, Tony Breyal tony.bre...@googlemail.comwrote:
Dear all,
Question: How to merge two data frames such that new column are added
in a particular way?
I'm not actually sure how to best
class)
- Original Message
From: Tony Breyal tony.bre...@googlemail.com
To: r-help@r-project.org
Sent: Thursday, August 27, 2009 4:04:30 AM
Subject: [R] Merge data frames but with a twist.
Dear all,
Question: How to merge two data frames such that new column are added
in a particular way
On Thu, Aug 27, 2009 at 9:55 AM, Stephen Tuckerbrown_...@yahoo.com wrote:
You may want to use the reshape package for this task:
library(reshape)
recast(DF3,Show ~ Datetime, id.var=names(DF3),value=Measure)
Show 08/26/2009 11:30 AM 08/26/2009 9:30 AM
1 Firefly 3
To: Stephen Tucker brown_...@yahoo.com
Cc: Tony Breyal tony.bre...@googlemail.com; r-help@r-project.org
Sent: Thursday, August 27, 2009 7:27:26 AM
Subject: Re: [R] Merge data frames but with a twist.
On Thu, Aug 27, 2009 at 9:55 AM, Stephen Tuckerbrown_...@yahoo.com wrote:
You may want to use the reshape
7:27:26 AM
Subject: Re: [R] Merge data frames but with a twist.
On Thu, Aug 27, 2009 at 9:55 AM, Stephen Tuckerbrown_...@yahoo.com wrote:
You may want to use the reshape package for this task:
library(reshape)
recast(DF3,Show ~ Datetime, id.var=names(DF3),value=Measure)
Show 08/26/2009
Or if you need it to be fast, try data.table. X[Y] is a join when X and Y
are both data.tables. X[Y] is a left join, Y[X] is a right join. 'nomatch'
controls the inner/outer join i.e. what happens for unmatched rows. This
is much faster than merge().
Gabor Grothendieck
Hi,
With two data sets, one complete and another one partial, I would like to
merge them and keep the unmatched lines. The problem is that merge() dosen't
keep the unmatched lines. Is there another function that I could use to
merge the data frames.
Example:
completedf -
On Jun 10, 2009, at 8:56 AM, Etienne B. Racine wrote:
Hi,
With two data sets, one complete and another one partial, I would
like to
merge them and keep the unmatched lines. The problem is that merge()
dosen't
keep the unmatched lines. Is there another function that I could use
to
Try:
merge(completedf, partdf, all.x = TRUE)
or
library(sqldf) # see http://sqldf.googlecode.com
sqldf(select * from completedf left join partdf using(beta, alpha))
On Wed, Jun 10, 2009 at 9:56 AM, Etienne B. Racineetienn...@gmail.com wrote:
Hi,
With two data sets, one complete and
Steven Lubitz slubitz1 at yahoo.com writes:
Thank you - this is very helpful. However I realized that with my real data
sets (not the example I have here),
I also have different numbers of columns in each data frame. rbind doesn't
seem to like this. Here's a
modified example:
x -
Steven Lubitz slubitz1 at yahoo.com writes:
x - data.frame(item1=c(NA,NA,3,4,5), item2=c(1,NA,NA,4,5), id=1:5)
y - data.frame(item1=c(NA,2,NA,4,5,6), item2=c(NA,NA,3,4,5,NA), id=1:6)
merge(x,y,by=c(id,item1,item2),all.x=T,all.y=T) #my rows are duplicated
and the NA values are
Steven Lubitz wrote:
Hello, I'm switching over from SAS to R and am having trouble merging data
frames. The data frames have several columns with the same name, and each has a
different number of rows. Some of the values are missing from cells with the
same column names in each data frame. I
Steve,
I don't know if R has such a function to perform the task you were asking. I
wrote one myself. Try the following to see if it works for you. The new
function merge.new has one additional argument col.ID, which is the column
number of ID column. To use your x, y as examples, type:
Subject: Re: [R] merge data frames with same column names of different lengths
and missing values
To: Phil Spector spec...@stat.berkeley.edu
Date: Saturday, March 7, 2009, 5:01 PM
Phil,
Thank you - this is very helpful. However I realized that with my real data
sets (not the example I have here
Hello, I'm switching over from SAS to R and am having trouble merging data
frames. The data frames have several columns with the same name, and each has a
different number of rows. Some of the values are missing from cells with the
same column names in each data frame. I had hoped that when I
41 matches
Mail list logo