similar to: Make one vector from matrix comparison

Displaying 20 results from an estimated 300 matches similar to: "Make one vector from matrix comparison"

2008 Nov 10
1
comparing rows - a possible solution
Hello, sorry for posting this independently of the original thread, but it is not that easy to answer to mails, when receiving the r-help as digest... ... The question was: > I compare each row of a matrix with each row of another matrix. > > testmat1 <- matrix(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4) > testmat2 <- matrix(c(1,2,3,5,5,6,7,8,9,10,11,12,13,14,15,16),
2016 Apr 06
0
R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]
Hi, i think i have figured the purpose of using this index (i-1)*5+j in the previous example that you gave. It is because that i have to consider the outer loop and inner loop also... so the iterative for i need to minus one because it have ran one times simulation already ,then times the number of sizes of inner loop, then plus the iterative of j.... then for the simulation, i think there will
2012 Feb 01
6
While loop working with TRUE/FALSE?
Hi R users, is there any possibilty that a while loop is working like that: z <- c(0,1,2,3,4,5,6,7,8,9) r <- 7 while(w == T) { for ( i in 1:10 ){ w <- r == z[i] print(w) } } The loop should stop if w == TRUE best regards -- View this message in context:
2008 Oct 22
3
Substitute problem
hello R users, I didn't find a solution for a special problem. I have two dataframes. dataframe1: X value row col ID 1 8.973498062 5512625 3460000 1 2 11.656658570 5501625 3464000 2 3 11.121777570 5495625 3473000 3 4 9.310465964 5508625 3477000 4 5 8.883483845 5515625 3496000 5 dataframe2: X value
2011 Nov 15
2
points() colored by value
Hi R users, I want to colored points by their value for example: x <- c(1,2,3,4) y <- c(1,2,3,4) z <- c(2,3,4,9) y and x are coordinates z is the value of the coordinates points(x,y,col= rainbow(z)) something like that But haven't found any solution at the moment. Thanks. Chris -- View this message in context:
2008 Sep 17
1
Re adout row and column of a matrix value
Hello R users, I want to readout the row and column postion from a certain matrix value into a csv file. I have only found this syntax "which(a == b, arr.ind = T)" so I get a = matrix [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1 1 2 2 2 1 1 2 [2,] 1 2 3 3 3 4 4 3 [3,] 3 3 3 5 5 6 5 4 [4,] 4 4 4 3
2008 Nov 25
1
add string to a list
hello R users, I didn't find a solution for a simple problem I think. I read 224 lines from a file input <- readLines(con,n=224) and now I create a string x <- "\004" which should be line 225 of input. So I have input and x and want to add x to input, so that it looks like this: [1] "string" [2] "string" . . . [224] "string" [225]
2011 Feb 03
2
substring and paste character with a for loop
Hello R users, I have a little problem with a for loop. Below there is an simple example of my problem. I want to delet the commas in the character string. Fore this reason I create a for loop to unpick the string and rebuild him without the commas. The problem is, that "paste" does not work in the loop as I expected. text <- "aaa,bbb,ccc,ddd" characterseq <-
2013 Apr 16
2
R process slow down after a amount of time
Hi R users, I have mentioned that R is getting slower if a process with a loop runs for a while. Is that normal? Let's say, I have a code which produce an output file after one loop run. Now after 10, 15 or 20 loop runs the time between the created files is stongly increasing. Is there maybe any data which fill some memory? Chris -- View this message in context:
2011 Sep 16
3
How to save row values from a matrix into one vector?
Dear R users, I guess, I have a quit simple problem, but I'm not getting the solution. I create a matrix like this: test <- matrix(seq(1,3,1),ncol=5,nrow=3) then I want to create one vector, consisting of every row of the matrix. My first idea was to do this with a for loop. op <- vector() for (o in 1:3){ op[o] <- as.vector(test.id[o,]) } The results should be like this: [1]
2008 Sep 21
1
Searching a relativ maximum of a matrix
Hello R users, is there a possibility to get the relativ maximum of a matrix? To get the absolut maximum I use max(matrix) For example: The absolut maximum of this matrix is 6[3,6], but the relativ maximum is 6[3,6] and 4[7,6], because both values are the highest value in comparison to their eight neighbours values. [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1 1 2 2 2
2008 Jul 23
2
Flip Matrix form file?
Hello, I have a problem to flip a 200x200 matrix, which is imported by a .asc file. I want to flip the matrix like in a created example below: > b <- matrix(1:9,3,3,byrow=T) > b [,1] [,2] [,3] [1,] 1 2 3 [2,] 4 5 6 [3,] 7 8 9 > b1 <- apply(t(b),1,rev) > b1 [,1] [,2] [,3] [1,] 7 8 9 [2,] 4 5 6 [3,] 1 2 3 but my
2015 Jan 08
3
setequal: better readability, reduced memory footprint, and minor speedup
How about unique them both and compare the lengths? It's less work, especially allocation. Pete ____________________ Peter M. Haverty, Ph.D. Genentech, Inc. phaverty at gene.com On Thu, Jan 8, 2015 at 1:30 PM, peter dalgaard <pdalgd at gmail.com> wrote: > If you look at the definition of %in%, you'll find that it is implemented > using match, so if we did as you suggest,
2015 Jan 06
4
setequal: better readability, reduced memory footprint, and minor speedup
Hi, Current implementation: setequal <- function (x, y) { x <- as.vector(x) y <- as.vector(y) all(c(match(x, y, 0L) > 0L, match(y, x, 0L) > 0L)) } First what about replacing 'match(x, y, 0L) > 0L' and 'match(y, x, 0L) > 0L' with 'x %in% y' and 'y %in% x', respectively. They're strictly equivalent but the latter
2020 May 20
3
Feature Request: User Prompt + Message First Execution when "Managing Search Path Conflicts"
Dear R Developers, ### # Context: ### When managing Search Path Conflicts (See: https://developer.r-project.org/Blog/public/2019/03/19/managing-search-path-conflicts/index.html), with: options(conflicts.policy = "strict") We get the following behaviour when loading a package (Eg: dplyr): library(dplyr) ## Error: Conflicts attaching package ?dplyr?: ## ## The following objects are
2017 Nov 08
2
Ggplot error
Hello, I've an error recently. ggplot(data = mtcars, aes(x= wt, y= mpg)) + geom_line() Error: Found object is not a stat. > sessionInfo() R version 3.4.2 (2017-09-28) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.3 LTS Matrix products: default BLAS: /usr/lib/openblas-base/libblas.so.3 LAPACK: /usr/lib/libopenblasp-r0.2.18.so locale: [1] LC_CTYPE=tr_TR.UTF-8
2017 Nov 08
0
Ggplot error
I was not able to reproduce this problem. I tried two environments 1. Ubuntu 14.04.5 LTS, R version 3.4.2 (same R version as yours) 2. Windows 10, same R version On Wed, Nov 8, 2017 at 9:50 AM, Zeki ?ATAV <zcatav at gmail.com> wrote: > Hello, > I've an error recently. > > ggplot(data = mtcars, aes(x= wt, y= mpg)) + geom_line() > Error: Found object is not a stat. >
2013 Oct 21
1
Set operation generics
Hi all, Would anyone be interested in reviewing a patch to make the set operations (union, intersect, setdiff, setequal, is.element) generic? Thanks, Hadley -- Chief Scientist, RStudio http://had.co.nz/
2005 Sep 16
2
fusion of rows (as in merge()) but from only 1 matrix
Dear all, Once again I need your help ; I fond a way to do what I want but I am sure there is a better way.. maybe you can help me. I have a matrix, for example mat.tot : > mat.tot ID Desc M1 M2 1 1 gene1 0.5 0.2 2 2 gene2 -0.4 -0.1 3 3 gene3 1.0 1.2 4 4 gene1 0.6 0.3 5 5 gene2 -0.3 0.0 and I want to merge line 1 with line 4, and line 2 with line 5 because this is the same gene. I can
2014 Feb 07
2
suggestion for "sets" tools upgrade
First, let me apologize in advance if this is the wrong place to submit a suggestion for a change to functions in the base-R package. It never really occurred to me that I'd have an idea worthy of such a change. My idea is to provide an upgrade to all the "sets" tools (intersect, union, setdiff, setequal) that allows the user to apply them in a strictly algebraic style. The