similar to: error in sample ()

Displaying 20 results from an estimated 100 matches similar to: "error in sample ()"

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
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
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
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
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
2010 Mar 26
2
Odd results with %% and conserving memory
Can anyone explain this? I have a matrix with double components. It's taking up a lot of memory, so I want to multiply then turn it to integers. I'm pretty certain that there are only 2 decimal places, but I wanted to check by using modulo. E.g. mat = matrix(11:50/100, ncol=4,nrow=10) #Matrix with values out to the hundredths any((mat * 100)%%1!=0) But oddly enough it doesn't work.
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
2012 Nov 12
1
reshape
Hi, I have a R output that looks as follow: Rad:0 Rad1:2 Rad3:3 I want to make a new matrix that looks like : sample size is 2400 Variable    n11  n12 Rad            0     2400-0=2400 Rad1          2       2400-2 Rad3  3      2400-3   Thanks a lot for your time and help:) Best,Farnoosh Sheikhi [[alternative HTML version deleted]]
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
2013 Nov 01
1
Package(s) for making waffle plot-like figures?
Dear all, I am trying to make a series of waffle plot-like figures for my data to visualize the ratios of amino acid residues at each position. For each one of 37 positions, there may be one to four different amino acid residues. So the data consist of the positions, what residues are there, and the ratios of residues. The ratios of residues at a position add up to 100, or close to 100 (more on
2008 Apr 10
2
subtract the mean from each column
Hi, I am new to R an dI need some help I have a matrix of real values 100*300 and I would like to calculate the mean for each column , then for each entry in a column i need to subtract the mean so I will have a matrix where the columns have zero mean. any one know how to do that . Thanks -- View this message in context:
2010 Oct 12
2
extract rows of a matrix
Hi all, I want to extract every 20th row of a big matrix, say 10000 by 1000. What is the simper way to do this? Thank you very much! Hannah [[alternative HTML version deleted]]
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’:
1997 Aug 18
1
R-beta: bug report
The following seems to be a bug when I tried to use the predict function. > forbes boil.pt pressure log.pressure [1,] 194.5 20.79 303.4472 [2,] 194.3 20.79 303.4472 [3,] 197.9 22.40 310.9061 [4,] 198.4 22.67 312.1042 [5,] 199.4 23.15 314.1995 [6,] 199.9 23.35 315.0597 [7,] 200.9 23.89 317.3460 [8,] 201.1 23.99
2007 May 25
1
Problem with rpart
I work on Windows, R version 2.4.1. I'm very new with R! I am trying to build a classification tree using rpart but, although the matrix has 108 variables, the program builds a tree with only one split using one variable! I know it is probable that only one variable is informative, but I think it's unlikely. I was wondering if someone can help me identify if I'm doing something
2007 Oct 03
1
help with stepclass (klaR)
I use Windows, R version 2.5.1 When I try to run stepclass (klaR) I get an error message/warning saying: 1: error(s) in modeling/prediction step in: cv.rate(vars = c(model, tryvar), data = data, grouping = grouping, ... Actually, I look 16 warnings of this type. Can anyone tell me what this means? Also, it returns only 2 out of the 79 variables as important, however these variables
2013 Jun 05
2
combining two different matrizes
Hello together, this is ma first post, so please aplogize me if post this in the wrong section. I have problem concerning ma two matrizes. After a regressione and so on, I got two matrizes Matrixres contains the results of ma calculation. Matrixr contains my detiene, which where Aldo used for the regression. Please ser the following code: #Datei einlesen residual =
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
2006 Jun 27
3
reading a matrix from a file
Hello everyone, I'm writting a little script that will read a matrix from a file i.e. 0,.11,.22,.4 .11,0,.5,.3 .22,.5,0,.7 anb so on and will then calculate some standard stats for nets (i.e. centralization, degree, etc). So far I have opened the file and read the contents, however I' m using readLines(filename) to read the file and it returns it as