similar to: Matrix element-by-element multiplication

Displaying 20 results from an estimated 1000 matches similar to: "Matrix element-by-element multiplication"

2005 Dec 29
2
loop
Dear All, I have to use loop over an array so I am using following procedure count<-1 repeat{ count<-count + 1 c(g[count],1:i[count]) ->qw if(count>5)break } as a result qw is [1] 0.9643836 1.0000000 2.0000000 3.0000000 4.0000000 5.0000000 [7] 6.0000000 7.0000000 8.0000000 9.0000000 10.0000000 11.0000000 [13] 12.0000000 13.0000000 14.0000000 15.0000000 16.0000000
2013 Mar 14
1
ggplot2 problem
Hello all! I have a problem with ggplot2 library. I want to do an heat map and the y variables are the year months. If I use the following code, he y values are in alphabetical order, but I want it in month order. The code is: library(reshape) library(ggplot2) library(scales) p <- ggplot(data.m, aes(variable, Month)) + geom_tile(aes(fill = value),
2011 Nov 28
3
Rprofile.site
Dear All I inserted a frequently used function (subroutine) right into my Rprofile.site which allows me to run it each time-works great. However, this approach is obviously suitable for a short function or a small number of functions. Instead of inserting the lines in Rprofile.site, is there a way to insert one line pointing to (fetching) the function in a local drive, similar to #include
2007 Jan 30
2
Rbind for appending zoo objects
Hi R, y1 <- zoo(matrix(1:10, ncol = 2), 1:5) colnames(y1)=c("a","b") y2 <- zoo(matrix(rnorm(10), ncol = 2), 6:10) colnames(y2)=c("b","a") > y1 a b 1 1 6 2 2 7 3 3 8 4 4 9 5 5 10 > y2 b a 6 0.9070204 0.3527630 7 1.2405943 0.8275001 8 -0.1690653 -0.1724976 9 -0.6905223 -1.1127670 10
2017 Nov 16
3
Manera eficiente de añadir el valor anterior por grupo
Buenas Tengo un Data table de la siguiente manera: datos<-data.table(grupo=rep(c("a","b"),5),x=c(1:10),y=rnorm(10,2,1)) Lo que quiero es añadir una fila por cada grupo y en esa nueva fila, al valor de la x ponerle el valor anterior de la y Lo que hago es añadir una nueva fila por grupo, con: datos[,.SD[1:(.N+1)],by=grupo] Y para añadir el valor anterior uso la función
2012 Sep 11
1
lapply with different size lists?
Hello, I have 2 functions (a and b) a = function(n) { matrix (runif(n*2,0.0,1), n) } > > > b = function (m, matrix) { > n=nrow (matrix) > p=ceiling (n/m) > lapply (1:p, function (l,n,m) { > inf = ((l-1)*m)+1 > if (l<p) sup=((l-1)*m)+m > else sup=n >
2011 Nov 15
5
Convert back to lower triangular matrix
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0 The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 = dist(ab,"euclidean")> dd1    1   2   3   4   52 0.1                3 0.2 0.1            4 0.3 0.2 0.1        5 0.4 0.3 0.2 0.1    6 0.5 0.4 0.3 0.2 0.1 Convert the lower triangular matrix to a full
2006 Feb 06
2
novice questions about programming in "R"
folks, I have been struggling with the "R" documentation for too long now and I need a simple answer on two questions. The documentation does not have adequate examples. Please help. given two equal vector lists: A <- c(0,1,2,3) B <- c(5,6,7,8) [Question #1] how do I dump them to a text file with the following format:
2010 Jan 29
7
Simple question on replace a matrix row
Hello, I have a matrix mat1 of dim [1,8] and mat2 of dim[30,8], I want to replace the first row of mat2 with mat1, this is what I do: mat2[1,]<-mat1 but it transforms mat2 in a list I don't understand, I want it to stay a matrix... ----- Anna Lippel -- View this message in context: http://n4.nabble.com/Simple-question-on-replace-a-matrix-row-tp1427857p1427857.html Sent from the R help
1998 Sep 25
1
format(numericmatrix, ...) : proposal for a change
Since format, i.e., format.default(.), is a pretty basic function I thought I'd ask before just changing it... aa <- cbind(1:7, rnorm(7)) format(aa) or format(aa, digits=7) looks like [,1] [,2] [1,] " 1.0000000" " 0.2406669" [2,] " 2.0000000" "-0.4973221" [3,] " 3.0000000" " 0.4672260" [4,] "
2006 Sep 17
2
histogram frequency weighing
Fellow R-helpers, Suppose we create a histogram as follows (although it could be any vector with zeroes in it): R> lenh <- hist(iris$Sepal.Length, br=seq(4, 8, 0.05)) R> lenh$counts [1] 0 0 0 0 0 1 0 3 0 1 0 4 0 2 0 5 0 6 0 10 0 9 0 4 0 [26] 1 0 6 0 7 0 6 0 8 0 7 0 3 0 6 0 6 0 4 0 9 0 7 0 5 [51] 0 2 0 8 0 3 0 4 0 1 0 1 0 3
2008 Feb 12
4
summary statistics
below is my data frame. I would like to compute summary statistics for mgl for each river mile (mean, median, mode). My apologies in advance- I would like to get something like the SAS print out of PROC Univariate. I have performed an ANOVA and a tukey LSD and I would just like the summary statistics. thanks stephen RM mgl 1 215 0.9285714 2 215 0.7352941 3 215 1.6455696 4 215
2016 Feb 18
2
Substitute pdftk with other command
Il giorno gio, 18/02/2016 alle 17.34 +0100, Yamaban ha scritto: > On Thu, 18 Feb 2016 16:07, Dario Lesca wrote: > > > Hi, I must migrate a Centos5 server on Centos7 > > > > On server Centos5 there is a shell procedure witch add to PDF a > > timestamp like this example: > > > > http://i.stack.imgur.com/OBsqX.png > > > > with this command:
2009 Dec 17
1
poly() with unnormalized values
How can I get the result of, e.g., poly(1:3. degree=2) to give me the unnormalized integer coefficients usually used to explain orthogonal polynomial contrasts, e.g, -1 1 0 -2 1 1 As I understand things, the columns of x^{1:degree} are first centered and then are normalized by 1/sqrt(col sum of squares), but I can't see how to relate this to what is returned by poly(). >
2007 Oct 29
2
help please
hello, please can anyone help me out. Am a new user of R program. Am having problem with this code below, not getting the expected results. Each m, the cumulative sum should be 1.000 but the 2nd and 3rd m returned 2.000 and 3.000 instead of 1.000. thanks Aruike pp=function(x,n,M){z=1.0;a=2.3071430;b=7.266064;H=3 out.h=c() out.y=c() out.m=c() out.prob=c()
2009 Feb 19
4
Matrix package: band matrix
I want to construct a symmetric band matrix in the Matrix package from a matrix where the first column contains data for the main diagonal, the second column has data for the first subdiagonal/superdiagonal and so on. Since the Matrix will be 10^5 x 10^5 or so, with perhaps 10-20 non-zero elements above the diagonal per row, I can't do it by constructing a full matrix and then using the
2005 Oct 05
2
problem accumulating array within a function over loops
Dear R helpers, I am having trouble with an array inside a loop. I wish to accumulate the results of a function in an array within the function, over several loops of a program outside the function. The problem is that the array seems to re-set at every entry to the function. Here is an example, so you can see what I mean.
2006 Dec 05
1
Spearman correlation ties and discrepancies
Hi. I am currently trying to run some Spearman correlations, and have encountered two issues. 1) When using cor.test() with a variable that includes ties, I get the "Cannot compute exact p-values with ties" error. I have read that this function now uses an asymptotic formula that allows for ties, so do not understand why I am getting this error. (I am running version 2.4.0.) I
2007 Oct 26
5
help
hello, please can anyone help me out. Am a new user of R program. Am having problem with this code below, not getting the expected results. 1. Each m, the cumulative sum should be 1.000 but the 2nd and 3rd m returned 2.000 and 3.000 instead of 1.000. 2. to get the LCL(m) and UCL(m) for each m base on these instructions if out.cum > 0.025 then LCL(m)= y-1 if out.cum >0.975
2011 Apr 17
1
Samba AD member and connections from non-AD systems
Hi - I've scoured the mailing list archives as well as other help sources online and haven't figured out what my problem is or what I'm doing wrong. Any help would be greatly appreciated. Scenario: I have a samba 3.5.5 server running on CentOS 5.5. This system is a member of an Active Directory domain. FYI, I am not the domain administrator, but I am an OU admin and can create