search for: nmat

Displaying 5 results from an estimated 5 matches for "nmat".

Did you mean: nat
2002 Apr 09
1
Problem handling NA indexes for character matrixes (PR#1447)
In a package I've been developing for manipulating genetic data I discovered a problem when indexing into character arrays using NA's: Create a character matrix and a numeric matrix > cmat <- matrix( letters[1:4], ncol=2, nrow=2) > nmat <- matrix( 1:4, ncol=2, nrow=2) Create an index vector containing an NA value > indvec <- c(1,2,NA) Indexing works fine for both matrixes when we only pull off *one* column: > cmat[ indvec, 1 ] [1] "a" "b" "NA" > nmat[ indvec, 1 ] [1] 1 2 NA...
2011 May 04
0
Fwd: simple question
...es K1 <- c(1,2,1, 1, 1,1); K2 <- c(1, 1,2,2, 1,2); K3 <- c(3, 1, 3, 3, 1, 3) M1a <- rep( K1, 100); M1b <- rep(K2, 100) M2a <- rep(K1, 100); M2b <- rep(K1, 100) M3a <- rep(K1, 100); M3b <- rep(K3, 100) mydf <- data.frame(M1a, M1b, M2a, M2b, M3a, M3b) # matrix operation nmat <- matrix(c(paste('M', 1:3, 'a', sep = ''), paste('M', 1:3, 'b', sep = '')), 3) coffin <- function(x) { x <- as.vector(x) d1cf <- ifelse(mydf[x[1]] == mydf[x[2]],0,1) # idea is if first comulm is equal to second column then the value...
2009 Jun 20
1
png() resolution problem {was "Silhouette ..."}
...k at this issue. Hmm, I've been at a conference in Italy... The silhouette plot only uses standard R plotting functions, so any problem with it exposes problems in standard R graphics. --> Such a message should really go to R-help. to which I CC now. ---------- library(cluster) nmat <- matrix(rnorm(2500*300), ncol=300, nrow=2500) rmat <- matrix(rchisq(1000, 300, 50), ncol=300, nrow=1000) mat <- rbind(nmat, rmat) pr <- pam(mat, 2) sil <- silhouette(pr) png("sil.png") #postscript("sil.ps") plot(sil) dev.o...
2012 Oct 09
2
Text file: multiple matrix
Hi there! I'm a newbie in R This is my problem: I have a txt file composed by 100 matrix (256x256) separated by a blank line! How can I save automatically the matrix in separated txt file (100)? e.g. 1? matrix from line 1 to line 256 257 blank line 2?matrix from line 258 to line 513 514 blank line 3? matrix from line 515 to line 770 771 blank line 4? matrix from line 772 to line 1027......
2008 Nov 08
4
Plotting Standard Regression Fit-Am I wrong or a bug?
I'm trying to plot a time series (quarterly observations, seasonal effect, T=56),regression line and predicted point on the same plot. I'm using following commands: > plot(qdts,xlim=c(1982,1997)) > lines(fitted(m2)~time,data=qd,col="red") > points(predict(m2,newdata=nqd),col="blue") where: qdts<-ts(qd$durables,start=c(1982,1),freq=4)