Displaying 20 results from an estimated 1000 matches similar to: "Using sub to get captions in barplots"
2008 Sep 06
2
Hopefully an easy error bar question
Hi im trying to add error bars to my barplots, there very basic, i have a few grapghs where the y variable is different but on all the X variable is Age (Adult and Juvenile) however this is split into two levels so i have males and females, so my graph basically has four bars on it.
I know how to add eror bars for instance when there is only one level eg lookng at the diffrence between male and
2018 Jan 30
0
Calculating angle of a polyline
I like to use complex numbers for 2-dimensional geometry. E.g.,
> polyAngles2
function (xV, yV)
{
stopifnot((length(xV) == length(yV)) && (length(xV) >= 3))
z <- complex(re = xV, im = yV)
c(NA, diff(Arg(diff(z))), NA) # radians, positive is counter-clockwise
}
> x <- c(0:3)
> y <- c(0,0,1,1)
> polyAngles2(x,y) / pi * 180
[1] NA 45 -45 NA
Bill
2018 Jan 30
2
Calculating angle of a polyline
Assuming your polyline is defined by two vectors, one for the x
coordinates, one for the y coordinates, you can try the following
library(NISTunits)
polyangles <- function(xV,yV) {
stopifnot( (length(xV)==length(yV)) && (length(xV) >= 3))
v <- function(i) { c( xV[i]-xV[i-1], yV[i]-yV[i-1])}
vlen <- function(v) { sqrt(sum(v*v)) }
lV <- rep(NA_real_,length(xV))
for
2011 Oct 04
1
Rug plot curve reversal
Dear R-help
Can anyone tell me why my curve appears the wrong way round on a rug plot?
I am using the same code as on pg 596 of the Crawley R-book.
mod<-glm(mort~logBd,binomial)
par(mfrow=c(2,2))
xv<-seq(0,8,0.01)
yv<-predict(mod,list(logBd=xv),type="response")
plot(logBd,mort)
lines(xv,yv)
I've tried swapping xv and yv around but no luck.
Thanks,
Pete
2011 Feb 15
1
Passing Arguments in a function
Hi All,
I'm having some trouble assigning arguments inside a function to
produce a plot from a model
Can anyone help me? Below I've outlined the situation and examples of
failing and working code.
Regards
Mike
## data ##
decay.data <- ...
behaviors lift reach.uu estimated.conversions.uu total.reach
1 1 432.0083 770 770 0.00
2
2012 Jun 20
1
Problem with predict?
Hello,
I am trying to fit a model to some "death over time" data that does not fit the criteria for the usual LD50 type models (the counts are too large). I am using a simple linear model in an attempt to plot a nice line on a scatter plot and calculate some LD values to use in designing an experiment. Here is the basic idea of what I'm doing:
head(mort)
Time Density
0
2011 May 26
2
Plot binomial regression line
Dear all,
I am quite new with R and I have a problem with plotting a binomial
regression line in a plot.
This is what I type in:
> model<-glm(Para~Size,binomial)
> par(mfrow=c(1,1))
> xv<-seq(3.2,4.5,0.01)
> yv<-predict(model,list(area=xv),type="response")
> plot(Size,Para)
> lines(xv,yv)
The error message that I get is:
> Error in xy.coords(x, y) :
2010 Nov 16
2
Vectors out of lists?
Hello there
I have a list, Y, and each component of that list is a real-valued function
(that is, Y[[i]](u) returns a number).
I was wishing to build the mean function and the first thing I thought of
was
Ybar<-function(u){
mean(Y[[1:n]](u))
}
but obviously this doesn't work, since Y[[1:n]] is not allowed at all.
Any elegant suggestions? I really would like to avoid something like
2017 Jun 14
4
[FORGED] Re: draw stripes in a circle in R
On 15/06/17 05:29, David Winsemius wrote:
>
>> On Jun 14, 2017, at 10:18 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>>
>>
>>> On Jun 14, 2017, at 9:46 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
>>>
>>> I don't see a question. If your question is whether R supports pattern fills, AFAIK it does not. If that is
2011 Nov 09
3
Help with tryCatch with a for loop
Hello all,
I'm a beginner in R working on a script that will produce a set of models
(linear, polynomial and logistic) for each location in a dataset. However,
the self-starting logistic model often fails - if this happens I would like
to just skip to the next iteration of the loop using tryCatch.
I've looked at a few examples and read the help file, but didn't understand
tryCatch
2017 Jun 14
0
draw stripes in a circle in R
> On Jun 14, 2017, at 10:18 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>
>
>> On Jun 14, 2017, at 9:46 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
>>
>> I don't see a question. If your question is whether R supports pattern fills, AFAIK it does not. If that is not your question, ask one.
>> --
>> Sent from my
2008 Jul 20
4
drawing segments through points with pch=1
Please excuse me for asking such basic questions:
Here is my code
> y=c(1.21,0.51,0.14,1.62,-0.8,0.72,-1.71,0.84,0.02,-0.12)
> ybar=mean(y)
> ll=length(y);
> ybarv=rep(ybar,ll)
> x=1:ll
> plot(x,ybarv,pch=1)
> segments(x[1],ybar,x[ll],ybar)
What I get is a collection of small circles, with a segment "on top"
of the circles, which is almost what I want. But I
2011 Jun 03
2
Y error bars, dates on the X-axis
Dear forum,
Does anyone know any functions for plotting vertical error bars, if the
x-axis variable is a date?
I can produce a pretty plot with dates on the x-axis, if I don't want to
include error bars. I can also produce a nice plot with error bars, if I
just use Julian days for the x-axis, but I'd much rather have the actual
dates.
I have tried writing my own function, plotCI
2008 Jul 20
3
asp and ylim
#See David Williams' book "Weighing the odds", p286
y <- c(1.21, 0.51, 0.14, 1.62, -0.8,
0.72, -1.71, 0.84, 0.02, -0.12)
ybar <- mean(y)
ylength <- length(y)
ybarv <- rep(ybar, ylength)
x <- 1:ylength
plot(x,y,asp=1,xlab="position",ylab="ybar",type="n",ylim=c(-1,1))
segments(x[1], ybar, x[ylength], ybar)
segments(x,ybarv,x,y)
2010 Sep 28
1
95% confidence intercal with glm
Hi
I had to use a glm instead of my basic lm on some data due to unconstant
variance.
now, when I plot the model over the data, how can I easily get the 95%
confidence interval that sormally coming from:
> yv <- predict(modelVar,list(aveLength=xv),int="c")
> matlines(xv,yv,lty=c(1,2,2))
There is no "interval" argument to pass to the
2017 Jun 14
0
[FORGED] Re: draw stripes in a circle in R
> On Jun 14, 2017, at 1:53 PM, Rolf Turner <r.turner at auckland.ac.nz> wrote:
>
> On 15/06/17 05:29, David Winsemius wrote:
>>> On Jun 14, 2017, at 10:18 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>>>
>>>
>>>> On Jun 14, 2017, at 9:46 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
>>>>
2008 Jan 15
1
Converting Watir script to Mechanize
I have a Watir script that I would like to convert to a Mechanize
script. The watir code looks like this
require ''watir''
include Watir
def test
ie = IE.new
ie.goto(''http://cpref.gsm.com/inter.asp?r=8084'')
ie.text_field(:name, ''inter_string'').set(''Potassium'')
ie.button(:id, ''image1'').click
2017 Jun 15
2
[FORGED] Re: draw stripes in a circle in R
Sigh. I never load packages in .Rprofile to avoid the irreproducibility trap. Might seem drastic to some, but I don't feel much pain because I almost always edit my code in a file rather than on the fly at the console, and re-run it frequently from a fresh R process to check my progress.
--
Sent from my phone. Please excuse my brevity.
On June 14, 2017 3:27:15 PM PDT, David Winsemius
2017 Jun 14
1
[FORGED] Re: draw stripes in a circle in R
Envoy? depuis mon appareil Samsung
-------- Message d'origine --------
De : Rolf Turner <r.turner at auckland.ac.nz>
Date : 14/06/2017 22:53 (GMT+01:00)
? : David Winsemius <dwinsemius at comcast.net>
Cc : r-help at r-project.org
Objet : Re: [R] [FORGED] Re: draw stripes in a circle in R
On 15/06/17 05:29, David Winsemius wrote:
>
>> On Jun 14, 2017, at
2006 Sep 06
1
Covariance/Correlation matrix for repeated measures data frame
All,
I have a repeated measures data frame and was wondering if the
covariance matrix can be
calculated via some created indexing or built-in R function.
Specifically, say there are 3 variables, where potassium concentration
is measured 6 times on each patient.
Patient number (discrete)
Time (1 to 6, discrete)
Potassium (continuous variable)
I want the covariance/correlation matrix for the