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], x2[
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 sap
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 i
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 <- c(116,115,137,127
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 valu
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 da
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 merge
10 matches
Mail list logo