Thanks.
I was not aware of these subtleties of R, but then again I'm no expert. I
had to use isTRUE(all.equal(vec,c(0,0))), but it seems to be working now.
Thanks again.
--
View this message in context:
http://r.789695.n4.nabble.com/Odd-behaviour-of-identical-tp4630118p4630170.html
Sent from t
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)))
Thanks for the help, this worked great! Much appreciated.
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-apply-a-function-to-a-multidimensional-array-based-on-its-indices-tp4629940p4630068.html
Sent from the R help mailing list archive at Nabble.com.
__
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
a
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 = T
That'll do it.
Thanks very much.
--
View this message in context:
http://r.789695.n4.nabble.com/Odd-subsetting-behaviour-tp2279957p2280244.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://sta
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)),nro
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
8 matches
Mail list logo