Displaying 20 results from an estimated 10000 matches similar to: "system.time()"
2005 Apr 27
3
Time series indexes
I tried to assign values to specific elements of a time series and got
in trouble. The code below should be almost self-explanatory. I wanted
to assign 0 to the first element of x, but instead I assigned zero to
the second element of x, which is not what I wanted. Is there a
function that will allow me to do this without going into index
arithmetic (which would be prone to errors)?
FS
>
2006 May 20
3
sapply and Date objects
This is probably a dumb question, but I cannot figure it out. Why does
this happen?
dt <- as.Date("1954-02-01")
> as.character(dt)
[1] "1954-02-01"
> sapply(c(dt), as.character)
[1] "-5813"
Thanks.
FS
2005 Apr 27
3
assign to an element of a vector
I am trying to find a way to assign values to elements of a vector
that will be defined by a user. So I don't have the name of the vector
and cannot hard code the assignment in advance. In the example below I
have to get() the vector using its name. When I try to assign to an
element I get an error:
> a <- c(1,2,3)
> get('a')[1] <- 0
Error: Target of assignment expands to
2005 Apr 26
2
Extending time series
I noticed that when one tries to extend a time series (ts) object by a
single period using window() actually two observations (NAs) are
added. See below for an example. Does anyone know the reason for this
behavior and how to avoid it?
Thanks.
FS
> x<-ts(c(1,2,3))
> x1<- window(x, start(x), end(x) + 1, extend = TRUE)
> x1
Time Series:
Start = 1
End = 5
Frequency = 1
[1] 1 2
2006 Feb 02
2
How to get the namespace of a function?
I declared the environment of the function myfun to be NULL as follows:
environment(myfun) <- NULL
Later on I called that myfun and got an error message because the
function index() in the zoo package was called inside myfun and was
not visible:
Error in myfun(args) : couldn't find function "index"
I tried to use zoo::index() instead of index(), but that did not work.
In fact,
2005 Apr 15
2
Define "local" function
I discovered a bug in a program I am writing which was due to the
program using a global variable within a function.
For example,
myfunc <- function(x) { y}
That is, I made a mistake when defining the function and wrote "y"
when I should have written "x".
However, there was a variable y in the global environment and the
function "worked" but gave the wrong
2008 Jan 16
3
Rprofile.site not executed?
It seems that my Rprofile.site file is not executed when I start R. To
test this I included the following code in that file:
.First <- function(){
cat("\nWelcome at", date(), "\n")
flush.console()
}
When I start R the message above is not displayed.
I am running R 2.6.1 (rgui.exe) under Vista Home Premium. The
Rprofile.site is in the etc folder and the R_PROFILE
2005 Apr 26
1
Time alignment of time series
One thing that has given me trouble is the fact that the time series
implementation in the class ts relies on the concept of a "start" to
the time series. For example, if I have
ts1 <- ts(c(1,2,3))
dts1 <- diff(ts1)
then dts1 will be a vector c(1,1) but with the attribute start = 2.
Similarly, when one takes lags the "start" is moved around and the
underlying vector
2008 Mar 22
1
Geting names of variables
I wanted to create a list with the names of variables and their
values. So I wrote the following function.
add.to.list.names.vars.1 <- function(lnv, vnv) {
i <- 1
while (i < length(vnv)) {
z <- as.character(eval(substitute(quote(vnv[i+1])))[[2]][[i + 2]])
lnv[[vnv[i]]] <- list(Name = z, Value = vnv[i+1])
i <- i + 2
}
lnv
}
It works, but it is very
2005 Apr 12
1
Regression and time series
Can someone shed some light on this obscure portion of the help for lm?
"Considerable care is needed when using 'lm' with time series.
Unless 'na.action = NULL', the time series attributes are stripped
from the variables before the regression is done. (This is
necessary as omitting 'NA's would invalidate the time series
attributes, and if
2008 Aug 18
2
matrix row product and cumulative product
I spent a lot of time searching and came up empty handed on the
following query. Is there an equivalent to rowSums that does product or
cumulative product and avoids use of apply or looping? I found a rowProd
in a package but it was a convenience function for apply. As part of a
likelihood calculation called from optim, I?m computing products and
cumulative products of rows of matrices with
2015 Apr 20
4
Samba 4 slow write
Hi Jones,
many thanks for your reply.
Yepp, I'm using ACL's (Posix ACL's) on filesystem to regulate the
access of users for files and directories.
Do you mean that this is the "normal" way? These geteuid and
getegid system calls are so slow?
On the previous system (Debian Wheezy, Samba 3) I've also used
ACL's, but there were much faster than this...
What should
2011 Sep 28
1
[PATCH] New APIs: {compress, gzip, xz}-out, {compress, gzip, xz}-device-out.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-------------- next part --------------
>From 1ff2c479a63574395903361bfb037e555c69ad26 Mon Sep 17 00:00:00 2001
From:
2006 Mar 03
3
Peculiar timing result
I have been timing a particular model fit using lmer on several
different computers and came up with a peculiar result - the model fit
is considerably slower on a dual-core Athlon 64 using Goto's
multithreaded BLAS than on a single-core processor.
Here is the timing on a single-core Athlon 64 3000+ running under
today's R-devel with version 0.995-5 of the Matrix package.
>
2010 Oct 12
2
R Profiling
Dear All,
I need to do some very basic R profiling, something along the lines of:
run this whole script five times and return the average completion time.
I do not want (at this stage) delve into the details of the percentage
of the time spent in which function and doing what.
Which tools should I use?
Any recommendation is welcome.
Best Regards
Lorenzo
2007 Apr 25
1
help
Hi all,
I have 2 questions:
1)How do I calculate the mean on an imported txt file? I've imported the
file below and that's what it looks like imported. How do I then calcuate
the mean, median, or mode on the column LeafArea using the desktop R
package?
Any help would be greatly appreciated!!
Thanks,
Nat
LeafType Leaflets LeafArea ShapeRatio LeafWeight LeafThickness
1 1
2013 Jan 21
2
foreach takes foreever?
I started to look at ways to improve times of certain very parallel tasks and thought that foreach should be a valid candidate to do the job.
So, i opened foreach tutorial by Steve Weston and started timing examples from it. First example from tutorial is
>system.time(for(i in 1:100000) sqrt(i))
user system elapsed
0.06 0.00 0.06
> system.time(foreach(i=1:100000) %do%
2020 Apr 14
4
7-8% compile time slowdowns in LLVM 10
Hey list,
TL;DR - LLVM 10 is around 7-8% slower than LLVM 9 when compiling the same
inputs.
So here at Unity our Burst HPC# compiler uses LLVM to provide our users
with some very optimal codegen. LLVM is used in two ways:
1. In the Unity editor we JIT compile user code.
2. We also have an AOT mode for when our users are building a full game.
Particularly for 1., compile time really matters for
2009 Jun 26
5
(performance) time in Windows vs Linux
Hi, all.
I began to migrate my R codes from Windows to Linux and surprised me
with an old question. I simplified the problem and made a little test to compare times at same
computer and the Linux time is worse (not so little) than Windows time:
28 vs 53 seconds.
I make an example (below) to facilitate all to see the difference.
I also build from source (it's my first time) a version of R to
2001 Sep 26
3
Multithread processing
Dose anyone know if R can handle multithread processing?
Regards,
Harvey
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch