Displaying 20 results from an estimated 1000 matches similar to: "Creating an array [0 to 101] of a list"
2005 Oct 10
3
Vectorizing loop
Hi
I have the following loop and would like to vectorize it. Any ideas if
it is possible?
Thanks,
Rainer
Tha Loop:
for (i in 2:Result$NoSims)
{
ppp <- runifpoint(Result$NoPlants)
K <- Kest(ppp)
Result$LSim[i,] <- sqrt(K$iso / pi) - K$r
CM <- (Result$LSim[i,] * Result$LSim[i,]) / abs(K$r[2] - K$r[1])
Result$SigCM[i] <- sum(CM, na.rm=TRUE)
print(i)
flush.console()
}
2013 Oct 03
1
version comparison puzzle
Can anyone explain what I'm missing here?
max(pp1 <- package_version(c("0.99999911.3","1.0.4","1.0.5")))
## [1] ?1.0.4?
max(pp2 <- package_version(c("1.0.3","1.0.4","1.0.5")))
## [1] ?1.0.5?
I've looked at ?package_version , to no avail.
Since max() goes to .Primitive("max")
I'm having trouble figuring out
2006 Apr 11
1
problems with assign
Hello.
I have n files in a directory: file1, ..., filen.
I read them with the following commands:
list=scan(file="list",what=list(nom=""))
# in the file list, I have all the filenames.
n=length(list[[1]])
for (i in 1:n){
aux <- paste("p",i,sep="")
assign(aux, as.matrix(read.table(list[[1]][i])))
}
R creates the matrices p1,p2,...,pn.
I want
2005 Oct 10
5
Show Progress in loop
Hi
I have a loop which is doing time consuming calculations and I would
like to be able to have some feedback on where it is in it's
calculations. I tried to simply show the counter variable in the loop,
but id doesn't work as all display seems to be delayed until the loop is
completed. Is there any way of displaying the progress of a loop?
Rainer
The loop:
for (i in
2008 Jan 15
2
Looking for simpler solution to probabilistic question
Hi
I have two processes which take with a certain probability (p1 and p2) x
number of years to complete (age1 and age2). As soon as thge first
process is completed, the second one begins. I want to calculate the
time it takes for the both processes to be completed.
I have the following script which gives me the answer, butI think there
must be a more elegant way of doing the calculations
2005 Sep 01
2
SpatStat Kest - Error Message help
Hi I'm working with the function Kest in the package SpatStat (under LINUX
with R 2.1.0). In order to evaluate the statistical significance of my
point pattern I'm doing 999 Montecarlo replications. The script that use
the Kest function runs OK for most of the different point patterns that I
have but for a particular point pattern, which have only 17 points, it
runs until the 34th
2013 Feb 07
2
Spatstat - Kest, envelope problem
Hello,
I am writing cause I have a problem when try to create confidence envelopes
in spatstat.
I have a point data representing firms in my study area.
When I try to create confidence envelopes the error message turns up:
[> p <- envelope(point, fun=Kest, nsim=99)
Error in marks.ppp(Y, dfok = FALSE) :
Sorry, not implemented when the marks are a data frame]
Could you write me how can I
2006 Jan 12
1
envelopes of simulations
Hello!
I am writing you because I could not plot the confidence envelopes for
functions Jest, Jcross, Jdot, Jmulti, and L, using the Spatstat package.
I have already understood how to do that for Kest or Jest, that is:
JEnv <- plot(envelope(PPPData, Jest))
Where PPPData is my ppp object.
However, for Jcross I must specify the two marks I want to analyse.
That is, usually I would get the
2012 Sep 14
0
problem with user defined panel function in xyplot
Hi everyone,
?
I am trying to do a horizonplot using my own time series
data. I know that there is a horizonplot function in latticeExtra, but on
closer examination i think that the graph itself is slightly wrong (it displays
some regions as triangles and i think they should be trapezoids, and the red
regions (that are below the baseline) are displayed on top of the blue areas ?
while i think
2006 Sep 06
4
problem with putting objects in list
Hi
I use the following code and it stores the results of density() in the
list dr:
dens <- function(run) { density( positions$X[positions$run==run], bw=3,
cut=-2 ) }
dr <- lapply(1:5, dens)
but the results are stored in dr[[i]] and not dr[i], i.e. plot(dr[[1]])
works, but plot([1]) doesn't.
Is there any way that I can store them in dr[i]?
Thanks a lot,
Rainer
--
Rainer M. Krug,
2011 Jun 07
2
ggplot2 and facet
I have a data frame (attached) that has interpolated EOT errors for
each minute before flight landing. It also has the runway and an index
for the flight:
> > times[1:4,]
time error runway flight
1 0 -0.02206235 04R 1
2 1 -0.07961631 04R 1
3 2 -0.13795380 04R 1
4 3 -0.20726073 04R 1
> > sapply(times, class)
time error
2009 Nov 20
2
Problem with Numerical derivatives (numDeriv) and mvtnorm
I'm trying to obtain numerical derivative of a probability computed
with mvtnorm with respect to its parameters using grad() and
jacobian() from NumDeriv.
To simplify the matter, here is an example:
PP1 <- function(p){
thetac <- p
thetae <- 0.323340333
thetab <- -0.280970036
thetao <- 0.770768082
ssigma <- diag(4)
ssigma[1,2] <- 0.229502120
2012 Sep 13
6
[newbie] aggregating table() results and simplifying code with loop
Dear all,
I'm looking for primary help at aggregating table() results and at
writing a loop (if useful)
My dataset ( http://goo.gl/gEPKW ) is composed of 23k rows, each one
representing a point in the space of which we know the land cover over
10 years (column y01 to y10).
I need to analyse it with a temporal sliding window of 5 years (y01 to
y05, y02 to y06 and so forth)
For each period
2008 Aug 01
1
bug in readRAST6 function in package spgrass6
Hi
if I try to import a raster layer which consists only of NULL values
from grass by using the readRAST6, I get an error message:
> readRAST6("HSericea_seedsDisperse_2007")
ERROR: Invalid value for null (integers only)
Error in readBinGrid(rtmpfl11, colname = vname[i], proj4string = p4,
integer = to_int) :
no such file:
2008 Mar 26
2
Range across a List
Hi R,
I have a list
> class(pp2)
[1] "list"
> length(pp2)
[1] 1244
It is in the below format
RIC Trade.Date Close.Price Currency.Code Convertion.Rate New.Price
ABCD.SZ 2008/02/29 15.30 CNY 0.1408 2.154240
ABCD.SZ 2008/01/31 15.27 CNY 0.1392 2.125584
ABCD.SZ 2007/12/31 14.88 CNY 0.1371 2.040048
2005 Dec 09
1
O-ring statistic
Rainer M Krug writes:
> Thorsten Wiegand used in his paper Wiegand T., and K. A. Moloney 2004.
> Rings, circles and null-models for point pattern analysis in ecology.
> Oikos 104: 209-229 a statistic he called O-Ring statistic which is
> similar to Ripley's K, only that it uses rings instead of circles.
>
> http://www.oesa.ufz.de/towi/towi_programita.html#ring
2008 Mar 04
1
Ripley's K function within envelope--how to change the maximum distance?
Hi--I'm trying to run a Ripley's K analysis on a point pattern within a window
of 1 square km. The maximum distance I want to use is the diagonal of the
window, around 1400m, run in 50m increments.
The function defaults to a 250m maximum--I thought this was simply the way I had
plotted it, but when I exported the data there was nothing over 250m.
I've looked into seq and ginterval,
2006 Feb 27
2
about"Riply's K function"and "envelope"
hi!
I did Riply's K function and envelope in the package "SPATSTAT". When the
species number is less, it can work well and it is quickly. But when the
species number is more(example:2000), it told me"memory limit". So I change
"memory limit". But the speed is very slow. I took 13 hours to run the
programe.
Perhaps there are other methods that can do it. Or just
2006 Sep 20
4
Calculating mean together with split
Hi
I have a table called npl containing results of simulations.
It contains about 19000 entries and the structure looks like this:
NoPlants sim run year DensPlants
1 6 lng_cs99_renosterbos 1 4 0.00192
.
.
.
it has 43 different entries for sim and year goes from 1 to 100, and run
from 1 to 5.
I would like to calculate the mean of DensPlants for each
2011 Jun 08
3
How to suppress factor labels
I am using ggplot2 to make a boxplot that overlays a scatterplot:
pp = qplot(time, error, data=times, size=I(1), geom="jitter", main=title,
ylab="Error (min)", xlab="Time before ON (min)", alpha=I(1/10),
color=times$runway,
ylim=c(-30,40))
pp2 = pp + with(times, facet_wrap(~ runway, ncol=2))
print(pp2 + geom_boxplot(alpha=.5,