similar to: incrementing matrix elements more efficiently

Displaying 20 results from an estimated 200 matches similar to: "incrementing matrix elements more efficiently"

2010 Aug 09
2
efficient matrix element comparison
It is a simple problem in that I simply want to convert the For loop to a more efficient method. It simply loops through a large vector checking if the numeric element is not equal to the index of that element. The following example demonstrates a simplified example: > rows <- 10 > collusionM <- Matrix(0,10,10,sparse=TRUE) > matchM <- matrix(c(1,2,3,4,4,6,7,9,9,10)) > >
2010 Jan 04
4
function in aggregate applied to specific columns only
I want to use aggregate with the mean function on specific columns gender <- factor(c("m", "m", "f", "f", "m")) student <- c(0001, 0002, 0003, 0003, 0001) score <- c(50, 60, 70, 65, 60) basicSub <- data.frame(student, gender, score) basicSubMean <- aggregate(basicSub, by=list(basicSub$student), FUN=mean, na.rm=TRUE) This
2013 Apr 19
1
Sequence analysis
Hiya, I am trying to look at the similarities between a number of sequences, for example i am trying to see how similar "ababbbassdaa" is to "addffggssbbsbbs" I was wondering is the some way for me to see how similar they are in terms of, for example, number of a's, number of b's, how often a and ab are consecutive, how often abab is together etc. Any advice
2009 Apr 04
2
data.frame, converting row data to columns
I have a data frame something like: name wrist nLevel emot 1 4094 3.34 1 frustrated 2 4094 3.94 1 frustrated 3 4094 NA 1 frustrated 4 4094 3.51
2012 Feb 17
0
[LLVMdev] ARM/Thumb2/ISEL Need help tracing down a failing match: (HOW?)
Hi, after perusing through llc -debug output and stepping through the ARMGenDAGIsel.inc in the debugger, I would greatly like some help in tracking down a failing match to a pattern I specified: First, here is a snippet of a successful match (done in ARM mode) ISEL: Starting pattern match on root node: 0x1e7adf0: i32,ch = load 0x1e4c030, 0x1e78210, 0x1e78310<LD4[ConstantPool]> [ID=10]
2010 Jan 30
2
aggregate by factor
I have a data frame with two columns, a factor and a numeric. I want to create data frame with the factor, its frequency and the median of the numeric column > head(motifList) events score 1 aeijm -0.25000000 2 begjm -0.25000000 3 afgjm -0.25000000 4 afhjm -0.25000000 5 aeijm -0.25000000 6 aehjm 0.08333333 To get the frequency table of events: > motifTable <-
2007 Nov 26
1
visualizing nucleotide sequence properties
Hi there, I am looking for R-packages that can help me visualize properties on nucleotide sequences. I want to display sequences in the 1-100K base range as lines and plot features above and below those lines. Any ideas would be welcome. Thanks, Bernd [[alternative HTML version deleted]]
2006 Jun 18
2
analyze amino acid sequence (composition)of proteins
Dear R-helpers: thank your for your attention. i am a newer to R and i am doing some protein category classification based on the amino acid sequence.while i have some questions urgently. 1. any packages for analysis amino acid sequence 2. given two sequences "AAA" and "BBB",how can i combine them into "AAABBB" 3. based on "AAABBB",how can i get some
2013 Apr 18
5
Subsetting a large number into smaller numbers and find the largest product
Hello, I have a big number lets say of around hundred digits. I want to subset that big number into consecutive number of 5 digits and find the product of those 5 digits. For example my first 5 digit number would be 73167. I need to check the product of the individual numbers in 73167 and so on. The sample number is as follows:
2010 Aug 22
1
spare matrix replacing values efficiently
I am working with a large sparse matrix trying replace all 1 values with 0. The normal method doesn't work. Here is a small example: > x <- Matrix(0,nrow=10,ncol=10,sparse=TRUE) > x[,1] <- 1:2 > x 10 x 10 sparse Matrix of class "dgCMatrix" [1,] 1 . . . . . . . . . [2,] 2 . . . . . . . . . [3,] 1 . . . . . . . . . [4,] 2 . . . . . . . . . [5,] 1 . . . . . . . . .
2010 Jul 13
2
Checking for duplicate rows in data frame efficiently
I wrote something to check for duplicate rows in a data frame, but it is too inefficient. Is there a way to do this without the nested loops? This code correctly indicates rows 1-7, 1-8, 2-9 and 7-8 are duplicates. > m <- matrix(c(1,1,1,1,1, 2,2,2,2,2, 6,6,6,6,6, 3,3,3,3,3, 4,4,4,4,4, 5,5,5,5,5, 1,1,1,1,1, 1,1,1,1,1, 2,2,2,2,2, 7,7,7,7,7), ncol=5, byrow=TRUE) > df <- data.frame(m)
2013 Apr 18
0
Splitting vector
Hi, Try: vec1<- "mue#d/sjbijk at ruepvnvbnceiicrpgxkgcyl@keduhqvqi/ubudvxopddpfddgitrynzshzdcwgneyffrkpbxwilwqngrsals#geqmtkcpkp/qecgdfa#uag" library(seqinr) ?res<-lapply(0:4,function(i) lapply(2:5,function(j) splitseq(s2c(gsub("[#@/]","",vec1)),word=j,frame=i))) #or library(stringr) res1<-lapply(0:4,function(i) lapply(2:5,function(j)
2010 Jun 15
4
shifted window of string
basically I need to create a sliding window in a string. a way to explain this is: > v <-
2009 May 21
1
Loop avoidance and logical subscripts
Hello! I'm writing a script with a lot of loops and it executes really slowly over huge amounts of data. I assume it's because I don't know how to avoid using loops. Logical subscripts are more desirable, but I don't know how to implement them. One example of that issue: library(seqinr) GCsequence <- vector() for( i in 1:(length(data$sequence))) {
2010 Mar 06
1
color2D.matplot not giving colors
I am using color2D.matplot to plot a matrix about 400 by 200. The values in the matrix are 0:5 and NA. The resulting plot is not color, but shaded b/w. I tried to figure out how to add colors, I would like something like c(blue, green, red, cyan, green) #example motifx <- matrix(NA, nrow=100,ncol=20) motifx[,1:5] <- 1 motifx[,6:10] <- 2 motifx[,11:15] <- 3 motifx[,15:19] <- 4
2010 Aug 08
2
subset of string by index
How can I get a substring based on the index into the string? strM <- c("abcde", "cdefg") ind <- c(1,3,5) I want to use ind to index into the strings so the result is: strMind <- c("ace", "ceg")
2015 Apr 17
1
userdb username changed
Hi! I'm playing with a postfix + dovecot + mysql test setup, and noticed something strange. It seems that despite the "username changed" line, auth returns the original username: Apr 17 09:27:34 imap21 dovecot: quota-status: Debug: Loading modules from directory: /usr/lib64/dovecot (...) Apr 17 09:27:34 imap21 dovecot: auth-worker(27661): Debug: sql(ppp at example.net): SELECT
2012 Oct 18
1
[LLVMdev] Incrementing a pointer to array element?
Using the LLVM C++ API, if I want to create an array via an Alloca instruction like: Value *a = ir_builder.CreateAlloca( my_type, my_size ); and then I want to initialize each element of the array with values computed elsewhere like: for ( vector<Value*>::const_iterator i = v.begin(); i != v.end(); ++i ) { builder.CreateStore( *i, a ); // How do I increment 'a' to point to
2008 Apr 23
2
Incrementing Dates
How can I increment the value of a Date class? I want to add a day, month or year to a date. cheers Worik [[alternative HTML version deleted]]
2008 Jul 24
3
incrementing for loop by 2
Dear List-serv members: How can I structure a for loop so that it will increment the counter by two using R? I am just looking for a simple example that shows where the incrementing part should go. Thanks! Jennifer -- Jennifer Hayes Clark Assistant Professor Department of Political Science University of Houston Houston, TX 77204-3011 [[alternative HTML version deleted]]