In Matlab, an array can be created from 1 - 30 using the command similar to R
which is 1:30. Then, to make the array step by 0.1 the command is 1:0.1:30
which is 1, 1.1, 1.2,...,29.9,30. How can I do this in R?
-
In theory, practice and theory are the same. In practice, they are not - Albert
I can get around it by doing something like:
as.matrix(rep(1,291))*row(as.matrix(rep(1,291)))/10+.9
I was just hoping for a simple command.
Schatzi wrote:
In Matlab, an array can be created from 1 - 30 using the command similar
to R which is 1:30. Then, to make the array step by 0.1 the
On Fri, May 06, 2011 at 12:11:30PM -0700, Schatzi wrote:
In Matlab, an array can be created from 1 - 30 using the command similar to R
which is 1:30. Then, to make the array step by 0.1 the command is 1:0.1:30
which is 1, 1.1, 1.2,...,29.9,30. How can I do this in R?
...
This may well be a
-project.org
Subject: [R] create arrays
In Matlab, an array can be created from 1 - 30 using the command
similar to R
which is 1:30. Then, to make the array step by 0.1 the command is
1:0.1:30
which is 1, 1.1, 1.2,...,29.9,30. How can I do this in R?
-
In theory, practice and theory
On Fri, May 6, 2011 at 12:11 PM, Schatzi adele_thomp...@cargill.com wrote:
In Matlab, an array can be created from 1 - 30 using the command similar to R
which is 1:30. Then, to make the array step by 0.1 the command is 1:0.1:30
which is 1, 1.1, 1.2,...,29.9,30. How can I do this in R?
Hmm, in
Beautiful.
-Original Message-
From: greg.s...@imail.org [mailto:greg.s...@imail.org]
Sent: Friday, May 06, 2011 02:17 PM
To: Thompson, Adele - adele_thomp...@cargill.com; r-help@r-project.org
Subject: RE: [R] create arrays
?seq
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of adele_thomp...@cargill.com
Sent: Friday, May 06, 2011 12:18 PM
To: greg.s...@imail.org; r-help@r-project.org
Subject: Re: [R] create arrays
Beautiful.
-Original Message-
From: greg.s...@imail.org [mailto:greg.s...@imail.org
Hi, Doug,
maybe
HH - c(0.88, 0.72, 0.89, 0.93, 1.23, 0.86, 0.98, 0.85, 1.23)
TT - c(7.14, 7.14, 7.49, 8.14, 7.14, 7.32, 7.14, 7.14, 7.14)
columnnumbers - c(0, 0, 0, 3, 0, 0, 0, 2, 0)
TMP - lapply( seq( columnnumbers),
function( i, CN, M) {
if( CN[i] == 0)
Hi Gerrit,
Almost it but I need to insert M[,i] as well as (matrix( -1, nrow( M),
CN[i]) when CN[i] = 0
I know this is not correct but can something like the following be done?
HH - c(0.88, 0.72, 0.89, 0.93, 1.23, 0.86, 0.98, 0.85, 1.23)
TT - c(7.14, 7.14, 7.49, 8.14, 7.14, 7.32, 7.14, 7.14,
Hi,
For this example:
O - c(0 0 0 2 0 0 2 0)
I want to create an array every time O[i] 0. The array should be in the
form;
R[j] - array(-1, dim=c(2,O[i]))
i.e. if O[i] 0 4 times I want 4 R arrays.
Does anyone have any suggestions?
Thanks,
Doug
--
View this message in context:
On Fri, Oct 15, 2010 at 9:55 AM, dpender d.pen...@civil.gla.ac.uk wrote:
Hi,
For this example:
O - c(0 0 0 2 0 0 2 0)
I want to create an array every time O[i] 0. The array should be in the
form;
R[j] - array(-1, dim=c(2,O[i]))
i.e. if O[i] 0 4 times I want 4 R arrays.
Does
Hi, Doug,
maybe
columns - c( 0, 3, 0, 2, 0, 1)
lapply( columns[ columns 0],
function( o) array( -1, dim = c( 2, o)))
does what you want?
Regards -- Gerrit
-
AOR Dr. Gerrit Eichner Mathematical
Barry, Gerrit,
That was what I am after but unfortunately only the starting point. I am
now trying to amend a function that inserts the R matrices into a dataset in
the correct places:
i.e.
H - c(0.88, 0.72, 0.89, 0.93, 1.23, 0.86, 0.98, 0.85, 1.23)
T - c(7.14, 7.14, 7.49, 8.14, 7.14, 7.32,
13 matches
Mail list logo