Displaying 20 results from an estimated 20000 matches similar to: "Factor levels."
2002 Nov 08
1
Using the ``...'' argument.
Suppose that I have a function fff which calls a couple of functions
foo and bar, and that foo takes optional arguments a and b, and bar
takes optional arguments u and v.
Is there an elegant way of passing ***both*** sets of optional
arguments via a ``...'' argument for fff?
I'd like to be able to have a structure like:
fff(x,y,z,...) {
.
a1 <- foo(x,y,...)
b1
2006 Mar 23
3
Intercepts in linear models.
A colleague asked me if there is a way to specify with a
***variable*** (say ``cflag'') whether there is an intercept in a
linear model.
She had in mind something like
lm(y ~ x - cflag)
where cflag could be 0 or 1; if it's 0 an intercept should
be fitted, if it's 1 then no intercept.
This doesn't work ``of course''. The cflag just gets treated
as another predictor
2012 Oct 05
1
Format of numbers in plotmath expressions.
I want to do something like:
TH <- sprintf("%1.1f",c(0.3,0.5,0.7,0.9,1))
plot(1:10)
legend("bottomright",pch=1:5,legend=parse(text=paste("theta ==",TH)))
Notice that the final "1" comes out in the legend as just plain "1" and NOT
as "1.0" although TH is
[1] "0.3" "0.5" "0.7" "0.9"
2012 Oct 30
5
Swap rows and columns in a matrix
Dear R users,
I want a help to write an algorithm for swapping rows and columns in a matrix
thanks in advance
[[alternative HTML version deleted]]
2011 Aug 15
2
area under the curve
HI there, I have been trying to use a code posted on R help to be able to calculate area under the curve for complicated data points and there seems to be an issue with the code: no "b" object found. I am not a good R user and can''t find were the problem is. Any help? Thanks!!
This is the code ( as a test run I gave it this info because I know the answer:
x<-seq(1:50)
2010 Mar 01
1
Fwd: Erika DeBenedictis-Recommendation
---------- Forwarded message ----------
From: Celia Einhorn <celia.einhorn at gmail.com>
Date: Wed, Feb 17, 2010 at 8:15 PM
Subject: Fwd: Erika DeBenedictis-Recommendation
To: drew einhorn <drew.einhorn at gmail.com>
---------- Forwarded message ----------
From: David H. Kratzer <dhk at lanl.gov>
Date: Tue, Feb 16, 2010 at 9:24 AM
Subject: Fwd: Erika
2008 Feb 20
2
Data frame with 0 rows.
For reasons best known only to myself ( :-) ) I wish to create a data
frame with 0 rows and 9 columns.
The best I've been able to come up with is:
junk <- as.data.frame(matrix(0,nrow=0,ncol=9))
Is there a sexier way?
cheers,
Rolf
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
2006 May 15
2
RFC 3501 compliance issue: body-type-msg incorrect
Hi,
I am using Dovecot 1.0 beta 7, moving to beta8 probably tomorrow.
I am seeing a few RFC compliance issues with IMAP responses. I have an in-house IMAP client that caches IMAP data for a web mail system (it parses millions of IMAP interactions a day), and it reports whenever it gets a line that does not look RFC compliant. Unfortunately, users modify their mailboxes before I can get a copy
2004 Jan 09
1
degree-min-sec data
Hello -
Have both astronomic and geodetic data sets with values in the form
"ddd:mm:ss.sssss", where dd is an integer between -180 and 180, mm is an
integer between 0 and 60, and ss is a floating-point
number between 0 and 60.0. In order to do anything useful with these
values they need to be turned into their "decimal degree" equivalent.
Assuming the data is a vector y, the
2009 Mar 25
3
Converting a Matrix to a Vector
Say I have:
> set.seed( 1 )
> m <- matrix( runif(5^2), nrow=5, dimnames = list( c("A","B","C","D","E"),
> c("O","P","Q","R","S") ) )
> m
O P Q R S
A 0.2655087 0.89838968 0.2059746 0.4976992 0.9347052
B 0.3721239 0.94467527 0.1765568
2008 Jul 01
2
Area Under a Curve
I would like to integrate the area under a curve without any smoothing or
the like- just on the raw numbers. I looked at integrate() but it requires
a function which I assume means something like x+x^2+x^3
is there a built in function in R for this?
#let's say
x <- seq(1:50)
y <- seq(1:50)
plot(y~x)
# the are would be 1250
# I would like to be able to do this but on more complicated
2007 Aug 30
3
piecewise linear approximation
Dear list,
I have a series of data points which I want to approximate with exactly two
linear functions. I would like to choose the intervals so that the total
deviation from my fitted lines is minimal. How do I best do this?
Thanks!
Kamila
The information transmitted in this electronic communication...{{dropped}}
2010 Aug 10
4
(Dreaded) STI, belongs_to
Having problems with STI. Names below have been changed to protect the
innocent. Imagine a system that allows someone to apply for one of two
different types of school scholarships. Each scholarship goes through a
different review process, represented by a state machine (this is not a
state machine question). So there are two state machine classes that
differ slightly and subclass a generic
2010 Nov 10
2
Centring titles for pairs of plots.
I would like to centre titles for pairs of plots in a 3-x-2
array. Each row of the array corresponds to a calendar year
and I would like to have the year value centred between the
two plots in the row, and just above their upper edges.
I have attached an example in "demo.pdf" showing roughly
what I want. I managed to produce the example using
2002 Sep 19
5
how to use if statement in function correctly
Dear all
I try to persuade if statement in my function to work as I want (but I am not very
successful:(
My question is why my function with if statement is evaluated correctly in case of
atomic variables and incorrectly in case of vector variables.
Here is an example:
#function with if statement
fff <- function(otac,sklon)
{
test <- (otac *
2008 May 16
1
Making slope coefficients ``relative to 0''.
I am interested in whether the slopes in a linear model are different
from 0.
I.e. I would like to obtain the slope estimates, and their standard
errors,
``relative to 0'' for each group, rather than relative to some baseline.
Explicitly I would like to write/represent the model as
y = a_i + b_i*x + E
i = 1, ..., K, where x is a continuous variate and i indexes groups
(levels of a
2010 Nov 30
2
xyplot : superimposed 2 groups in different panels
Hello,
I would like to plot the following xyplot : for each date of fff (1 date per
panel), bbb=f(aaa) for the two groups (ddd=1 and ddd=2) superimposed.
I can do it by group (see below) but not together.
I looked at http://lmdvr.r-forge.r-project.org/figures/figures.html but I
haven't found what I was looking for (to be honest, I haven't understood all
the examples).
Any help will be
2005 Jun 06
1
Missing values in argument of .Fortran.
I wish to pass a vector ``y'', some of whose entries are NAs to a
fortran subroutine which I am dynamically loading and calling by
means of .Fortran(). The subroutine runs through the vector entry by
entry; obviously I want to have it do one thing if y[i] is present
and a different thing if it is missing.
The way I am thinking of proceeding is along the xlines of:
ymiss <- is.na(y)
2007 Aug 29
1
combining datasets by row
Rusers,
I am trying to append multiple .csv files of different dimensions (but
# of columns are the same for all .csv files). I do have .csv files
whose names are CA1.csv ~ CA100.csv. CA means california and 1 means
the first file. So what I have been doing (after googling how to append
by row multiple files) was:
cleanup_data<-function(state,count)
{
out<-matrix()
for (i in 1:
2007 Jul 17
1
problem with length()
In the following, can anyone tell me why length(eee) returns 9? I
was expecting 15398, and when I try to add this vector to a data
frame with that many rows, it fails complaining that the vector is of
length 9. In what I thought was an identical situation with a
related dataset, the same code worked as expected.
> length(fff)
[1] 15398
> str(fff)
int [1:15398] 20010102 20010102