On 30/09/15 12:49, waddawanna wrote:
Hello Steven,
It looks like, there is no in-built function that can do GAUSS ".*"
element-wise multiplication.
Now, if you want to make the desired computations in R, it is actually
preatty straightforward.
a<-c(1,2,3)
b<-matrix(rep(1:9,1),3,3,byrow=TRUE)
On Sep 29, 2015, at 4:49 PM, waddawanna wrote:
> Hello Steven,
>
> It looks like, there is no in-built function that can do GAUSS ".*"
> element-wise multiplication.
> Now, if you want to make the desired computations in R, it is actually
> preatty straightforward.
>
>> a<-c(1,2,3)
>>
I like to multiple the first and second column of a 10 x 3 matrix by
100. The following did not work. I need this in an operation with a
much larger scale. Any help?
aa-matrix(1:30,nrow=10,ncol=3); aa
bb-matrix(c(100,100,1),nrow=1,ncol=3); bb
dim(aa)
dim(bb)
aa*bb
Results:
On Wed, Jan 7, 2015 at 5:05 PM, Steven Yen sye...@gmail.com wrote:
I like to multiple the first and second column of a 10 x 3 matrix by 100.
The following did not work. I need this in an operation with a much larger
scale. Any help?
aa-matrix(1:30,nrow=10,ncol=3); aa
You can create a suitable matrix bb as below (note the byrow = TRUE argument)
aa-matrix(1:30,nrow=10,ncol=3); aa
bb-matrix(c(100,100,1),nrow=10,ncol=3, byrow = TRUE); bb
dim(aa)
dim(bb)
aa * bb
You can also use matrix multiplication, but that;s slightly more involved:
On Wed, Jan 7, 2015 at 3:15 PM, Peter Langfelder
peter.langfel...@gmail.com wrote:
You can create a suitable matrix bb as below (note the byrow = TRUE argument)
aa-matrix(1:30,nrow=10,ncol=3); aa
bb-matrix(c(100,100,1),nrow=10,ncol=3, byrow = TRUE); bb
dim(aa)
dim(bb)
aa * bb
You can
Thank you both. Both John and Peter's suggestions work great!!
At 06:17 PM 1/7/2015, John McKown wrote:
On Wed, Jan 7, 2015 at 5:05 PM, Steven Yen
mailto:sye...@gmail.comsye...@gmail.com wrote:
I like to multiple the first and second column
of a 10 x 3 matrix by 100. The following did not
On Nov 6, 2011, at 12:21 AM, R. Michael Weylandt wrote:
There are a few (nasty?) side-effects to c(), one of which is
stripping a matrix of its dimensionality. E.g.,
x - matrix(1:4, 2)
c(x)
[1] 1 2 3 4
So that's probably what happened to you. R has a somewhat odd feature
of not really
It looks like pdf is not a scalar (that term actually has no meaning in R but
I know what you mean) but is rather a 1x1 matrix, as attested by the fact it
has dimensions. If you give dnorm() a matrix it will return one, as it did
here.
Perhaps you should look at the is.matrix() and
Hi,
R may not have a special scalar, but it is common, if informal, in
linear algebra to refer to a 1 x 1 matrix as a scalar. Indeed,
something like:
1:10 * matrix(2)
or
matrix(2) * 1:10
are both valid. Even
matrix(2) %*% 1:10
and
1:10 %*% matrix(2)
work, where the vector seems to be
Mucha gracias!! as.vector worked like a charm and, in this case,
produced the same results as c():
c(pdf)*v
as.vector(pdf)*v
At 07:02 PM 11/6/2011, R. Michael Weylandt michael.weyla...@gmail.com wrote:
It looks like pdf is not a scalar (that term actually has no
meaning in R but I
There are a few (nasty?) side-effects to c(), one of which is
stripping a matrix of its dimensionality. E.g.,
x - matrix(1:4, 2)
c(x)
[1] 1 2 3 4
So that's probably what happened to you. R has a somewhat odd feature
of not really considering a pure vector as a column or row vector but
being
is there a way to do element-by-element multiplication as in Gauss
and MATLAB, as shown below? Thanks.
---
a
1.000
2.000
3.000
x
1.0002.0003.000
2.0004.0006.000
3.000
Did you even try?
a - 1:3
x - matrix(c(1,2,3,2,4,6,3,6,9),3)
a*x
[,1] [,2] [,3]
[1,]123
[2,]48 12
[3,]9 18 27
Michael
On Fri, Nov 4, 2011 at 7:26 PM, Steven Yen s...@utk.edu wrote:
is there a way to do element-by-element multiplication as in Gauss
and
14 matches
Mail list logo