Displaying 20 results from an estimated 8000 matches similar to: "Adding variables"
2009 Sep 19
4
Processing strings
Hi,
I am unable to do something fairly simple. I have matrices called
Table1,..., Table10. I want to be able to print them using a loop. So
I wrote:
##################
for (i in 1:10){
disp<-paste("Table", i, sep="")
eval(parse(text=disp))
}
##################
but this produces no output. Any ideas?
2009 Aug 29
1
Anderson-Darling (one sample)
Hi,
I would like to compute a goodness-of-fit statistic for one data
series against a t-distribution, and obtain the quantiles of the
distribution of the statistic with given degrees of freedom. I wonder
if this is implemented in a package.
I know that the critical values have to be computed for every
distribution, and this requires numerical integration typically. I
would prefer if I could get
2012 Nov 22
1
Data Extraction - benchmark()
Hi Berend,
I see you are one of the contributors to the rbecnhmark package.
I am sorry that I am bothering you again. I have tried to run your code (slightly tweaked) involving the benchmark function, and I am getting the following error message. What am I doing wrong?
Error in benchmark(d1 <- s1(df), d2 <- s2(df), d3 <- s3(df), d4 <- s4(df), :
could not find function
2009 Jul 08
1
Dantzig Selector
Hi,
I was wondering if there was an R package or routines for the Dantzig
Selector (Candes & Tao, 2007). I know Emmanuel Candes has Matlab
routines to do this but I was wondering if someone had ported those to
R.
Thanks,
T
---Reference---
@article{candes2007dantzig,
title={{The Dantzig selector: statistical estimation when p is much
larger than n}},
author={Candes, E. and Tao, T.},
2008 Jan 08
2
problem when extacting columns of a data frame in a new data frame
Dear R-users,
I would like to create a new data frame composed of 2 columns of another
data frame. But it does not give me what I want...
> casesCNST[1:10,]
case X1 X2 X3 X4 expected
1 A1 0 0 0 0 E
2 A2 0 0 0 1 C
3 A3 0 0 0 2 C
4 A4 0 0 0 3 C
5 A5 0 0 0 4 C
6 A6 0 0 1 0 C
7 A7 0 0 1 1 C
8
2010 May 12
2
how to profile R interpreter?
Hi, all. Does anyone know how to profile R interpreter? I've tried gprof but
it doesn't work. Thanks.
Xiaoming
[[alternative HTML version deleted]]
2009 Feb 28
2
Rprofiling
Dear R People:
Could someone recommend a good reference for Rprofing, please?
Thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
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
2012 Nov 22
4
Data Extraction
Hello,
I would appreciate if someone could help me resolve the following:
1. df1[!is.na( X1 | X2 | X3 | X4 | X5),][,1:5] # This does not work
2. Is these message harmful? The following object(s) are masked from 'df1 (position 3)':
X1, X2, X3, X4, X5
Thanks,
Pradip Muhuri
#Reproducible Example
set.seed(5)
df1<-data.frame(matrix(sample(c(1:10,NA),100,replace=TRUE),ncol=5))
2010 Sep 19
2
get time as a number
Hi, all,
How to get a time as a number?
While script is running, I want to print the elapsed time
something like TIME_AS_SECOND() in the following script
inittime <- TIME_AS_SECOND()
for (i in 1:100){
do_something(i)
curtime <- TIME_AS_SECOND()
elapsedtime <- curtime-inittime
print(paste(i, elapsedtime))
}
Thanks in advance,
Hyunchul
[[alternative HTML version
2009 Jun 04
3
Fast way of finding top-n values of a long vector
If x is a (long) vector and n << length(x), what is a fast way of
finding the top-n values of x?
Some suggestions (calculating the ratio of the two top values):
library("rbenchmark")
set.seed(1); x <- runif(1e6, max=1e7); x[1] <- NA;
benchmark(
replications=20,
columns=c("test","elapsed"),
order="elapsed"
, sort = {a<-sort(x,
2009 Apr 22
5
large factorials
I am working on a project that requires me to do very large factorial
evaluations. On R the built in factorial function and the one I created
both are not able to do factorials over 170. The first gives an error and
mine return Inf.
Is there a way to have R do these larger calculations (the calculator in
accessories can do 10000 factorial and Maple can do even larger)
--
View this message in
2009 Jun 12
1
Rprof loses all system() time
Rprof seems to ignore all time spent inside system() calls. E.g.,
this simple example actually takes about 10 seconds, but Rprof thinks
the total time is only 0.12 seconds:
> Rprof("sleep-system.out") ; system.time(system(command="sleep 10")) ; Rprof(NULL)
user system elapsed
0.000 0.004 10.015
> summaryRprof("sleep-system.out")$by.total
2013 Sep 26
2
Sums based on values of other matrix
Dear all,
I have a big problem:
- I got two matrices, A and B
- A shows identifies the value of B, however the values of B must be summed
- For instance,
1 1 2 2
2 2 1 1
gives matrix a
3 4 2 1
1 1 2 2
gives matrix b
Now the result for the value 1 would be
7
4
which are the rowsums of the values of matrix B given that matrix A has the value 1.
How can I do this automatically? I
2001 Oct 23
2
Possible bug, Rprof() and scan(pipe()) (PR#1140)
This looks like a bug?
Unable to use scan(pipe()) while profiling.
I have no idea whether this version of R violates the
"do not use `Rprof' in an executable built for profiling"
warning in ?Rprof.
Thanks
-Don
> version
_
platform powerpc-apple-darwin1.4
arch powerpc
os darwin1.4
system powerpc, darwin1.4
status Patched
major 1
minor 3.1
year
2012 Jun 24
1
Indexing matrices from the Matrix package with [i, j] seems to be very slow. Are there "faster alternatives"?
Dear all,
Indexing matrices from the Matrix package with [i,j] seems to be very slow. For example:
library(rbenchmark)
library(Matrix)
mm <- matrix(c(1,0,0,0,0,0,0,0), nr=20, nc=20)
MM <- as(mm, "Matrix")
lookup <- function(mat){
for (i in 1:nrow(mat)){
for (j in 1:ncol(mat)){
mat[i,j]
}
}
}
benchmark(lookup(mm), lookup(MM),
2013 Apr 05
2
line profiling
Hello,
This is about the new "line profiling" feature in R 3.0.0. As I was
testing it, I find the results somewhat disappointing so I'd like to
get your opinion.
I put some poorly written code in a test.R file, here are the contents:
double <- function(x) {
out <- c()
for (i in x) {
out <- c(out, 2*i) # line 4
}
return(out)
}
Then this how I source the file
2007 Aug 23
2
read big text file into R
Dear Rs:
Hi, I am trying to read a big text file (nrows=243440, ncols=144). It
seems the computational time of all the read methods
(scan,readtable,read.delim) is not linear to the number of rows I
want to read in: things became really slow once I tried to read in
100000 lines compare to 10000 lines).
If I am reading the profiling result right, I guess scan wouldn't
help either.
My
2009 Jun 19
1
Alternate ways of finding number of occurrence of an element in a vector.
Hi,
I have a vector "v" and would like to find the number of occurrence of
element "x" in the same.
Is there a way other than,
sum(as.integer(v==x)) or length(which(x==v))
to do the this.
I have a huge file to process and do this. Both the above described methods
are pretty slow while dealing with a large vector.
Please have your comments.
Praveen
2011 Feb 11
1
Help optimizing EMD::extrema()
Hi folks,
I'm attempting to use the EMD package to analyze some neuroimaging
data (timeseries with 64 channels sampled across 1 million time points
within each of 20 people). I found that processing a single channel of
data using EMD::emd() took about 8 hours. Exploration using Rprof()
suggested that most of the compute time was spent in EMD::extrema().
Looking at the code for EMD:extrema(),