Displaying 20 results from an estimated 2000 matches similar to: "Plotting a function with curve()"
2003 Jan 10
1
Superposed histograms
I woud like to plot cumulative histograms. Specifically,
I have data like
Sex M M F M F F M F
Height 6 6.3 6.1 5.5 7.2 6.2 5.9 6.0 ....
and I want to plot a histogram of the distribution of all heights,
colouring the histogram bars according to sex, for example
| o
| oo o
| o oo ** o o = observations of women
| o o*o***o * = observations of
2003 Dec 17
6
Factor names & levels
When I alter the levels of a factor, why does it alter the names too?
f <- factor(c(A="one",B="two",C="one",D="one",E="three"),
levels=c("one","two","three"))
names(f)
-- gives [1] "A" "B" "C" "D" "E"
levels(f) <-
2003 Mar 10
2
Biplots
I want to plot biplots. I have seen the function biplot, but there are
some extra features I would like, that I do not know how to achieve.
1. My observations, and my variables, fall into groups. Is there a way to,
say, plot the observations in several different colours, according to
which group the observation falls into? Similarly with the variables? I am
used to the lattice idiom, in which one
2003 Mar 02
2
ESS+R not closing gracefully
I am having trouble with ESS+R. I don't know if it is an ESS
problem or an R problem, so I'm posting to this mailing list in
the first instance.
I am using R 1.6.2, Windows XP (latest updates installed), XEmacs 21.4,
and ESS 5.1.21. I have experienced the same problem under Windows 2000 and
recent versions of Emacs and ESS (though my current Windows XP
installation is from scratch, and
2004 Apr 22
3
Trouble with HTML search engine
There have been a number of posts to this list by people having trouble
with the HTML search engine. Often these troubles are caused by incorrect
setups (user hasn't installed Java properly, or Java is disabled, or
Javascript is disabled). Sometimes the trouble persists even when Java is
installed properly.
I have written an alternative HTML search engine, which is based on
Javascript rather
2003 Jul 26
1
A model for disease progression
I would be grateful for advice about the following problem. It's not
directly R-related, but I'm hoping that R will help me analyse the
following data.
I have a table which indicates the progression of a certain age-related
disease. At a certain point in time, a population was sampled; and I have
measurements for the age of each individual, and their disease stage.
(Disease stage is an
2003 Sep 04
3
Overlaying graphs
----- Original Message -----
From: "Richard A. O'Keefe" <ok at cs.otago.ac.nz>
To: <paul at datavore.com>
Sent: Thursday, September 04, 2003 2:56 AM
Subject: Re: [R] Overlaying graphs
> I do not know how to overlay the curve graphic on top of hist graphic.
>
> Do you know about the "add=TRUE" option for plot()?
>
> I am hoping to show visually
2018 May 03
0
Calling the curve function with a character object converted into an expression
Sebastian:
This is somewhat arcane, perhaps even a bug (correction on this
welcomed). The problem is that the "expr" argument to curve() must be
an actual expression, not a call to parse that evaluates to an
expression. If you look at the code of curve() you'll see why
(substitute() does not evaluate expr in the code). Another simple
workaround other than sticking in the eval()
2018 May 03
1
Calling the curve function with a character object converted into an expression
Typo: should be NULL not NUL of course
An alternative approach closer to your original attempt is to use
do.call() to explicitly evaluate the expr argument:
w <- "1 + x^2"
do.call(curve, list(expr = parse(text = w), ylab ="y"))
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus
2018 May 03
2
Calling the curve function with a character object converted into an expression
Hi,
Down a cascade of function calls, I want to use the curve function with an expression that is a variable. For various reason, this variable must be a character object and cannot be an expression as required by the curve function. How do I convert my variable into a expression that is accepted by curve?
Thanks in advance for your help.
## The following attempts do not work
myf <-
2003 Feb 01
1
Trouble with optim
I am having trouble with optim. It claims to have converged to a minimum,
yet it has in the course of the optimization visited many points which are
closer to optimal. I would be grateful for any explanation of this
behaviour.
I'm trying to estimate the parameters in the model
X ~ Binomial(1,p) * NegBin(mu,theta).
So I define a log likelihood function, and invoke optim thus:
o <- optim
2003 Jan 17
2
Negative Binomial modelling
I have some data which I am trying to fit with a negative binomial
distribution. I have found the glm.nb function from MASS.
I have reason to believe that the mean parameter mu depends on
certain factors, and that the shape parameter theta depends on
others.
If, say, the factors are P and Q, it might be that
mu ~ P:Q and theta ~ P
(where mu ~ P:Q means that mu is a function of the pair (P,Q))
2005 Dec 14
2
The fastest way to select and execute a few selected functions inside a function
Dear useRs?
I have the following problem! I have a function that calls one or more
functions, depending on the input parameters. I am searching for the fastest
way to select and execute the selected functions and return their results in
a list. The number of possible functions is 10, however usually only 2 are
selected (although sometimes more, even all).
For examples, if I have function
2011 Feb 22
1
Discrepancies in run times
Dear R-users,
I am in the process of creating new custom functions and am quite puzzled by
some discrepancies in execution time when I run some R scripts that call
those new functions. So here is the situation:
- let's assume I have created two custom functions, called myg and myf;
- myg is mostly a plotting function, which makes a heavy use of grid and
lattice functions;
- myf is a function
2012 Nov 06
1
how Can make function for selecting the products
HI.
I make this code:
getdata<-function('a','b','c' ,'d','e','f'){
drv <- dbDriver("SQLite")
con<-dbConnect(drv, "sqlite.db")
lt<-dbListTables(con)
myf<-data.frame(NULL)
for (i in 1:length(lt))
{
myfile<-dbReadTable(con,lt[i])
myfile1<-myfile[-c(14:44)]
myfile1$MODEL<-gsub(" ",
2005 Nov 23
3
Infinite recursion in S3 methods crashes R on windows (related to PR#8203?)
Hi,
Infinite recursion in S3 methods seem to crash R on Windows 2000 (R
terminating with the ("Rgui.exe has generated errors...") message,
rather than throwing an error. This happens with both Rgui and Rterm.
The following toy example triggers this:
myf <- function(x, ...)
UseMethod("myf")
myf.default <- function(x, ...)
myf(x)
myf(1)
...R crashes...
Which I
2007 Jan 31
4
possible spam alert
The last two times I have originated message threads on R or
Bioconductor I have received the message included below from someone
named Patrick Connolly. Both times I was the originator of the message
thread and used what I thought was a unique subject line that explained
as best I could what my question was. Patrick seems to be implying that
I am abusing the R and BioC help newsgroups in this
2011 Feb 03
1
Getting variable names in function output
Dear R-users,
I would like to have some advises about a problem illustrated by the
following snippet. Within myf, I need to evaluate a piece of R code that is
passed as a character argument and then return the objects that are created
by this code. The difficulty comes from the fact that the content of the
code is variable and unknown to me (obviously not in this illustration!).
With the
2007 Apr 17
2
format() applied to an NA character string (PR#9616)
I get strange results when I try to format() an NA character string.
> x <- 'sometext'
> x[1] <- NA
> format(NA, width=32) # displays sensibly, right-justified
> format(x,width=32) # displays sensibly, left-justified
> format(x,width=33) # displays ""
> format(x,width=36) # R exits abnormally with code 5
> version
platform i386-pc-mingw32
2004 Apr 05
3
Evaluation of functionals
Suppose I have
f1 <- function(x) x
f2 <- function(x) x^2
funlist <- list(f1,f2)
Then I would like to evaluate funlist such that when x is 10 I should get a list with 10 and 100.
A naive way of doint this is
myf <- funlist[[1]]
do.call(paste(quote(myf)), list(x=10))
myf <- funlist[[2]]
do.call(paste(quote(myf)), list(x=10))
- but there has to be much