Displaying 20 results from an estimated 10000 matches similar to: "New column of data filled with the larger value from 2 columns"
2009 Mar 16
2
Calculate across columns
I'd like to perform some calculations across a series of columns. Is there an
easy way to do so? For example, I'd like to calculate the maximum value from
columns 6-42. Although I can use, say:
pmax(data[,6],data[,7],data[,8], etc.), I'd prefer to be able to do
something like
pmax(data[,6:42]). Unfortunately, doing so returns 36 columns.
Thanks,
Tim
--
View this message in
2018 Feb 20
0
Take the maximum of every 12 columns
Ista, et. al: efficiency?
(Note: I needed to correct my previous post: do.call() is required for
pmax() over the data frame)
> x <- data.frame(matrix(runif(12e6), ncol=12))
> system.time(r1 <- do.call(pmax,x))
user system elapsed
0.049 0.000 0.049
> identical(r1,r2)
[1] FALSE
> system.time(r2 <- apply(x,1,max))
user system elapsed
2.162 0.045 2.207
##
2018 Feb 20
3
Take the maximum of every 12 columns
This is what I was looking for. Thank you everyone!
Sincerely,
Milu
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Mail
priva di virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
2018 Feb 20
2
Take the maximum of every 12 columns
On Tue, Feb 20, 2018 at 11:58 AM, Bert Gunter <bgunter.4567 at gmail.com>
wrote:
> Ista, et. al: efficiency?
> (Note: I needed to correct my previous post: do.call() is required for
> pmax() over the data frame)
>
> > x <- data.frame(matrix(runif(12e6), ncol=12))
>
> > system.time(r1 <- do.call(pmax,x))
> user system elapsed
> 0.049 0.000
2008 Apr 27
1
parallel max, min, and median of dataframe columns
Hello, all,
I have a dataframe of three rows and umpteen columns. I want to show the
maximum, minimum, and median with a vertical line and a central dot (I'd
use a boxplot, but with only three data points, that's overkill; I can't
just use points, because of overlap and some of the other data plotted on
the graph).
This works:
> boxplot(data_frame,
2012 May 04
1
ANOVA problem
Hi,
I need to create a data frame containing the results of a number of ANOVA's
but I'm having some trouble setting it up (some being enough for me to spend
3 days trying with no progress and be left staring in to the abyss which
some people call a weekend, and what I will call 2 quiet days in the
office...)
The response variable is *V*.
I need to do an ANOVA for each *G*.
The fixed
2008 Jul 04
2
create a zero matrix & fill
Dear R user,
I have written a function which returns max,min and variation of a power
(see below)
Power is a given matrix(1,n)
I call the function
>Variation<-VAR(p,(n-deltat))
Now the problem is when I want plot(Results[1],Results[2]). Not possible!
I become the following error (in english it means: Error in
as.double.default(x) :Object cannot be transformed in double)
>
2018 Feb 20
0
Take the maximum of every 12 columns
It looks like OP uses a data.frame, so in order to use matrixStats
(I'm the author) one would have to pay the price to coerce to a matrix
before using matrixStats::rowMaxs(). However, if it is that the
original data could equally well live in a matrix, then matrixStats
should be computational efficient for this task. (I've seen cases
where an original matrix was turned into a data.frame
2002 May 02
3
Surface Graphic
Hello list!
I have a problem with the function 'persp'. I have a data set with the
variables
X -> The X coordenate of the insect
Y -> The Y coordenate of the insect
deep-> how deep the insect buried into the soil.
I would like to have a plot with a surface simulating the way the insect
buried. Is it possible? If I type
persp(x,y,deep)
R gives me this error message
Error in
2011 Dec 02
1
Graphics - Axis Labels overlap window edges
Hi,
I am trying to put larger axis labels on my graphs (using cex.axis and
cex.label) but when I do this the top of the text on the Y axis goes outside
of the window which you can see in this picture
-http://twitter.com/#!/robgriffin247/status/142642881436450816/photo/1 - (if
you click on the picture it opens a larger version so it is easier to see
the problem) is there anyway I can get R to not
2006 Sep 13
2
Retrieving value computed in inner function call
Dear R users,
Consider the following example function:
f = function(a,b) {
g = function(x) a*x + b
h = function(x) g(x)^2 + x^2
opt = optimize(h,lower = -1, upper = 1)
x.min = opt$minimum
h.xmin = opt$objective
g.xmin = g(x.min)
return(c(x.min, h.xmin, g.xmin))
}
In my real problem the function that plays the role of "g" is costly
to compute. Now, to
2011 Jan 24
1
determining the order in which points are plotted
I make plenty of scatterplots, especially using scatterplot.matrix from
library(car). One thing I don't know how to do is determine which points
are plotted last. Sometimes I plot a large number of points for multiple
groups represented by different colors.
I would like to guarantee that point that are far from the centroid for
their group are plotted last. This way they will be
2012 Jun 15
4
[LLVMdev] LLVM Sphinx intro buried in lld doc?
Am I the only one who thinks that it is impractical that the Sphinx intro
is buried deep within the lld documentation? I suggest moving it to the
Programming Documentation document.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120616/2cb7356d/attachment.html>
2010 Nov 09
4
help to add a new column filled with value 1
Dear All,
I have a data frame with 5 column and 201 row data. I want to add one
more column between column 1 and 2 with value of 1. So the new column
has to be the second column filled with 1. Any help will be
appreciated.
Thanks for your time.
Thanks & Rg
Mohan L
2018 Feb 20
0
Take the maximum of every 12 columns
Thank you for your kind replies. Maybe I was not clear with my question (I
apologize) or I did not understand...
I would like to take the max for X0...X11 and X12...X24 in my dataset. When
I use pmax with the function byapply as in
byapply(df, 12, pmax)
I get back a list which I cannot convert to a dataframe. Am I missing
something? Thanks again!
Sincerely,
Milu
2018 Feb 20
2
Take the maximum of every 12 columns
Don't do this (sorry Thierry)! max() already does this -- see ?max
> x <- data.frame(a =rnorm(10), b = rnorm(10))
> max(x)
[1] 1.799644
> max(sapply(x,max))
[1] 1.799644
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic
2005 Jun 16
3
possible bug in merge with duplicate blank names in 'by' field.
Run this:
>p <- c('a', 'c', '', ''); a <- c(10, 20, 30, 40); d1 <-
>data.frame(Promoter=p, ip=a) # Note duplicate empty names in p.
>p <- c('b', 'c', 'd', ''); a <- c(15, 20, 30, 40); d2 <-
>data.frame(Promoter=p, ip=a)
>all <- merge(x=d1, y=d2, by="Promoter", all=T)
>all <-
2010 Jun 02
6
How do you hangup a call without terminating your session?
Asterisk 1.6
CentOS 5.0
All -
I'd like to offer my users the ability to hangup a call by pressing **. I'm
using an attendant, so when ** is dialled I'd like processing to return to
the attendant so the user can place a subsequent call. I have setup
features.conf to include:
[featuremap]
disconnect => **
My Dial command looks like this:
2019 Aug 13
2
DANGER WILL ROBINSON, DANGER
On 09/08/19 18:24, Matthew Wilcox wrote:
> On Fri, Aug 09, 2019 at 07:00:26PM +0300, Adalbert Laz?r wrote:
>> +++ b/include/linux/page-flags.h
>> @@ -417,8 +417,10 @@ PAGEFLAG(Idle, idle, PF_ANY)
>> */
>> #define PAGE_MAPPING_ANON 0x1
>> #define PAGE_MAPPING_MOVABLE 0x2
>> +#define PAGE_MAPPING_REMOTE 0x4
> Uh. How do you know page->mapping would
2019 Aug 13
2
DANGER WILL ROBINSON, DANGER
On 09/08/19 18:24, Matthew Wilcox wrote:
> On Fri, Aug 09, 2019 at 07:00:26PM +0300, Adalbert Laz?r wrote:
>> +++ b/include/linux/page-flags.h
>> @@ -417,8 +417,10 @@ PAGEFLAG(Idle, idle, PF_ANY)
>> */
>> #define PAGE_MAPPING_ANON 0x1
>> #define PAGE_MAPPING_MOVABLE 0x2
>> +#define PAGE_MAPPING_REMOTE 0x4
> Uh. How do you know page->mapping would