Displaying 20 results from an estimated 5000 matches similar to: "bad performance of a function"
2006 Aug 24
2
my error with augPred
Dear all
I try to refine my nlme models and with partial success. The model is
refined and fitted (using Pinheiro/Bates book as a tutorial) but when
I try to plot
plot(augPred(fit4))
I obtain
Error in predict.nlme(object, value[1:(nrow(value)/nL), , drop =
FALSE], :
Levels (0,3.5],(3.5,5],(5,7],(7,Inf] not allowed for
vykon.fac
>
Is it due to the fact that I have unbalanced
2007 Jan 18
4
How to optimize this loop ?
Dear R Users,
I request your help to optimize a loop.
Given a series of observations, I want to know how many consecutive past
observations are below the last one.
e.g :
my_series <- c(3, 4, 10,14,8,3,4,6,9)
As the last number (9) is higher than the four preceding numbers (6, 4, 3, 8),
this function should return 4.
my_series <- c(3, 4, 10,14,8,3,4,11,9)
Here, it should return 0, as 9
2005 Nov 28
2
str and structable error
Hallo
I encountered a behaviour which puzzles me (but
finally I did get what I wanted).
I used structable and strucplot but I wanted to change
names of variables in structable object. I tried to subset
it, use names but to no avail. So I tried str and
expected to get a structure of an object but:
> sss<-structable(Titanic)
> str(sss)
Error in "[.structable"(x, args[[1]],
2004 Jan 07
2
locale problem in W98
Dear all
I am using two computers, one with Windows2000 and the other one with W98
both have the same version (precompiled binary) R 1.8.1 and I have experienced a
slight problem with text used in plotting on W98 machine.
When I try to write some local characters into R console
????? (not sure if it is OK on your computers)
in W2000 **everything** is OK but in W98 some of the characters
2006 Mar 02
4
Skip last NA's?
I wonder if anyone could help me find an expression for skipping the last
missing values in a vector? The kind of material I have is something like
x<-c(23,12,NA,23,24,21,NA,NA,NA)
I would like to skip the last NA's, but not the ones in between other
vallues. Any hints? (Why not do this by simply take x[1:6]? I have several
vectors a couple of thousand observations long with varying
2006 Feb 13
2
?bug? strange factors produced by chron
Hallo all
Please help me. I am lost and do not know what is the problem. I have
a factor called kvartaly.
> attributes(kvartaly)
$levels
[1] "1Q.04" "2Q.04" "3Q.04" "4Q.04" "1Q.05" "2Q.05" "3Q.05" "4Q.05"
$class
[1] "factor"
> mode(kvartaly)
[1] "numeric"
> str(kvartaly)
Factor w/ 8
2007 May 14
6
Conditional Sums for Index creation
Hi,
Apologies for the long mail. I have a data.frame with columns of
price/mcap data for a portfolio of stocks, and the date. To get the
total value of the portfolio on a daily basis, I calculate rowSums of
the data.frame.
> set.seed(1)
> ab <- matrix(round(runif(100)*100),nrow=20,ncol=5)
> ab[1:5,4:5] <- NA
> ab[6:10,5] <- NA
> ac <- as.data.frame(ifelse(ab <=
2006 Mar 27
1
-march=pentium2 + -mtune=pentium4 faster then -march=pentium4?
Why does GCC produce faster code using "-march=pentium2
-mtune=pentium4" on a Pentium 4 chip versus plain -march=pentium4?
Try it...
CPUTYPE=pentium2
CFLAGS+= -mtune=pentium4
COPTFLAGS+= -mtune=pentium4
--
BSD Podcasts @ http://bsdtalk.blogspot.com/
2006 Jul 18
1
package installation problems
Hello,
I just updated from R 2.1.1 to R 2.3.1 (I also updated from Fedora 3 to
Fedora 4 if that is of any importance). However, several packages (e.g.
fields etc.) refuse to be installed. I get the following error message:
[root at localhost R-files]# R CMD INSTALL fields_2.3.tar.gz
* Installing *source* package 'fields' ...
** libs
g77 -fpic -O2 -g -pipe -m32 -march=i386
2004 Apr 13
1
par() in .Rprofile
Dear all
I installed new version (from binaries) and I noticed that
par(bg="white")
which I have in my .Rprofile causes error message on startup
But if I issued this command immediately after startup everything worked as
expected. I did not see any note in changes file or elsewhere.
Should I specify white background in .Rprofile differently?
Or is there some other recommended way
2015 Apr 10
2
[LLVMdev] MMX/SSE subtarget feature in IR
Your clang invocation below works for me, and generates target triple in the llvm IR of
i386.
And then in the specific options for the functions it generates the following:
; Function Attrs: nounwind
define float @foo() #0 {
entry:
ret float 1.000000e+00
}
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"=
"true"
2005 Jun 24
1
r programming help II
Dear List,
Suppose we have a variable K.JUN defined as (with
1=wet, 0=dry):
K.JUN1984 = c(1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
K.JUN1985 = c(0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1)
K.JUN1986 = c(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1)
2004 May 27
4
extract columns using their names
Hello,
Is there a way to extract multiple columns from a dataframe using their
names instead of their numbers?
Currently I use:
data2 <- data1[, c(1,3,9)]
And I am looking for something like
data2 <- data1[, c("XX","YY","ZZ")]
I use the same dataframe for many purposes, and I run codes that change
the order of the columns every time.
Many thanks,
Adrian
2004 Aug 06
1
Compile issue with gcc3.2
I've been able to get Speex to compile on gcc 2.95.3 with no problems. When using gcc 3.2 I get the following output:
gcc -DHAVE_DLFCN_H=1 -DHAVE_SYS_SOUNDCARD_H=1 -DHAVE_LIBOGG=1 -DHAVE_LIBM=1 -DVERSION=\"1.0beta1\" -I. -I. -march=pentium4 -mcpu=pentium4 -O3 -pipe -c high_lsp_tables.c -o high_lsp_tables.o
cb_search.c: In function `split_cb_search_shape_sign':
cb_search.c:500:
2012 Oct 16
2
cannot coerce class '"rle"' into a data.frame
why?
> rle
Run Length Encoding
lengths: int [1:1650061] 2 2 8 2 4 5 6 3 26 46 ...
values : chr [1:1650061] "4bbf9e94cbceb70c BG bg" "4fbbf2c67e0fb867 SK sk" ...
> as.data.frame(rle)
Error in as.data.frame.default(vertices.rle) :
cannot coerce class '"rle"' into a data.frame
it seems that
rle.df <-
2006 Apr 03
1
Cannot compile metamail
Hello all,
I've been trying to compile metamail on Centos4.2. But no luck so far.
rpmbuild --rebuild metamail-2.7-30AS.src.rpm
Installing metamail-2.7-30AS.src.rpm
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.96604
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf mm2.7
+ /bin/gzip -dc /usr/src/redhat/SOURCES/mm2.7.tar.Z
+ tar
2008 Dec 11
6
Any way to reduce CPU use of OpenSSH?
On my CentOS v5.2 server (dual Pentium4) the OpenSSH daemon stands out
as being the most CPU-intensive of the applications running, It's used
176 minutes of CPU time in the last 2 days alone.
Is there any way to lower the CPU utilization without compromising
security? (I.e. without using a less processor-intensive
encrypt/decrypt algorithm?)
I'm getting the CPU use figures from top,
2013 Mar 26
2
Feed rle() output to hist()
I want to make a histogram from the lengths vector which is part of the
output of rle. But I don't know how to access that vector so that I use it
as an argument of hist(). What argument must I use so that I use the
lengths vector as an input to hist()?
Example output is:
Run Length Encoding
lengths: int [1:4] 1 2 3 3
values : num [1:4] -1 1 -1 1
A printout of the function rle() may
2011 Jun 17
3
rle on large data . . . without a for loop!
I think need to do something like this:
dat<-data.frame(state=sample(id=rep(1:5,each=200),1:3, 1000,
replace=T,prob=c(0.7,0.05,0.25)),V1=runif(1,10,1000),V2=rnorm(1000))
rle.dat<-rle(dat$state)
temp<-1
out<-data.frame(id=1:length(rle.dat$length))
for(i in 1:length(rle.dat$length)){
temp2<-temp+rle.dat$length[[i]]
out$V1[i]<-mean(dat$V1[temp:temp2])
2011 Jun 23
3
problem (and solution) to rle on vector with NA values
Hello there R-help,
I'm not sure if this should be posted here - so apologies if this is the case.
I've found a problem while using rle and am proposing a solution to the issue.
Description:
I ran into a niggle with rle today when working with vectors with NA values
(using R 2.31.0 on Windows 7 x64). It transpires that a run of NA values
is not encoded in the same way as a run of other