sed space in a matrix is the
>> > amount of memory it takes. One side effect is that your program may have a
>> > mistake that you would normally catch with a subscript out of bounds error
>> > but with the extra space it now runs without errors.
>> >
>> > Tim
ect is that your program may have a
> > mistake that you would normally catch with a subscript out of bounds error
> > but with the extra space it now runs without errors.
> >
> > Tim
> >
> >
> >
> > -Original Message-
> > From: R-help
atch with a subscript out of bounds error
> but with the extra space it now runs without errors.
>
> Tim
>
>
>
> -Original Message-
> From: R-help On Behalf Of Richard O'Keefe
> Sent: Thursday, February 29, 2024 5:29 AM
> To: Steven Yen
> Cc: R-help Mailin
you would normally catch with a subscript out of bounds error but
with the extra space it now runs without errors.
Tim
-Original Message-
From: R-help On Behalf Of Richard O'Keefe
Sent: Thursday, February 29, 2024 5:29 AM
To: Steven Yen
Cc: R-help Mailing List
Subject: Re:
pt out of bounds error but
with the extra space it now runs without errors.
Tim
-Original Message-
From: R-help On Behalf Of Richard O'Keefe
Sent: Thursday, February 29, 2024 5:29 AM
To: Steven Yen
Cc: R-help Mailing List
Subject: Re: [R] Initializing vector and matrices
[Exte
x <- numeric(0)
for (...) {
x[length(x)+1] <- ...
}
works.
You can build a matrix by building a vector one element at a time this way,
and then reshaping it at the end. That only works if you don't need it to be
a matrix at all times.
Another approach is to build a list of rows. It's not a ma
OK. I initialize real large vector and matrix and then shrink them when
I use them in the loop. The following lines worked. I'd glad to know of
better approaches.
bsum<-rep(0,1000); bsum
vsum<-matrix(rep(0,100),nrow=1000); vsum
for (ind in 1:3) { mydata <- read.csv(paste0("midata", ind, ".c
Is there as way to initialize a vector (matrix) with an unknown length
(dimension)? NULL does not seem to work. The lines below work with a
vector of length 4 and a matrix of 4 x 4. What if I do not know
initially the length/dimension of the vector/matrix?
All I want is to add up (accumulate)
8 matches
Mail list logo