similar to: diag() when input is a numeric scalar

Displaying 20 results from an estimated 2000 matches similar to: "diag() when input is a numeric scalar"

2016 Apr 05
5
R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]
hi, i am new in this field. do favorite<http://stackoverflow.com/questions/36404707/simulation-study-of-2-sample-test-on-different-combination-of-factors#> If I wish to conduct a simulation on the robustness of two sample test by using R language, is that any ways in writing the code? There are several factors (sample sizes-(10,10),(10,25),(25,25),(25,50),(25,100),50,25),(50,100),
2018 Sep 17
2
diag(-1) produces weird result
On Mon, Sep 17, 2018 at 5:22 PM, G?bor Cs?rdi <csardi.gabor at gmail.com> wrote: > I would say it is a mis-feature. If the 'x' argument of diag() is a > vector of length 1, then it creates an identity matrix of that size, > instead of creating a 1x1 matrix with the given value: > > ? diag(3) > [,1] [,2] [,3] > [1,] 1 0 0 > [2,] 0 1 0
2018 Sep 18
0
diag(-1) produces weird result
Yes, both are rooted in age-old design infelicities (in which, basically, interactive expedience has taken precedence over consistency and generality). Unfortunately, they are quite difficult to rectify, because there are bound to be countless uses of, say, diag(5) as a 5x5 identity matrix which would break if it suddenly meant the 1x1 matrix(5) instead. We'd need a very carefully
2012 May 23
1
numerical integration
Greetings, Sorry, the last message was sent by mistake! Here it is again: I encounter a strange problem computing some numerical integrals on [0,oo). Define $$ M_j(x)=exp(-jax) $$ where $a=0.08$. We want to compute the $L^2([0,\infty))$-inner products $$ A_{ij}:=(M_i,M_j)=\int_0^\infty M_i(x)M_j(x)dx $$ Analytically we have $$ A_{ij}=1/(a(i+j)). $$ In the code below we compute the matrix
2016 Feb 09
4
OpenSwan Drop Out Issue
Hello, I'm cross posting this from the OpenSwan mailing list, in case someone here can help. We have two sites connected via OpenSwan 2.6.32-9 on CentOS 5, sharing 6 /24 subnets each (so 12 in total). The problem we're having is completely randomly, be it in the middle of the day, or in the middle of the night (so I don't believe it's traffic related), certain (and sometimes
2007 Feb 19
1
need help in reading TOMS observed ASCII data file
Hello R Users, I am new to R. I have two data sets i) TOMS aerosol optical depth(AOD) and ii) TOMS ozone(O3). > > AOD data is on 1x1 grid and O3 data is on 5x5 grid. > > First I want to read AOD and O3 as it is and then I want to regrid AOD on > 5x5 grid as O3. > > Reading is first problem. > > FIRST PROBLEM READING AOD: > > AOD data is in following format: >
2007 Jan 24
2
modify rectangle color from image
Hi, I need some suggestion on how I could modify the color on some rectangle that I have created using "image". In other words, I have a 5x5 matrix, say, m. m <- matrix(rnorm(25), nrow=5) I create a grid of rectangles by: image(m) Now I want to change the color of rectangle (3,3) to blue. I don't know how this could be done, and searching the web has
2012 May 23
0
numerical integrals
Greetings,   I encounter a strange problem computing some numerical integrals on [0,oo). Define $$ M_j(x)=exp(-jax) $$ where $a=0.08$. We want to compute the $L^2([0,\infty))$-inner products $$ A_{ij}:=(M_i,M_j)=\int_0^\infty M_i(x)M_j(x)dx $$ Analytically we have $$ A_{ij}=1/(a(i+j)). $$ In the code below we compute the matrix $A_{i,j}$, $1\leq i,j\leq 5$, numerically and check against the known
2006 Jul 27
3
how to resample (or resize) matrix?
Dear r-help, I have a matrix, suppose, 10x10, and I need the matrix 5x5, having in each cell a mean value of the cells from the initial matrix. Please, point me to a function in R, which can help me doing that. Digging the documentation and mail archives didn't give me a result. Thank you. --- Best regards, Vladimir mailto:wl at eimb.ru
2003 Jul 07
2
(PR#3427)
Hi; I am having problems inverting matrices using the function solve() For example R can not invert the following matrix [,1] [,2] [,3] [,4] [,5] [1,] 25 500 11250 275000 7.106250e+06 [2,] 500 11250 275000 7106250 1.906250e+08
2005 Aug 12
6
evaluating string variables
Hello!!! I have a folder (C:/R/) with matrix files, named by number, i.e. 0.mat, 1.mat,...,1250.mat. In this case, they are 5x5 simetric matrices. I would like to compute a property for each matrix and put calculated values into a data frame for posterior ploting and printing. Below there is an example for 7 matrices (0.mat..6.mat) #define data frame L <- data.frame(frame=numeric(7),
2007 May 11
1
Create an AR(1) covariance matrix
Hi All. I need to create a first-order autoregressive covariance matrix (AR(1)) for a longitudinal mixed-model simulation. I can do this using nested "for" loops but I'm trying to improve my R coding proficiency and am curious how it might be done in a more elegant manner. To be clear, if there are 5 time points then the AR(1) matrix is 5x5 where the diagonal is a constant
2004 Jul 16
1
median filter
Dear R users, Does anyone know if there's a median filter available in R? I have a considerable amount of images as 256 by 256 matrices and want to smooth them with a 5x5 median filter. Until now I'm not lucky in searching the R-help list/files. Thanks, Hanneke ir. J.M. (Hanneke) Schuurmans (PhD student) Department of Physical Geography Faculty of Geosciences, Utrecht University, The
2008 May 18
1
predict.prcomp: 'newdata' does not have the correct number of columns
Hi, I'm doing PCA on wide matrices and I don't understand why calling predict.prcomp on it throws an error: > x1 <- matrix(rnorm(100), 5, 20) > x2 <- matrix(rnorm(100), 5, 20) > p <- prcomp(x1) > predict(p, x2) Error in predict.prcomp(p, x2) : 'newdata' does not have the correct number of columns > dim(x2) [1] 5 20 > dim(p$rotation) [1] 20 5
2009 Jun 01
1
using "cochran.test()" as a "mcnemar.test()" ?
Hello all I wish to perform a mcnemar.test() for a 5X5 matrix. Wikipedia tells me (http://en.wikipedia.org/wiki/Cochran_test) I should turn to cochran.test. The only place I found it was in the "outliers" package, but the command cochran.test() acts differently then mcnemar.test() , and doesn't take a table as input. Any ideas on how to use it ? #Example code: aa =
2009 Jul 22
1
R extract vertices for polygon
Dear R users, I'm trying to extract from a given matrix (GROUP) the coordinates of the vertices of the different groups (i.e. 3, 7, 1 . . .) to plot the polygons to delineate the area in which each group "wins" and colour it diferentially. I can make a simple point plot, but I would like to add polygons with full colored area. The example is with a 5x5 matrix, but I'm working
2010 Jan 14
1
Extracting data from a list of matrices
Hi, Apologies in advance for the basic nature of my question. I am still very much a rookie when it comes to R. Having googled it, checked Nabble and trial/error to the best of my ability, I have yet to find an easy solution. I am currently working with a list of 5x5 matrices, and want to extract a list consisting of the first number of each matrix. In other words I want to go from: [[1]]
2011 Apr 07
1
An extention of outer() ?
Dear all, as per my understanding, outer() function is to facilitate 2-dimensional function evaluation, like to evaluate f(x,y) for different values of x and y. However I have slightly modified version of that, where x is a matrix with, say, 5 rows and 2 columns and y is a vector. Let take following example: fn1 <- function(x1, x2, y) return (x1+x2+y) x <- matrix(1:10, nc = 2) y
2010 Jan 07
1
"diag", "diag<-" and "[" , "[<-"
Dear all I have the following problem. M <- matrix(0,3,3) # dimension of M is dinamic and this can lead to the next subscript diag(M[1,1]) <- rep(100,1) #Error in `diag<-`(`*tmp*`, value = 100) : # only matrix diagonals can be replaced diag(M[1,1,drop=F]) <- rep(100,1) #Error in diag(M[1, 1, drop = F]) <- rep(100, 1) : # incorrect number of subscripts diag(M[2:3,1:2]) <-
2009 Dec 04
1
latex.table for table with character and numeric columns
Hallo, I have a dataset with one or two columns with character data and the rest with numeric data. Using latex.table from the quantreg package produced a table, but I cannot set the decimals. For instance: --- > x<-data.frame(Name=c("Jan","Piet","Jan"), V=c(1,2.991,3)) > latex.table(as.matrix(x),file="x",caption="x") >