Displaying 20 results from an estimated 20000 matches similar to: "which.pmin?"
2012 Jun 20
2
passing function parameters into a 'with' statement to dynamically pick out columns
Hi,
I've built a function to generate plots and would like to be able pass in column names as a parameter. Here's a boiled down version of what I have right now:
pmts <- data.frame(date=c(1,2,3), all=c(5,6,7),maj=c(4,5,6),ind=c(3,4,5))
perc.mktshare <- function(df){
range1 <- floor(min(with(df, 100*ind/all)))
range2 <- ceiling(max(with(df, 100*ind/all)))
2008 Apr 03
1
help with R semantics
Greetings:
I'm running R2.6.2 on a WinXP DELL box with 2 gig RAM.
I have created a new glm link function to be used with family = binomial.
The function works (although any suggested improvements would be welcome),
logit.FC <- function(POD.floor = 0, POD.ceiling =1)
{ if (POD.floor < 0 | POD.floor > 1) stop ("POD.floor must be between zero
and one.")
if
1997 May 21
1
R-alpha: plot(1); axis(1, at=10) >>> Seg.fault -- and a patch
This problem has been mentioned by Arne Kovac <maak@stats.bris.ac.uk> on May 9-10.
The patch is really a replacement of 'axis' in RHOME/src/library/base/funs/
It contains the fixes which where proposed Arne Kovac
and fixes (all?) the errors he/she (?) reported on May 9.
"axis" <-
function (which, at, labels = TRUE, ...)
{
if (which%%2 == 1) {
axp <-
2006 Jul 03
2
help a newbie with a loop
Hi,
I am new in R and stumbled on a problem my (more experienced) friends
can not help with with. Why isnt this code working?
The function is working, also with the loop and the graph appears,
only when I build another loop around it (for different values of p) ,
R stays in a loop?
Can't it take more then 2 loops in one program?
powerb<-function(x,sp2,a,b,b1,m)
{
2010 Oct 04
1
Splitting a DF into rows according to a column
Hi,
I'm turning my wheels on this and keep coming around to the same wrong
solution - please have a look and give a hand ...
The premise is: a DF like so
> loremIpsum <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque leo ipsum, ultricies scelerisque volutpat non, volutpat et nulla.
Curabitur consequat ullamcorper tellus id imperdiet. Duis semper malesuada
2007 Aug 17
1
[BioC] function to find coodinates in an array
The arr.ind in the which function does the job very nicely!!!
Thank you everyone for the suggestions!
Ana
>
>
>---- Mensaje Original ----
>De: marc_schwartz at comcast.net
>Para: m_olshansky at yahoo.com
>Asunto: Re: [BioC] [R] function to find coodinates in an array
>Fecha: Thu, 16 Aug 2007 21:53:44 -0500
>
>>If I am correctly understanding the problem, I think
2006 Feb 12
1
floor and ceiling can't handle more than 15 decimal places (PR#8590)
Full_Name: Ben Phalan
Version: 2.2.1
OS: Win XP
Submission from: (NULL) (131.111.111.231)
I have noticed that floor returns the wrong number when there are more than 15
decimal places:
> floor(6.999999999999999)
[1] 6
> floor(6.9999999999999999)
[1] 7
There is a similar problem with ceiling, so this may apply to all/most rounding
functions?
> ceiling (2.000000000000001)
[1] 3
>
2009 Mar 12
3
Map using projection
Hi list,
I have a real problem with plotting US state map. When I try to plot the
northern state, there will be some blank space in the top of graph (see case
1 example), and when I plot southern states, there will be a blank space in
the bottom of plot (see case 2). I spent almost 2 days to figure out a
solution, but could not. Would you help me if you know what the problem is?
Regards,
Alireza
2012 Jul 05
1
reshape2 errors on data frame
I've successfully reformatted data frames from long to wide with reshape2,
but this time I'm getting errors that I want to understand and resolve.
Here's the data frame structure and the results of the melt() and dcast()
functions:
str(waterchem)
'data.frame': 128412 obs. of 8 variables:
$ site : Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1
2009 Mar 02
1
plotting on map
Hi list,
I want to plot state Texas using map function. I wrote the following code to
plot the grid boundary for Texas:
################################
library(maps)
require("mapproj")
longlatLimit<-c(-106.65, -93.53 , 25.93 , 36.49)
par(plt=c(0,1,0,1),cex=1,cex.main=1) #Set plotting parameters
map(projection="azequalarea",
2011 Mar 18
4
subset data frame with condition
Hello,
One more question.. I have the data.frame "pop":
xloc yloc gonad ind Ene W Area
1 23 20 516.74 1 0.02 20.21 1
2 23 20 1143.20 1 0.02 20.21 1
3 23 20 250.00 1 0.02 20.21 1
4 22 15 251.98 1 0.02 18.69 2
5 22 15 598.08 1 0.02 18.69 2
6 21 19 250.00 1 0.02 20.21 3
7 22 20 251.98 1
2002 Sep 09
1
Monotonic interpolation
Has anyone got a function for smooth monotonic interpolation of a
univariate function? I'm after something like the NAG function PCHIM
which does monotonic Hermite interpolation. Alternatively, montononic
cubic spline interpolation.
Please reply directly.
Rob Hyndman
___________________________________________________
Rob J Hyndman
Associate Professor & Director of Consulting
2012 Jul 24
2
limit of detection (LOD) by logistic regression
Dear all,
I am trying to apply the logistic regression to determine the limit of
detection (LOD) of a molecular biology assay, the polymerase chain reaction
(PCR). The aim of the procedure is to identify the value (variable
"dilution") that determine a 95% probability of success, that is
"positive"/"total"=0.95. The procedure I have implemented seemed to work
looking
2012 Aug 07
3
NADA Package: Referencing Data Frame Columns
The sample data sets that come with the NADA package are limited to one or
two variables and a censored measurement indicator column. I try to mimic
examples using my data but keep missing the target.
My water chemistry data is available in two formats: long (as seen in a
database table) and wide (as seen in a spreadsheet). The two structures are:
str(chem)
'data.frame': 65349 obs. of
2012 Jul 03
2
NADA Data Frame Format: Wide or Long?
I have water chemistry data with censored values (i.e., those less than
reporting levels) in a data frame with a narrow (i.e., database table)
format. The structure is:
$ site : Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1 1 1 1 1 1 1 ...
$ sampdate: Date, format: "2007-12-12" "2007-12-12" ...
$ preeq0 : logi TRUE TRUE TRUE TRUE TRUE
2004 Dec 22
2
outer(-x, x, pmin) cannot allocate
R> x <- 0. + 1:8000
R> y <- outer(-x, x, pmin)
Error: cannot allocate vector of size 1000000 Kb
Why does R need to allocate a gigabyte to create an 8000 x 8000 matrix?
It doesn't have any trouble with outer(-x, x, "+"). Thanks.
-- David Brahm (brahm at alum.mit.edu)
Version:
platform = i686-pc-linux-gnu
arch = i686
os = linux-gnu
system = i686, linux-gnu
status =
2015 Dec 24
2
override pmin/pmax for my own matrix
Hello,
I'm trying to override pmin and pmax for my own matrix. These two
functions have ... as an argument. I tried to override them as
follows:
setMethod("pmax", class_name, function(x, ..., na.rm) { ... })
I use this way to override primitive functions such as min/max and it
works fine.
But it doesn't work for pmin and pmax. I guess because they are
regular functions?
How
2012 Oct 30
4
There is pmin and pmax each taking na.rm, how about psum?
Hi,
Please consider the following :
x = c(1,3,NA,5)
y = c(2,NA,4,1)
min(x,y,na.rm=TRUE) # ok
[1] 1
max(x,y,na.rm=TRUE) # ok
[1] 5
sum(x,y,na.rm=TRUE) # ok
[1] 16
pmin(x,y,na.rm=TRUE) # ok
[1] 1 3 4 1
pmax(x,y,na.rm=TRUE) # ok
[1] 2 3 4 5
psum(x,y,na.rm=TRUE)
[1] 3 3 4 6 # expected result
Error: could not find function "psum" # actual result
2002 Sep 19
2
Rounding
Hi,
Suppose I have:
459
1789
23590
and I'd like to round them to:
400
1700
24000
On the other hand, say if I have:
232
1234
23120
that need to be rounded to:
300
1300
24000
I tried the round(), floor() or ceiling() and can't get what I want. Is
there any tricks I can use to achieve this goal?
Cheers,
Kevin
2008 Jun 21
1
question on rgl.surface
I'd like to use rgl.surface (or some other function if more
appropriate) to create a horizontal and vertical transparent grey
slice (plane) running through both the x and y origins and extending
across the z axis, i.e. the 3-d equivalent of the normal 2-d
coordinate axes we are all familiar with. The examples for rgl.surface
are a bit more complex than what I need and I am having trouble