Displaying 20 results from an estimated 6000 matches similar to: "slightly inconsistent behavior"
2009 Sep 15
2
why is nrow() so slow?
dear R wizards: here is the strange question for the day. It seems to me
that nrow() is very slow. Let me explain what I mean:
ds= data.frame( NA, x=rnorm(10000) ) ## a sample data set
> system.time( { for (i in 1:10000) NA } ) ## doing nothing takes
virtually no time
user system elapsed
0.000 0.000 0.001
## this is something that should take time; we need to add 10,000
2012 Mar 30
4
list assignment syntax?
Dear R wizards: is there a clean way to assign to elements in a list?
what I would like to do, in pseudo R+perl notation is
f <- function(a,b) list(a+b,a-b)
(c,d) <- f(1,2)
and have c be assigned 1+2 and d be assigned 1-2. right now, I use the clunky
x <- f(1,2)
c <- x[[1]]
d <- x[[2]]
rm(x)
which seems awful. is there a nicer syntax?
regards, /iaw
----
Ivo Welch
2009 Feb 12
2
beginner's question: group of regressors by name vector?
dear r-experts: there is probably a very easy way to do it, but it eludes
me right now. I have a large data frame with, say, 26 columns named "a"
through "z". I would like to define "sets of regressors" from this data
frame. something like
myregressors=c("b", "j", "x")
lm( l ~ myregressors, data=... )
is the best way to create new
2010 Jan 08
4
fast lm se?
dear R experts---I am using the coef() function to pick off the coefficients
from an lm() object. alas, I also need the standard errors and I need them
fast. I know I can do a "summary()" on the object and pick them off this
way, but this computes other stuff I do not need. Or, I can compute (X'
X)^(-1) s^2 myself. Has someone written a fast se() function?
incidentally, I think
2010 Jun 11
3
lm without error
this is not an important question, but I wonder why lm returns an
error, and whether this can be shut off. it would seem to me that
returning NA's would make more sense in some cases---after all, the
problem is clearly that coefficients cannot be computed.
I know that I can trap the lm.fit() error---although I have always
found this to be quite inconvenient---and this is easy if I have only
2012 May 09
2
big quasi-fixed effects OLS model
dear R experts---now I have a case where I want to estimate very large
regression models with many fixed effects---not just the mean type, but
cross-fixed effects---years, months, locations, firms. Many millions of
observations, a few thousand variables (most of these variables are
interaction fixed effects). could someone please point me to packages, if
any, that would help me estimate such
2013 Feb 06
5
First R Package --- Advice?
Dear R experts---
after many years, I am planning to give in and write my first R
package. I want to combine my collection of collected useful utility
routines.
as my guide, I am planning to use Friedrich Leisch's "Creating R
Packages: A Tutorial" from Sep 2009. Is there a newer or better
tutorial? this one is 4 years old.
I also plan on one change---given that the
2010 May 11
3
Revolution R and the R Community?
As an end-user, I wonder about Revolution R. Is the relationship
between Revolution R and the R community at-large a positive one? Do
the former contribute to the development efforts of the latter? Is
there a competitive aspect? is their forum competitive with r-help?
any other thoughts? (most of all, I simply hope that they help some
of the many helpful experts on this forum, who have
2009 Apr 16
2
static variable?
dear R experts:
does R have "static" variables that are local to functions? I know
that they are usually better avoided (although they are better than
globals).
However, I would like to have a function print how often it was
invoked when it is invoked, or at least print its name only once to
STDOUT when it is invoked many times.
possible without <<- ?
sincerely,
/iaw
2009 Sep 01
2
"simple" 3-dimensional plots?
dear R experts: I am trying to plot an empirical likelihood function in 3d.
The values are not over a regular grid---I just searched the likelihood
function to find the optimal value, and then computed a few values around
it. (each point in the likelihood function takes a very long time to
compute.)
the likelihood values now sit in a csv file that has three
columns, "mu",
2010 Jan 22
2
sorted reshaping?
dear R wizards:? I am wrestling with reshape.? I have a long data set
that I want to convert into a wide data set, in which rows are firms
and columns are years.
> summary(rin)
firm fyear sim1
Min. :1004.00 Min. :1964.0 Min. : -1.00000
1st Qu.:1010.00 1st Qu.:1979.0 1st Qu.: -0.14334
Median :1016.00 Median :1986.0 Median : 0.00116
Mean
2007 Jan 01
1
advice on semi-serious attempt to extend summary
Dear R wizards:
I am trying (finally) to build a function that might be useful to
others. In particular, I want to create a summary.lme (extended lm)
method that [a] adds normalized coefficients and [b] white
heteroskedasticity adjusted se's and T's. I believe I already know
how to do the programming to do these two, at least in simple
unweighted cases. Now my challenges are just [1]
2011 Mar 01
3
inefficient ifelse() ?
dear R experts---
t <- 1:30
f <- function(t) { cat("f for", t, "\n"); return(2*t) }
g <- function(t) { cat("g for", t, "\n"); return(3*t) }
s <- ifelse( t%%2==0, g(t), f(t))
shows that the ifelse function actually evaluates both f() and g() for
all values first, and presumably then just picks left or right results
based on t%%2.
2005 Dec 08
1
A few questions how to use libogg
1.) after initializing a ogg_stream_state may I just keep calling
ogg_stream_packetin with valid ogg_packet's until no more ogg_packets
needs to be added? Or do I need to call ogg_stream_pageout after every
ogg_stream_packetin? Iaw may I delay calling ogg_stream_pageout until
there are no more packets to be added?
2.) I assume I have call ogg_stream_pageout until no more pages can be
2009 Mar 25
1
intelligent optimizer (with domain restrictions?)
dear R experts---sorry, second question of the day. I want to match some
moments. I am writing my own code---I have exactly as many moment
conditions as parameters, and I am leary of having to learn the magic of
GMM weighting matrices (if I was to introduce more). the process sounds
easy conceptually. (Seen it in seminars many times, so how hard could it
possibly be?...me thinks) first
2004 Jan 22
4
Axes Ticks
Apologies, basic question on plot.
y <- c(-4,3,-2,1);
x <- c("time 1", "time 2", "time 3", "time 4");
plot(x,y, type="b");
of course fails.
x <- 1:4
makes it succeed, but then I have too many ticks on my X axis. I want
exactly 4 tickmarks. It would also be nicer if I could name the ticks.
I looked at ?par and Venables&Ripley,
2013 Feb 26
1
Light Libraries
Dear R-Help group:
I have been tinkering with how I want my personal standard library
functions to look like. They are not designed to be professional and
heavyweight, but lightweight. There are probably dozens of little bugs,
because I don't know or have not properly taken care of a variety of
internal R code issues. still, I like how this ended up, and there is no
learning curve, so I
2010 Aug 20
1
strange behavior of ifelse with factors
Dear R experts: this is probably correct behavior, but I do want to
point out that it is unexpected to someone not too well versed:
> test=factor("A","B","C","A")
> ifelse(test=="A", as.factor("A"), test)
[1] 1 2 3 1
ok, my factor was just coerced into integers, even though I have a
logical vector as my condition and factors as
2006 Jul 11
3
--no-save and --save toggle from inside R? + BATCH stderr
dear R wizards: is it possible to instruct R to save or no-save from
inside R? or does this have to be given at invokation on the
command-line? The same question applies to "--no-restore-data",
although this presumably would have to be decided in a .First()
function or something like it.
on a similar note, I would love a CMD BATCH invokation to output just
one line to stderr at the
2006 Apr 03
4
argv[0] --- again
dear R group: I have the probably fairly common problem that I would
like to have one code.R file do different things if it is invoked from
a symbolic link, which should be easy to uncover.
$ ln -s code.R code-0.R
$ ln -s code.R code-1.R
$ R CMD BATCH code-1.R
what needs to be in code-1.R to put code-1.r into a character vector?
help appreciated.
regards, /ivo welch
PS : I read