similar to: Odd results with %% and conserving memory

Displaying 20 results from an estimated 1000 matches similar to: "Odd results with %% and conserving memory"

2005 May 05
2
efficient filtering of matrices
I was wondering if someone can tell me the best way to search through a matrix and choose certain rows (based on certain conditions) to put into a separate matrix. What I have tried so far is very slow for a large dataset I'm working with. e.g., I have this piece of code to create a new matrix (newmat) based on my filtering conditions. Do I need to do this kind of thing where I keep
2010 Jan 12
3
How to get minimum value by group
I'd like to get a long data set of minimum values from groups in another data set. The following almost does what I want. (Note, I'm using the word factor differently from it's meaning in R; bad choice of words) myframe = data.frame(factor1 = rep(1:2,each=8), factor2 = rep(c("a","b"),each=4, times=2), factor3 = rep(c("x","y"),each=2, times=4),
2009 Oct 11
1
How do you test if a number is in a list of numbers?
Hi, I want to subset a data frame if one of the variables matches any in a list. I could of course do something like this: subset(dataset, var == 1 | var == 2 | var ==3) but that's tedious. I tried varlist = c(1,2,3,4) subset(dataset, any(var == varlist)) but it doesn't work because 'any' doesn't go row-by-row and hence always returns TRUE. Is there any simple way to do this?
2011 Jun 23
2
Confidence interval from resampling
Dear R gurus, I have the following code, but I still not know how to estimate and extract confidence intervals (95%CI) from resampling. Thanks! ~Adriana #data penta<-c(770,729,640,486,450,410,400,340,306,283,278,260,253,242,240,229,201,198,190,186,180,170,168,151,150,148,147,125,117,110,107,104,85,83,80,74,70,66,54,46,45,43,40,38,10) x<-log(penta+1) plot(ecdf(x),
2011 Mar 08
1
Replacing values in a data.frame/matrix
Hi all, Suppose we have the following matrix m <- matrix(c(1,2,3,2,1,3,3,1,2), ncol = 3, byrow=T) where in each row each number occurs only once. I'd like to define a permutation, e.g. 1 -> 2, 2 -> 1, 3 -> 3 and apply it to the matrix. Thus, the following matrix should result: m.perm <- matrix(c(2,1,3,1,2,3,3,2,1), ncol = 3, byrow=T) i.e. each 1 should map to 2 and vice
2007 Oct 16
1
error in sample ()
I am trying to get a random matrix based on an original matrix called disperser.mx, with dimensions 30x73 When I write the following code: >scramble = sample (disperser.mx) >newmat = matrix(scramble, nrow=30) I get the following warning message and a very weird matrix with 30 rows but only 3 columns shown below: Warning message: data length [73] is not a sub-multiple or multiple of the
2013 Nov 22
2
[LLVMdev] new dragonegg 3.4 warning on darwin12
Duncan, Is this expected for x86_64-apple-darwin12 under Xcode 5? Using current llvm/compiler-rt/clang/polly/testsuite with dragonegg 3.4 branch, I see the warnings... % /sw/lib/gcc4.8/bin/gcc-4 -fplugin=/sw/lib/gcc4.8/lib/dragonegg.so -specs=/sw/lib/gcc4.8/lib/integrated-as.specs -fplugin-arg-dragonegg-enable-gcc-optzns -Ofast himenoBMTxpa.c himenoBMTxpa.c: In function ‘main’:
2007 Aug 21
1
Random Sampling from a Matrix
Dear Friends, I have a matrix of size 5000 X 20. The first two columns are indicator variables taking the value of either 0 or 1. Let us call the first two columns Y1 and Y2. I need to randomly sample 1000 rows with all the associated columns, in other words my new matrix should be of size 1000 X 20. I realize that using this command newmat <- mainmat[sample(1000,replace=F),] achieves
2012 Nov 30
3
protentially serious R error
Hi guy, I have recently encountered a problem while I was just trying to generate some random numbers with the function "rnorm", the problem is shown below: ########case 1############ > rnorm(20*0.2) [1] -1.2765922 -0.5732654 -1.2246126 -0.4734006 ########case 2########### *> rnorm(20*(1-0.8)) [1] -0.62036668 0.04211587 -0.91092165* #########case 3############ > a<-0.2 >
2012 Oct 26
1
Creating a correlation matrix from a vector
I'm looking to create a correlation matrix, but I have already obtained the correlations, which are stored in a vector. (Basically, I'm running a simulation which requires a correlation matrix, but I am simulating the various correlations.) My aim is to create a function that can take the vector, and fit the values into their respective locations in a correlation matrix. (The correlations
2013 Nov 22
0
[LLVMdev] new dragonegg 3.4 warning on darwin12
On Thu, Nov 21, 2013 at 07:37:46PM -0500, Jack Howarth wrote: > Duncan, > Is this expected for x86_64-apple-darwin12 under Xcode 5? Using current > llvm/compiler-rt/clang/polly/testsuite with dragonegg 3.4 branch, I see > the warnings... > > % /sw/lib/gcc4.8/bin/gcc-4 -fplugin=/sw/lib/gcc4.8/lib/dragonegg.so -specs=/sw/lib/gcc4.8/lib/integrated-as.specs
2007 Aug 24
1
uneven list to matrix
Hello, I am sure I am not the only person with this problem. I have a list with n elements, each consisting of a single column matrix with different row lengths. Each row has a name ranging from A to E. Here is an example: alph[[1]] A 1 B 2 C 3 D 4 alph[[2]] A 1 C 3 D 4 alph[[3]] A 1 D 4 E 5 I would like to create a matrix from the elements in the list with n columns such that the row names
2001 Oct 09
3
Unlisting while preserving object types?
Hi A toy example is probably the least ambiguous way of explaining what I'm trying to do. > library(ts) > zz<-list(a=rnorm(100),b=rt(100,3)) > zz.spec<-lapply(zz,spectrum,plot=F) > summary(zz.spec) Length Class Mode a 15 spec list b 15 spec list I'm looking for an elegant way to fetch components of the sub-lists a and b of zz.spec; e.g. to make a matrix
2006 Jan 12
0
bug in qr.coef() and (therefore) in qr.solve (PR#8476)
[I thought I'd submitted this bug report some time ago, but it's never showed up on the bug tracking system, so I'm submitting again.] qr.solve() gives incorrect results when dealing with complex matrices or with qr objects that have been computed with LAPACK=TRUE, whenever the b argument has more than one column. This bug flows from qr.coef(), which has a similar problem. I believe
2005 Aug 31
5
"best" c++ matrix library?
Hi folks, I am planning to write some more time-consuming matrix manipulations in c++. What is the experience with the existing c++ matrix libraries? Do you have some recommendations? Are some libraries more compatible with R than the others? All suggestions welcome! Best, Ott
2007 Dec 19
0
leaps
Thank you very much for the example. I think interactively I could get something. But my obstacle is to write an R script that processes my set of data automatically. My difficulty is to extract the information that appears on the screen, when R is operated interactively, from a scripts. Let me go over some steps to make sure I am doing things right. Assume my data have been read into the matrix
2011 Dec 19
1
Speed issue when writing to RGui console from tcl/tk GUI
It seems that there are speed issues when printing to the R console from a tcl/tk GUI. Here are functions to write a lot of output, and to display how long it takes. printsalot <- function(n) { for(i in 1:n) cat(i, fill = TRUE) } timings <- function(n = 1e3) { print(system.time(printsalot(n))) } Calling timings() from the console reveals a run time of a few hundredths of a second.
2008 Jan 29
2
help on establishing a matrix
I am a beginner and this is a naive question. I have the following data set. row column height 1 2 96 3 7 67 9 25 77 ...... I have a matrix of 50*100 data points and about 60% of them are zeros. I want to put the height data into the matrix according to their row and column numbers. does anybody have experience in setting up such matrix? Your help is highly appreciated. Jack LSU
2004 Aug 06
1
Disconnecting relay when no clients connected / Conserving bandwidth
Hello, I'm running an Icecast relay in my office. Is there any plans to provide the ability to disconnect from the master server when there are no clients connected to my relay? The main reason is to conserve bandwidth when no one is connected. I looked a bit at the code as to how to implement this, but was wondering if anyone else might be working on it. Thanks, Viraj. --- >8 ---- List
2010 Apr 05
1
strange behavior of matrix
Dear R list, I have discovered a seemingly peculiar feature when using a matrix to index itself (yes, this is strange code, which I have now modified to be more reasonable). #this makes sense s <- matrix(1:3,nrow=1) s[s] #all three elements are shown #but when I try s <- matrix(1:2,nrow=1) s[1] #fine, the first element is shown s[2] #fine, the second element is