I'm a little confused, because the sample code does something that
none of the suggestions does.
x1 <- c(116,0,115,137,127,0,0)
x2 <- c(0,159,0,0,0,159,127)
[You] want : xx <- c(116,115,137,127,159, 127)
Assuming that there should have been two copies of 159 in xx, this is
xx <- c(x1[x1 != 0],
Thank you for the general code. Really appreciate it.
On Tue, Sep 5, 2023 at 7:59 PM Eric Berger wrote:
> As Duncan points out, ifelse() provides a more general approach than
> the specific pmax().
>
> Even more generally, you might want to consider the apply() function
> (and its relatives
Thank you for the general code. Really appreciate it.
On Tue, Sep 5, 2023 at 7:45 PM Duncan Murdoch
wrote:
> On 05/09/2023 4:55 a.m., roslinazairimah zakaria wrote:
> > Hi all,
> >
> > I have these data
> >
> > x1 <- c(116,0,115,137,127,0,0)
> > x2 <- c(0,159,0,0,0,159,127)
> >
> > I want : xx
As Duncan points out, ifelse() provides a more general approach than
the specific pmax().
Even more generally, you might want to consider the apply() function
(and its relatives sapply(), lapply(), ...)
For example
apply(cbind(x1,x2), MAR=1, max)
In the above statement, x1 and x2 are combined
On 05/09/2023 4:55 a.m., roslinazairimah zakaria wrote:
Hi all,
I have these data
x1 <- c(116,0,115,137,127,0,0)
x2 <- c(0,159,0,0,0,159,127)
I want : xx <- c(116,115,137,127,159, 127)
I would like to merge these data into one column. Whenever the data is '0'
it will be replaced by the value
Thank you very much for your help.
On Tue, Sep 5, 2023 at 6:39 PM Rui Barradas wrote:
> Às 09:55 de 05/09/2023, roslinazairimah zakaria escreveu:
> > Hi all,
> >
> > I have these data
> >
> > x1 <- c(116,0,115,137,127,0,0)
> > x2 <- c(0,159,0,0,0,159,127)
> >
> > I want : xx <-
Thank you very much for your help.
On Tue, Sep 5, 2023 at 6:12 PM Eric Berger wrote:
> xx <- pmax(x1,x2)
>
> On Tue, Sep 5, 2023 at 11:56 AM roslinazairimah zakaria
> wrote:
> >
> > Hi all,
> >
> > I have these data
> >
> > x1 <- c(116,0,115,137,127,0,0)
> > x2 <- c(0,159,0,0,0,159,127)
> >
>
Às 09:55 de 05/09/2023, roslinazairimah zakaria escreveu:
Hi all,
I have these data
x1 <- c(116,0,115,137,127,0,0)
x2 <- c(0,159,0,0,0,159,127)
I want : xx <- c(116,115,137,127,159, 127)
I would like to merge these data into one column. Whenever the data is '0'
it will be replaced by the
xx <- pmax(x1,x2)
On Tue, Sep 5, 2023 at 11:56 AM roslinazairimah zakaria
wrote:
>
> Hi all,
>
> I have these data
>
> x1 <- c(116,0,115,137,127,0,0)
> x2 <- c(0,159,0,0,0,159,127)
>
> I want : xx <- c(116,115,137,127,159, 127)
>
> I would like to merge these data into one column. Whenever the
Hi all,
I have these data
x1 <- c(116,0,115,137,127,0,0)
x2 <- c(0,159,0,0,0,159,127)
I want : xx <- c(116,115,137,127,159, 127)
I would like to merge these data into one column. Whenever the data is '0'
it will be replaced by the value in the column which is non zero..
I tried append and
Thanks for your suggestion.
I have just returned from a vacation and started catching up on my emails.
Rolling join is an elegant and most suitable solution for my tasks. I invested
some time in learning data.table package. The vignette on secondary indices
and auto indexing refers to
It sounds like you might want a rolling join, e.g.
https://dplyr.tidyverse.org/reference/join_by.html#rolling-joins.
(And data.table has similar functionality which inspired dplyr)
Hadley
On Mon, Aug 7, 2023 at 9:32 PM Naresh Gurbuxani
wrote:
>
>
> I have two dataframes, each with a column for
On Mon, 07 Aug 2023, Naresh Gurbuxani writes:
> I have two dataframes, each with a column for timestamp. I want to
> merge the two dataframes such that each row from first dataframe
> is matched with the row in the second dataframe with most recent but
> preceding timestamp. Here is an example.
I was able to adapt your solution using packages with which I am more familiar.
myres2 <- merge(option.trades, stock.trades, by = "timestamp", all =
TRUE)
myres2[,"stock.timestamp"] <- ifelse(is.na(myres2$stock.price), NA,
myres2$timestamp)
myres2$stock.timestamp <-
Hi Naresh,
Perhaps the below is faster than your approach
library(dplyr)
library(tidyr)
merge(option.trades, stock.trades, by="timestamp", all=TRUE) |>
dplyr::arrange(timestamp) |>
dplyr::mutate(stock.timestamp =
as.POSIXct(ifelse(is.na(option.price), timestamp, NA))) |>
I have two dataframes, each with a column for timestamp. I want to
merge the two dataframes such that each row from first dataframe
is matched with the row in the second dataframe with most recent but
preceding timestamp. Here is an example.
option.trades <- data.frame(timestamp =
Hi Jim and all,
All functions worked beautifully. I really appreciate your help.
*Thank you and best regards.*
On Fri, Nov 19, 2021 at 4:26 AM Jim Lemon wrote:
> Hi RosalinaZakaria,
> Talk about using a sledgehammer to crack a nut. In your example the
> two objects are character vectors.
Hi RosalinaZakaria,
Talk about using a sledgehammer to crack a nut. In your example the
two objects are character vectors. How about:
dt_comb1gd <-paste0(dtpaigd,dtpmgd)
Jim
On Fri, Nov 19, 2021 at 2:15 AM ROSLINAZAIRIMAH BINTI ZAKARIA .
wrote:
>
> Dear all,
>
> I try to merge two columns
Hello,
Use an index giving the "" positions.
i <- nchar(dtpmgd) == 0L
dtpmgd[i] <- dtpaigd[i]
Or, in one line,
dtpmgd[nchar(dtpmgd) == 0L] <- dtpaigd[nchar(dtpmgd) == 0L]
Hope this helps,
Rui Barradas
Às 07:02 de 18/11/21, ROSLINAZAIRIMAH BINTI ZAKARIA . escreveu:
Dear all,
I try
On 18/11/2021 09:02, ROSLINAZAIRIMAH BINTI ZAKARIA . wrote:
Dear all,
I try to merge two columns consisting of characters using the 'coalesce'
function from dplyr package. However, two data still have not merged, data
no. 124 1nd 143. Any help is very much appreciated. I provide the data as
Dear all,
I try to merge two columns consisting of characters using the 'coalesce'
function from dplyr package. However, two data still have not merged, data
no. 124 1nd 143. Any help is very much appreciated. I provide the data as
follows.
> dput(dtpaigd)
c("C+", "B+", "C+", "B+", "C+", "A-",
I am trying to merge a list of .xls files in google drive. I have now managed
to create a list of all the files I need, but for some reason I still can't
manage to merge them, this is the code I have so far:
library(googledrive) inputfiles <- drive_ls(path = "Email It In", pattern =
. (A and B) and not(B).
David C
-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
Sent: Monday, January 7, 2019 11:04 AM
To: Priya Arasu ; Priya Arasu via R-help
; David L Carlson ; David Winsemius
; r-help@r-project.org
Subject: Re: [R] Merge the data from multiple text
d C)" "not(D)"
>
>$C
>[1] "D"
>
>> TF.and <- lapply(TF.list, paste, collapse=" and ")
>> TF.final <- lapply(names(TF.and), function(x) paste(x, "=",
>TF.and[[x]]))
>> TF.final <- do.call(rbind, TF.final)
>> TF.fin
"B = (A and C) and not(D)"
[3,] "C = D"
> write(TF.final, file="TF.output.txt")
The text file "TF.output.txt" contains the three lines.
--
David L. Carlson
Department of Anthropology
Texas A University
---
"A = (D and E) and not(B or C)"
[2,] "B = (A and C) and not(D)"
[3,] "C = D"
> write(TF.final, file="TF.output.txt")
The text file "TF.output.txt" contains the three lines.
--
David L. Carlson
De
On 1/5/19 7:28 AM, Priya Arasu via R-help wrote:
I have multiple text files, where each file has Boolean rules.
Example of my text file 1 and 2
Text file 1:
A = not(B or C)
B = A and C
C = D
Text file 2:
A = D and E
B = not(D)
I want to merge the contents in text file as follows
A = not(B or
I have multiple text files, where each file has Boolean rules.
Example of my text file 1 and 2
Text file 1:
A = not(B or C)
B = A and C
C = D
Text file 2:
A = D and E
B = not(D)
I want to merge the contents in text file as follows
A = not(B or C) and (D and E)
B = not(D) and (A and C)
C = D
Is
half Of Ding, Yuan Chun
Sent: Wednesday, April 18, 2018 10:38 AM
To: r-help@r-project.org
Subject: [R] merge two data frame based on equal and unequal comparisons
[Attention: This email came from an external source. Do not open attachments or
click on links from unknown senders or unexpected em
Dear R users,
I need to merge two data frames based on both equal and unequal comparisons.
The "sqldf" package used to work well , but today, I cannot resolve the
following error by reinstallation of the sqldf package. Can anyone suggest a
different way to perform this kind of merge
Have you tried 'foverlaps' in the data.table package?
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
On Mon, Sep 4, 2017 at 8:31 AM, Mohammad Tanvir Ahamed via R-help <
r-help@r-project.org> wrote:
> Hi,
>
Hi,
I have two big data set.
data _1 :
> dim(data_1)
[1] 15820 5
> head(data_1)
Chromosome StartEndFeature GroupA_3
1: chr1 521369 75 chr1-0001 0.170
2: chr1 750001 80 chr1-0002 -0.086
3: chr1
> On Apr 13, 2017, at 7:56 AM, Mohammad Tanvir Ahamed via R-help
> wrote:
>
> Hi,
> I have a list like
> kk<- list (a = 1:5, b = 6:10, c = 4:11)
>
> Now i want to merger (Union) the list element "a" and "c" by name .
>
> My expected outcome is
> kk1<- list(a_c =
a...@yahoo.com
>
>
>
>
> From: Rui Barradas <ruipbarra...@sapo.pt>
>
> l...@r-project.org>
> Sent: Thursday, 13 April 2017, 18:37
> Subject: Re: [R] Merge selected list element by name
>
>
>
> Hello,
>
> There's no ne
.@r-project.org>
Sent: Thursday, 13 April 2017, 18:37
Subject: Re: [R] Merge selected list element by name
Hello,
There's no need to send the same question twice, we've got it at the
first try.
Maybe I don't understand but is this it?
kk1 <- list(a_c = union(kk$a, kk$c), b = kk$b)
kk1
$a
Hello,
There's no need to send the same question twice, we've got it at the
first try.
Maybe I don't understand but is this it?
kk1 <- list(a_c = union(kk$a, kk$c), b = kk$b)
kk1
$a_c
[1] 1 2 3 4 5 6 7 8 9 10 11
$b
[1] 6 7 8 9 10
Hope this helps,
Rui Barradas
Em 13-04-2017
Hi,
I have a list like
kk<- list (a = 1:5, b = 6:10, c = 4:11)
Now i want to merger (Union) the list element "a" and "c" by name .
My expected outcome is
kk1<- list(a_c = 1:11, b = 6:10)
I can do it with several lines of code. But can any one have idea to do
efficiently/ quickly on
Hi,
I have a list like
kk<- list (a = 1:5, b = 6:10, c = 4:11)
Now i want to merger (Union) the list element "a" and "c" by name .
My expected outcome is
kk1<- list(a_c = 1:11, b = 6:10)
I can do it with several lines of code. But can any one have idea to do
efficiently/ quickly on a big
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
Hi Lily,
I think below codes can work:
f<- list.files("D:/output/test/your folde
rname",full.names=TRUE,recursive=TRUE)
files<- grep(".csv", f)
files_merge<- data.frame()
for (i in 1:length(f[files])){
data<- read.csv(file=f[files][i],header=TRUE, sep=",")
files_merge<-
Hello,
Maybe something like this.
fls <- list.files(pattern = "*.csv")
dat.list <- lapply(fls, read.csv)
dat <- do.call(rbind, dat.list)
Hope this helps,
Rui Barradas
Citando lily li :
> Hi R users,
>
> I'd like to ask that how to merge several datasets into one in R?
Lily Li wrote :
I think you are going to have to give us some more detail. What commands did
you execute? what are the names of the .csv files in your directory? Can you
read one of them as asingle read.csv?
> Hi R users,
>
> I'd like to ask that how to merge several
Lily:
If you mean that you have several csv files in a directory/folder on
your computer and you are using lapply() to do something with them,
then you do not have a clue about how R works and you need to go
through some tutorials to learn. There are many good ones on the web.
Some
Hi R users,
I'd like to ask that how to merge several datasets into one in R? I put
these csv files in one folder, and use the lapply function, but it says
that cannot open file 'xx.csv'. These files have different names, but end
with .csv extension, and the files have the same header. Thanks for
On 20/04/2016 7:38 AM, Gaston wrote:
I indeed used is.na() to check length, as I was not sure weather
lenght() was a simple query or would go through the whole vector to
count the elements.
length() is a simple query, and is very fast. The other problem in your
approach (which may not be a
I indeed used is.na() to check length, as I was not sure weather
lenght() was a simple query or would go through the whole vector to
count the elements.
So to sum up, function calls are expensive, therefore recursion should
be avoided, and growing the size of a vector (which is probably
On 19/04/2016 3:39 PM, Gaston wrote:
Hello everyone,
I am learning R since recently, and as a small exercise I wanted to
write a recursive mergesort. I was extremely surprised to discover that
my sorting, although operational, is deeply inefficient in time. Here is
my code :
merge <-
Hello everyone,
I am learning R since recently, and as a small exercise I wanted to
write a recursive mergesort. I was extremely surprised to discover that
my sorting, although operational, is deeply inefficient in time. Here is
my code :
> merge <- function(x,y){
> if (is.na(x[1]))
In R, I have cut a dendrogram into clusters. However some of the clusters
have only few samples. How can I merge the small clusters with nearest big
cuter.
hc <- hclust(dist(USArrests))
plot(hc, cex = 0.6)
rect.hclust(hc, k = 4, border = 2:5)
It gives one cluster with only 2 samples. How can I
This is not a well defined question, until your notions of "small" and
"nearest" are defined. In your specific example
rect.hclust(hc, k = 3, border = 2:5)
... will do what you are asking for. This is not likely to work in the general
case - imagine that your cluster of size two only meets
Hello
Let's say some questions about merging xts variables :
a<- xts("abc", Sys.Date())
b <- xts("def", Sys.Date())
c <- xts(1, Sys.Date())
> merge(a,b)
a b
2015-09-03 "abc" "def"
> merge(a,b,c)
a b c
2015-09-03 NA NA 1
Warning messages:
1: In merge.xts(a, b,
The root of your problems lie in your assumption that xts variables act like
data frames. Instead they are matrices with an index attribute. All values in a
matrix must be of the same storage mode.
You might want to investigate the data.table package. It is not a time series
object but you
On Thu, Sep 3, 2015 at 7:40 PM, ce wrote:
>
> Hello
>
> Let's say some questions about merging xts variables :
>
> a<- xts("abc", Sys.Date())
> b <- xts("def", Sys.Date())
> c <- xts(1, Sys.Date())
>
>> merge(a,b)
>a b
> 2015-09-03 "abc" "def"
>> merge(a,b,c)
c"
2015-09-06 "def"
2015-09-07 "abc"
-Original Message-
From: "Joshua Ulrich" [josh.m.ulr...@gmail.com]
Date: 09/03/2015 09:43 PM
To: "ce" <zadi...@excite.com>
CC: "R-Help" <r-help@r-project.org>
Subject: Re: [R] merge
Thank you Ista,
Your solution is smart, by sub-setting from x.HHu.map data only HHid,
position as indices (because they are unique) for the merge, and any
extra columns in x.HHu.map that are not present in y.HHo,map, thus when
the merge is done with option all=T, will work among the two sets of
Thank you Jeff,
Your solutions have two great aspects: a) you provide a different
approach by using reshape2 syntax / tidyr, and b) the concern that it is
better to update x.HHu.map with y.HHo.map, without overwriting x.HHu.map
with NA from y.HHo.map, thus keeping intact the old value(s). That
I get confused by your use of the position map table. If I follow your
description toward your desired result, I take a different route that
makes sense to me. Perhaps it will make sense to you as well. The key idea
is to make individual comparisons of the values for each combination of
HHid
Hi,
I have two sets of data x.HHu and y.HHo, rows are IDs and columns are
individuals. I do not know in advance indv or HHid, both of them will be
captured from the data. As the y.HHo set updates, y.HHo set has better
information then x.HHu set. Thus I want a merge where right set
overwrites
I think this does what you want:
## find idiv coloumns in x.HHu.map that don't exist in y.HHo.map
x.HHu.map - x.HHu.map[
c(HHid,
position,
names(x.HHu.map)[
!names(x.HHu.map)
%in% names(y.HHo.map)]
)]
## merge, adding extra column from x.HHu.map
You do not appear to understand what merge() does. Go through the worked
examples in ?merge so that you do.
FWIW, I would agree that the Help file is cryptic and difficult to
understand. Perhaps going through a tutorial on database join operations
might help.
Cheers,
Bert
Bert Gunter
Data is
Hi,By default the merge function should take the intersection of column names
(if this is understood from by = intersect(names(x), names(y)), but it takes
all columns. How to specify the intersection of column names?
Thanks
Carol
[[alternative HTML version deleted]]
, 1 Jun 2015 06:29:41 -0800
To: wht_...@yahoo.com, r-help@r-project.org
Subject: RE: [R] merge function
As Burt says it is not exactly clear what you want but is something like
this what you are looking for?
dat1 - data.frame(aa = c(a, b, c), bb = 1:3)
dat2 - data.frame(xx = c(b, c, d
I understood that by would take the intersection of names(x) and names(y),
names(x) being the column names of x and names(y), column names of y.
if x has 5 col and the col names of x are col1, col2... col5 and y has 3 col
and their names are col1, col2, col3, I thought that the merged data set
1. Please read and follow the posting guide.
2. Reproducible example? (... at least I don't understand what you mean)
3. Plain text, not HTML.
Cheers,
Bert
Bert Gunter
Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom.
-- Clifford Stoll
On Mon,
On 01/06/2015 14:46, carol white via R-help wrote:
Hi,By default the merge function should take the intersection of column names
(if this is understood from by = intersect(names(x), names(y)),
Dear Carol
The by parameter specifies which columns are used to merge by. Did you
understand it
asking questions on the
R-help list. In particular it is very helpful if data is supplied in dput()
form (See ?dput for details)
John Kane
Kingston ON Canada
-Original Message-
From: r-help@r-project.org
Sent: Mon, 1 Jun 2015 13:46:15 + (UTC)
To: r-help@r-project.org
Subject: [R
Exactly what I thought too the first time I read ?merge. R sometimes has its
own approach.
John Kane
Kingston ON Canada
-Original Message-
From: r-help@r-project.org
Sent: Mon, 1 Jun 2015 14:47:07 + (UTC)
To: li...@dewey.myzen.co.uk, r-help@r-project.org
Subject: Re: [R] merge
Hi, I have a list like below :
gg
[[1]] assembly1 GCA_000257985
[[2]] assembly1 GCA_17125
[[3]] assembly1 GCA_16805
[[4]] assembly1 GCA_000144955
[[5]] assembly isolation.source1 GCA_000507725
missing
[[6]] assembly
This would be a perfect time for you to use best practices to convey what you
have to us [1]... most specifically, posting using plain text will keep your
code from getting munged up, and using dput to provide an unambiguous form we
can put into our R sessions.
[1]
Hello togehter,
i have a little problem. Maybe anyone can help me.
I have 2 data.frames, which look like as follows:
First:
NAMEMONTH BONUS
1 Andy 2014-10 100
2 Pete 2014-10200
3 Marc2014-10300
4 Andy2014-11400
Hello,
See ?merge, in particular the argument 'all'.
dat1 - read.table(text =
NAMEMONTH BONUS
1 Andy 2014-10 100
2 Pete 2014-10200
3 Marc2014-10300
4 Andy2014-11400
, header = TRUE, stringsAsFactors = FALSE)
merge(df1, df2, all=TRUE)
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Nov 13, 2014 at 6:02 AM, Matthias Weber
matthias.we...@fntsoftware.com wrote:
Hello togehter,
i have a little problem. Maybe anyone can help me.
I have 2 data.frames, which look like as follows:
First:
On 13/11/2014 14:02, Matthias Weber wrote:
Hello togehter,
i have a little problem. Maybe anyone can help me.
I think you might find
?merge
enlightening
Indeed given that the word merge occurs in your subject line and your
text it is surprising you have not already found it.
I have 2
In the vcdExtra package, I have a function glmlist to collect a set of
glm() models as a glmlist object,
and other functions that generate fit such a collection of models.
This is my working example, fitting a set of models to the Donner data
# install.packages(vcdExtra,
22.7210591
poly(age, 2)2:sexMale NA NA NA 28.8975876
Best,
John
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Michael Friendly
Sent: Tuesday, October 28, 2014 11:47 AM
To: R-help
Subject: [R] merge
...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Michael Friendly
Sent: Tuesday, October 28, 2014 11:47 AM
To: R-help
Subject: [R] merge coefficients from a glmlist of models
In the vcdExtra package, I have a function glmlist to collect a set of
glm() models as a glmlist object
Dear R users,
Can someone help me on this? I would like to find the sum of the Rain if
the Month appears more than once. For example in row 3 and 4, October
appear more than once, so I want to find the sum of the two rows and
replace it so that the Month just appear once. It some sort of merge
Hello,
Try
aggregate(Rain ~ Year + Month, data = dat, FUN = sum)
Hope this helps,
Rui Barradas
Em 23-10-2014 01:29, Hafizuddin Arshad escreveu:
Dear R users,
Can someone help me on this? I would like to find the sum of the Rain if
the Month appears more than once. For example in row 3
Thank you Jean, Petr, Terry, William and everyone else who thought about
my problem.
It is sooo good that this mailing list exists!
I solved my problem using Petr's suggestion, that didn't seem so
complicated and worked fine for me.
Thanks again and have a great weekend,
Dagmar
Am 02.10.2014
. by
?complete.cases
Regards
Petr
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Adams, Jean
Sent: Thursday, October 02, 2014 11:38 PM
To: Dagmar
Cc: R help
Subject: Re: [R] merge by time, certain value if 5 min before and after
an event
-
project.org] On Behalf Of Dagmar
Sent: Thursday, October 02, 2014 11:25 PM
Cc: R help
Subject: Re: [R] merge by time, certain value if 5 min before and after
an event
Dear Jean and all,
I want all lines to be low, but during times 9:55 - 10:05 a.m (i.e. a
timespan of 10 min) I want them
I've attached two functions used locally. (The attachments will be stripped off of the
r-help response, but the questioner should get them). The functions neardate and
tmerge were written to deal with a query that comes up very often in our medical
statistics work, some variety of get the
Hi Terry,
Some of that combination of sort() and approx() can be done by
findInterval(), which may be quick enough that you don't need the
'thinning' part of the code.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Oct 3, 2014 at 6:05 AM, Therneau, Terry M., Ph.D.
thern...@mayo.edu
Hello! I hope someone can help me. It would save me days of work. Thanks in
advance!
I have two dataframes which look like these:
myframe - data.frame (Timestamp=c(24.09.2012 09:00:00, 24.09.2012
10:00:00,
24.09.2012 11:00:00), Event=c(low,high,low) )
myframe
mydata - data.frame (
Dagmar,
Can you explain more fully why rows 1, 2, and 5 in your result are low
and rows 3 and 4 are high? It is not clear to me from the information
you have provided.
result[c(1, 2, 5), ]
Timestamp location Event
1 24.09.2012 09:05:011 low
2 24.09.2012 09:49:502
Dear Jean and all,
I want all lines to be low, but during times 9:55 - 10:05 a.m (i.e. a
timespan of 10 min) I want them to be high.
In my real data low and high refer to lowtide and hightide in
the waddensea and I want to assign the location of my animal at the time
it was taken to the tide
Thanks, Dagmar.
So, shouldn't row 3 with a time of 09:51:01 be low and not high?
Jean
On Thu, Oct 2, 2014 at 4:25 PM, Dagmar ramga...@gmx.net wrote:
Dear Jean and all,
I want all lines to be low, but during times 9:55 - 10:05 a.m (i.e. a
timespan of 10 min) I want them to be high.
In my
Cautionary note on the solution below. Be sure the 'sndr' is either
factor or character because, if sndr is numeric, as the list is
populated, R will fill in non-adjacent list items with NULLs, leaving a
list with many empty entries. So, the modified line is
On Fri, 11 Jul 2014 12:19:39 PM Ryan de Vera wrote:
Hello all,
I have a data frame filled with senders and recipients. Some of the
senders
have multiple rows with different recipients and I want to merge
those
rows. For example I have
a...@email.com b...@email.com
a...@email.com
This is a (very) slightly modified version of Jim's reply that takes the
sender's email our of the list element and uses it as the name so it can
be accessed as newdat$'senders email' or newdat[['senders email']]
newdat-list()
for(sndr in unique(rdvdf$sender)) {
newvec-
Hello all,
I have a data frame filled with senders and recipients. Some of the senders
have multiple rows with different recipients and I want to merge those
rows. For example I have
a...@email.com b...@email.com
a...@email.com c...@email.com d...@email.com
r...@email.com
Hi Ryan,
We can't tell from your example what structure your original data are
in, nor what your output is intended to look like, or for that matter
how you got from one to the other. Please don't post in HTML because
it gets mangled!
Using dput() to provide your example data is the best thing,
Hi John,
I don't think your x2 is right, but who knows?
One possible approach would be:
R lapply(split(x2$recipients, unique(x2$sender)), paste, collapse=, )
$`a...@email.com`
[1] b...@email.com, f...@email.com
$`r...@email.com`
[1] c(\c...@email.com\, \d...@email.com\), h...@email.com
but
Rolf,
I hear you.
But, after reflection, ie I looked at my situation again, it is great :-)-O
el
Sent from Dr Lisse's iPad mini
On Jun 30, 2014, at 0:48, Rolf Turner r.tur...@auckland.ac.nz wrote:
On 30/06/14 10:32, Dr Eberhard W Lisse wrote:
Thanks,
I then set NA to 0, and can
I have two data frames like so
qpiso
iso requests
1A1 20
2A2 199
3AD5
4AE 176
...
189 ZW 82
qplegit
iso requests
1A2 36
2AE4
3AM2
4AO1
...
100 ZW3
I want to create another dataframe
If you really prefer solution code, then provide reproducible example code as
the footer requests.
Use ?merge with the all.x=TRUE parameter, and then perform your calculations on
the resulting combined data frame, using ?ifelse and ?is.na as needed.
you can get a new data frame by
merge(qpiso, qplegit, all.x = TRUE, all.y = TRUE, by = iso )
Take the subtraction on the new data frame.
2014-06-29 11:24 GMT-05:00 Dr Eberhard Lisse nos...@lisse.na:
I have two data frames like so
qpiso
iso requests
1A1 20
2A2 199
Thanks,
I then set NA to 0, and can do the sutraction,
great.
el
On 2014-06-29, 22:32 , Michael Peng wrote:
you can get a new data frame by
merge(qpiso, qplegit, all.x = TRUE, all.y = TRUE, by = iso )
Take the subtraction on the new data frame.
2014-06-29 11:24 GMT-05:00 Dr
1 - 100 of 457 matches
Mail list logo