Displaying 20 results from an estimated 6000 matches similar to: "eval(parse(...)) only once in a function"
2012 Oct 26
2
connect points in charts
Hi
is there a automatic way that long distances between points are not
connected. I have something like
plot(x,y,type="o",...)
atx <- seq(as.Date("2009-04-01"),as.Date("2011-04-01"),"month")
axis.Date(1, at=atx,labels=format(atx, "%b\n%Y"), padj=0.5 )
but I do not want lines between points whose distance is greater than
two weeks.
thx
2012 Jul 02
2
save conditions in a list
Hi
how would you save conditions like
a = "day > 100"; b = "val < 50"; c = "year == 2012"
in a list? I like to have variables like "day", "val", "year" and a list
of conditions list(a,b,c). Then I want to check if a & b & c is true or
if a | b | c is true or similar things.
Greetings
Christof
2012 Aug 14
3
self-starter functions for y = a + b * c^x
Hi
there are some predefined self-start functions, like SSmicmen, SSbiexp,
SSasymp, SSasympOff, SSasympOrig, SSgompertz, SSflp, SSlogis, SSweibull,
Quadratic, Qubic, SSexp (nlrwr)
Btw, do you know graphic examples for this functions?
The SSexpDecay (exponential decay) for y = (y0 - plateau)*exp(-k*x) +
plateau from
2012 Oct 02
3
lattice xyplot, get current level
Hi
xyplot(y ~ x | subject) plots a separate graph of y against x for each
level of subject. But I would like to have an own function for each
level. Something like
xyplot(y ~ x | subject,
panel = function(x,y) {
panel.xyplot(x,y)
panel.curve(x,y) {
# something that dependents on the current subject
...
}
})
How I get the current
2012 Jan 20
3
break an axis.POSIXct
Hi
I like to use "axis.POSIXct" to plot days from 2006 till 2008. But I
only have datas for the summer months. Is it possible to get two axis
breaks, to have not so long distances without points?
thx
Christof
2012 Jan 09
2
RODBC vs gdata
Hi
one col in my Excel file contains many numbers. But on line 3000 and
some other lines are strings like "FG 1". "RODBS" seems to omit this
lines. "gdata" works, but is much slower.
Is this a bug of RODBC or do I apply it wrong?
Example with the same "file.xlsx"
library(RODBC); excel <- odbcConnectExcel2007("file.xlsx")
tab <-
2011 Nov 26
2
simplify source code
Hi
I would like to shorten
mod1 <- nls(ColName2 ~ ColName1, data = table, ...)
mod2 <- nls(ColName3 ~ ColName1, data = table, ...)
mod3 <- nls(ColName4 ~ ColName1, data = table, ...)
...
is there something like
cols = c(ColName2,ColName3,ColName4,...)
for i in ...
mod[i-1] <- nls(ColName[i] ~ ColName1, data = table, ...)
I am looking forward to help
Christof
2011 Dec 09
1
apply on function with vector as result
Hi,
a have some code like
myfunc <- function(x) { ...; return c(a,b) }
ys <- sapply(0:100,myfunc)
so I get something like c(c(a1,b1),c(a2,b2),...)
But now I need the "as" and "bs" in one vector
as <- apply(ys, function(c(a,b)) a)
bs <- apply(ys, function(c(a,b)) b)
Can you help me with the correct syntax, instead of my pseudo code?
thx
Christof
2012 Jul 21
1
alternative to rbind for data.table
Hi
I want to add a row to a "data.table" in each round of a for loop.
"rbind" seems to be a inefficient way to implement this.
How would you do this? The "slow" solution:
library(data.table)
Rprof("test.out")
dt <- data.table()
for (i in (1:10000)) {
# algorithm that generates a list with different values,
# but same key-names, each round, for
2012 Sep 25
1
nlme function examples for dose-respone
Hi,
I want to fit nonlinear dose-response curves, as "fun(X,a,b,c)", for
each of our 5 trail locations. Our data basis is something like
location plot year dose response
For each location there are 4 plots as repetitions (over 3 years). So
the interactions "location*year" and "location*plot" should be random
effects.
There are some examples in "Mixed-Effects
2013 Jul 23
1
optimize integer function parameters
Hi
I have "observations" obs <- (11455, 11536, 11582, 11825, 11900, ...)
and a simulation function f(A,B,C,D,E,F), so sim <- f(A,B,C,D,E,F)
e.g. sim = c(11464, 11554, 11603, 11831, 11907, ...)
now I would like to fit A,B,C,D,E,F such that "obs" and f(A,B,C,D,E,F)
match as well as possible. A,..,F should be integers and have bounds.
How would you solve this problem
2012 Jan 05
3
selection part of "subset"
Hi
I want to do something like
a <- c(10,20,15,43,76,41,25,46)
tab <- data.frame(a)
name <- "a"
for (v in unique(tab[[name]])) {
r <- subset(tab, name==v) # this does not work
...
}
i.e. a "string" on the left side of the select expression (subset). How
could I solve this?
thx
Christof
2012 Jun 13
4
lme: extract result-function
Hi,
mod <- lme(A ~ -1 + B+C+D+E+F+G, random = ~1 | ...)
results in summary(mod)$coeff
B C D E F G (Intercept)
b c d e f g i
Now I'm interested in the function
f <- function(B,C,D,E,F,G) <- {
return(i + b*B + c*C + d*D + e*E + f*F + g*G)
}
Is there a easier way to create such function with flexible number of
coefficient, than do it by hand?
thx
Christof
2012 Feb 12
2
plotting dates, incorrectly scaled x-axis?
Hi,
I want to plot with axis.Date(), but something is scaled incorrectly.
The red vertical line in is put on a totally wrong position. (sample below)
Do you have an idea what I'm doing wrong?
Thx
Christof
x11(width=30, height=20)
x<-seq(as.Date("2010-02-27"), as.Date("2011-03-28"),"month")
y <- seq(0,100,length=length(x))
plot(y ~ x,
2013 Mar 28
1
make R program faster
Hi
there are some good tips in "The R Inferno"
http://www.burns-stat.com/documents/books/the-r-inferno/
or connect C++ to R with Rcpp
http://dirk.eddelbuettel.com/code/rcpp.html
or byte code compiler (library(compiler))
or library(data.table)
but do you have an idea to fasten standard R source code, with the
following Rprof output
self.time self.pct total.time
2010 Aug 05
3
eval-parse and lme in a loop
Hi everybody,
I'm having trouble getting an eval-parse combination to work with lme in a for loop.
Consider the code below. The call to lme outside the loop works. The call to aov inside the loop works, but the call to to lme inside the loop does not.
The latter fails with
Error in model.frame.default(formula = ~meanCol + Group + c1 + c3 + Subject, :
variable lengths differ (found for
2012 Sep 24
1
eval and tcltk : target of assignment expands to non-language object
Hi everyone,
I have a problem to assign a value with tcl/tk
ths is the code ( it should be simple to understand) :
library(tcltk)
valA<-tclVar("0")
valB<-tclVar("0")
valC<-tclVar("0")
id<-"A"
out<-"1"
out2<-"2"
print(paste("tclvalue(val",id,")",sep="")) # ok
1998 Sep 30
4
R-beta: compiling R-0.62.3 on SuSe Linux
On my RedHat 5.1 machine at the office I am happily using R
installed from Martyn Plummer's RPM's of R-62.3 for RH 5.1
At home I have SuSe Linux 5.3 on my PC and as RH 5.1 is libc6
based and SuSe 5.3 is still libc5 based the RH 5.1 RPM's do
not install and work on SuSe (even though they have a test
version of glibc).
So I downloaded R-0.62.3.tgz from www.ci.tuwien.ac.at/R and
tried
1998 Nov 13
3
SuSE package
Hi
Is there a SuSE binary package for R 0.64?
John
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
2010 Jan 25
2
Two == expressions in bquote
Hi,
I want to put text on a plot containing something like: a = b^2 = <squared numeric value of b> using bquote.
Example:
mu = 5
plot(1:10,1:10)
text(2,8, bquote(delta == mu^2)) # This works
text(2.5,8, bquote(phantom(0) == .(mu^2))) # but is unpredictable
text(2,8, bquote(delta == mu^2 == .(mu^2))) # This doesn't work
The last text function returns the error: