Displaying 6 results from an estimated 6 matches for "math_daddi".
Did you mean:
math_daddy
2010 May 17
2
retrieving last R output
Hello.
I ran a simulation that took a few days to complete, and want to analyze the
results, but have just realized that I (idiotically) did not assign the
output to a variable when I intitiated the simulation. Is there any way to
retrieve the last output produced by R so that these last few days were not
a waste?
Thank you very much.
--
View this message in context:
2012 May 15
0
How to apply a function to a multidimensional array, based on its indices
Hello,
Your way is much better than to mess with the dim attribute, like I did.
But,
"If you can create a data.frame or matrix that has the indices"
Actually, it must be a matrix, indices can't be of type list.
A way to avoid loops/apply altogether, and much faster, is the one
creating K3
(K is the result from the op.)
n <- 20
t2 <- system.time({
K2 <-
2010 Jul 19
2
problems with plot()
I have a list of vectors of length 2, each representing a point in 2-space,
and each of which I wish to plot on the current plot.
In a loop, I assign the x and y coordinates of the current element of the
list to variables 'x' and 'y' respectively, then make a call to plot as
follows:
par(new = TRUE)
plot(x,y, xlim = c(0,1),ylim=c(0,1), xlab <- "x", ylab <-
2012 May 15
1
Odd behaviour of identical()
Consider the following code:
test <- function(n)
{
for(x in 1:n)
{
for(y in 1:n)
{
for(r in max(x-1,1):min(x+1,n))
{
for(s in max(y-1,1):min(y+1,n))
{
vec <- c(x-r,y-s)
print(c("vec = ", vec))
print(identical(vec,c(0,0)))
}
}
}
}
}
If you run test(2) you'll see a printout of the values
2010 Jul 06
2
Odd subsetting behaviour
Hello. I've observed some odd behaviour. Most likely, it is already known and
explained somewhere, but I can't find an explanation anywhere, so I would
appreciate being pointed in the right direction.
The issue with the following code is self explanatory:
> mat <- matrix(c(c(1,1,1),c(2,2,2)),nrow=3)
> mat[,c(1:3%/%2)]
[,1] [,2]
[1,] 1 1
[2,] 1 1
[3,] 1 1
2012 May 14
3
How to apply a function to a multidimensional array based on its indices
Hello. I have a 4 dimensional array and I want to fill in the slots with
values which are a function of the inputs. Through searching the forums here
I found that the function "outer" is helpful for 2x2 matrices but cannot be
applied to general multidimensional arrays. Is there anything which can
achieve, more efficiently than the following code, the job I want?
K <-