similar to: Re place values matrix

Displaying 20 results from an estimated 30000 matches similar to: "Re place values matrix"

2008 Oct 31
4
[ifelse] how to maintain a value from original matrix without probs?
Dear all, I have a matrix with positive and negative values. >From this I would like to produce 2 matrices: 1st - retaining positives and putting NA in other positions 2nd - retaining negatives and putting NA in other positions and then apply rowMeans for both. I am trying to use the function ifelse in the exemplified form: ifelse(A>0,A,NA) but by putting A as a 2nd parameter it
2010 Jun 10
2
adding column of ordered numbers to matrix
Hello everyone, I have a matrix of over 40000 line and about 30 columns. For my analysis I would like to add another column with ascending numbers (column header should be "order", and than 1,2,3,4 ....the end of the matrix). During my analysis I reorder them ( due to merge commands by a different column). How do I add such a column in an ascending order (or descending for what it
2009 Jan 13
2
Can't Destroy Dim Names
Dear all, I have the following matrix: > str(mat) Named chr [1:32268] "yQAAA" "jQAAQ" "UQAAg" "FQAAw" "1QABA" ... - attr(*, "names")= chr [1:32268] "CAAAAAAAAA" "CAAAAAAAAC" "CAAAAAAAAG" "CAAAAAAAAT" ... I want to destroy the attribute yielding only this: > str(mat) Named chr [1:32268]
2009 May 05
3
Heatmap without levelplot
Hi there, as I'm not sure to understand the coloring levelplot uses, I'm looking for another easy way to create a heatmap like this: library(lattice) mat <- matrix(seq(1,5, length.out = 12), nrow = 3) mat[1,2] <- 3.5 my.at <- seq(0.5,5.5, length.out = 6) my.col.regions <- rainbow(5) graph <- levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = my.col.regions)
2010 Feb 26
7
How to add a variable to a dataframe whose values are conditional upon the values of an existing variable
Hi everyone, I am at my wits end with what I believe would be considered simple by a more experienced R user. I want to know how to add a variable to a dataframe whose values?are conditional?on the values of an existing?variable.?I can't seem to make an ifelse statement work?for my situation.?The existing variable?in my dataframe is?a character variable named DOW which contains abbreviated
2010 Sep 01
2
Legend with fill = gray ?
Hi, I am facing a problem with the legend, I don?t know how to use the fill option in the legend in order to achieve the same standard gray levels that are plotted. Sorry for this easy one, but I really did not find anything so far. It works fine with color: ###### C O L O R mat <- matrix(2,3,rep(2,6)) rownames(mat)<-c("A","B","C") par(xpd=T,
2009 Feb 18
2
Re place Values within vector using Translation vector
Dear everyone I would like to change values in vectors doing a translation. i.e. I have a start vector giving me the levels in one vector (numbers 1 to x - rating) and then I have a second vector giving me the values to be allocated (loss probabilities), but the number of potential rating classes and loss estimates is still subject to a lot of discussion. Attached a simplified version of the
2009 Nov 12
2
simulated correlated vectors
Hi, Having a vector x of float type without any assumption of its distribution (mean, variance etc), how to generate another vector that is correlated with x? Extensibility: how to simulate more than two correlated vectors (again float type and no preference for their distribution and without having vector x)? Cheers, Carol
2008 Sep 27
2
Trend graph
Dear R Gurus, I have a problem related to plot. For example, I have two variables, pre and post. pre <- c(1,2,3,4,5) post <- c(2,5,7,2,3) How can I plot a line graph similar to this one? http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1847566&rendertype=figure&id=F1 Would you please provide me a keyword so that I can search. I don't know what is the name of this
2008 Oct 22
4
A matrix automation problem
[I am really sorry if it is double posted, I doubt me previous post could not reach forum due to some problem with net] Suppose I have a matrix : a = matrix(1:9, 3) >From this matrix, I construct 9 additional matrices : i = 1:9 bi = a * i Now combining all those 9 new matrices, I construct a final metrix as : c = b1 b4 b7 b2 b5 b8 b3 b6 b8 I want to automate this procedure for any
2008 Oct 02
1
combining bar and line plots with multiple axes
Hey list, I have a barplot with a line plot overlayed (on the 2nd y axis) and it looks fine except that the origin (0) on the 2nd y axis (side=4) is not lining up with the origin on the 1st y-axis (side=2, from the barplot). Is there a way to either shift the 2nd y-axis (line plot) down or readjust the barplot axis? Just as a reference, here is the code: barplot2(temp$precip,
2008 Oct 22
3
retrieving matrix elements by giving pairs of row AND column numbers?
Hi, this is probably a very trivial question but I can't figure out the right terms to find the solution in the list archive. I have a matrix or a data.frame or the like: > m <- matrix(ncol=3,seq(1,9)) > m [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 and now I wonder if one can provide somehow two vectors, one containing row numbers, the other
2008 May 30
1
Get all X iterations in optim output when controls(trace=6)
Hi, I would like to get all X iterations in optim output in matrix form. I know about the follow approach: sink("reportOptim") optim( ......., control=list( trace=6,..........) ) sink() all_iterOptim <- readLines("reportOptim") unlink("reportOptim") all_iterOptim <- all_iterOptim[ grep( '^X', all_iterOptim ) ] ### TODO: the rest !!! :-) But it is very
2008 Feb 26
2
Summing up diagonals w/o for-loop
? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile Url: https://stat.ethz.ch/pipermail/r-help/attachments/20080226/43b3a38b/attachment.pl
2009 Aug 12
3
Obtaining the value of x at a given value of y in a smooth.spline object
I have some data fit to a smooth.spline object as follows: (x=vector of data for the predictor variable, y=vector of data for the response variable) fit <- smooth.spline(x,y) Now, given a spline fit point y_new, I want to be able to find out what value of x_new yielded this fit value. How to do so? (This problem is the inverse of the predict.smooth.spline function, which takes x_new as input
2008 Jun 29
3
Interactive plot
Hi all, I have created following codes : mat = cbind(c(0.000059710430,0.000023057380), c(0.000023057380, 0.00005971089)) set.seed = 1000 vary = runif(dim(mat)[1], 2000, 3000) calc = function(mat, vary) { result = vector(length = (length(vary)+1)) result[1] = sqrt(t(vary) %*% vary) for (i in 1 : length(vary)) { result[(i+1)] = sum(vary)*sum(vary*mat[,i])
2010 Aug 18
5
Linear regression equation and coefficient matrix
Hi, I have 20*60 data matrix (with some NAs) and I wish to perfom a Pearson correlation coefficient matrix as well as simple linear regression equation and coefficient of determination (R2) for every possible combination. Any tip/idea/library/script how do to so. Thanks, As hz -- View this message in context:
2008 Nov 25
3
Line color based on data values?
Hi all Does anyone know if it is possible when plotting a line or scatter plot, to selectively color the data points based on the data value? i.e. if plotting say the percentage change in stock price movements, to color +ve points in green and -ve points in red? And extending this to a user-defined range of colors based on the quartile of the data points? Thanks Rory Rory Winston RBS Global
2010 Jun 10
2
points marking
Hi, How to mark points on x axis of a graph keeping x axis as constant and changing y from y1 to y2 respectively. I want to highlight the area from y1 to y2. Any suggestions Thank you Jeet [[alternative HTML version deleted]]
2010 Oct 12
6
List or matrix of object
Hi everyone. Is it possible in R to create a matrix or a list (vector) or R object. For instance, I have f1 <- function(x) sqrt(x%*%x); f2 <- function(x) (2x+1); I would like to do something like L <- List(); L[1] = f1; L[2] = f2; So, is there a way to create matrix or vector that can contains R object. With regards, Phil -- View this message in context: