similar to: permutates and/or samples a matrix

Displaying 20 results from an estimated 500 matches similar to: "permutates and/or samples a matrix"

2006 Nov 21
2
keeping dim() for array
Hi All, I noticed the following: pip = array(1:6, dim = c(3,2)) dim(pip) [1] 3 2 pup = pip[1,] dim(pup) NULL I bet there is a *good* reason why one row of an array is *dimensionless*, but it's highly inconvenient for my purpose, i.e. to use apply() after an array goes through a number of logical steps and is redimensioned, sometimes to one single row. How do I keep dim(pup) to 1 2?
2012 Aug 16
3
r data structures
hi, i'm trying to understand r data structures. i see that vectors, matrix, factors and arrays have a "dimension." there seems to be no mention of dimensionality anywhere for lists or dataframes. can i consider lists and frames to be of fixed dimension 2? thanks, jay s
2007 Nov 16
4
Permutation of a distance matrix
Hi there, I would like to find a more efficient way of permuting the rows and columns of a symmetrical matrix that represents ecological or actual distances between objects in space. The permutation is of the type used in a Mantel test. Specifically, the permutation has to accomplish something like this: Original matrix addresses: a11 a12 a13 a21 a22 a23 a31 a32 a33 Example
2009 Nov 12
2
A combinatorial optimization problem: finding the best permutation of a complex vector
Hi, I have a complex-valued vector X in C^n. Given another complex-valued vector Y in C^n, I want to find a permutation of Y, say, Y*, that minimizes ||X - Y*||, the distance between X and Y*. Note that this problem can be trivially solved for "Real" vectors, since real numbers possess the ordering property. Complex numbers, however, do not possess this property. Hence the
2008 Nov 14
1
Generating unique permutations of a vector
Hi all, I try to generate sets of strategies that contain probability distributions for a defined number of elements, e.g. imagine an animal that can produce 5 different types of offspring and I want to figure out which percentage of each type it should produce in order to maximize its fitness. In order to do so, I need to calculate the fitness for all potential strategies. As an example, if I
2004 Mar 01
6
How to plot Histogram with frequence overlaid by distribution curve
Hi, I am facing the problem that I want to plot a histogram chart set freq to true and overlay with normal or weibull or exponential distribution curve. The sample code is shown as below: >samp<-c(-8.2262,-8.2262,-8.2262,-8.20209,-8.09294,-8.07321,-8.07321, -8.07321,-8.07175,-8.04948,-8.04948,-8.04948,-8.03848,-8.03848,
2012 Sep 20
3
lattice dotplot reorder contiguous levels
my reproducible example test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c("A", "B", "C", "D", "E"), class = "factor"),
2011 Mar 17
3
Beginner question: How to replace part of a filename in read.csv?
I would like to use samp as a part of a filename that I can change. My source files are .csv files with date as the file name, and I would like to be able to type in the date (later perhaps automate this using list.files) and then read the csv and write the pdf automatically. I have tried different combinations with "" and () around samp, but I keep getting the error "object
2008 Apr 09
3
permutation/randomization
Hello, I have what I suspect might be an easy problem but I am new to R and stumped. I have a data set that looks something like this b<-c(2,3,4,5,6,7,8,9) x<-c(2,3,4,5,6,7,8,9) y<-c(9,8,7,6,5,4,3,2) z<-c(9,8,7,6,1,2,3,4) data<-cbind(x,y,z) row.names(data)<-c('a','b','c','d','e','f','g','h') which gives: x y z
2003 Apr 08
3
density ranges for uniform law
Hello, I would have some details and explanations about the results I get. In fact, I start with a uniform sample between -1 and 1, and then plot its density. My problem is that the density ranges are much more longer than I expected : samp <- runif(10000,-1,1) plot(density(samp)) Instead of varying between -1 and 1, the density varies between approximaly -1.5 and 1.5 Could someone explain
2011 Sep 06
2
Generalizing call to function
Hello guys, I would like to ask for help to understand what is going on in "func2". My plan is to generalize "func1", so that are expected same results in "func2" as in "func1". Executing "func1" returns... 0.25 with absolute error < 8.4e-05 But for "func2" I get... Error in dpois(1, 0.1, 23.3065168689948, 0.000429064542600244,
2004 Mar 09
2
maxima
Dear all, suppose I have a bi-variate function f(x,y), I want to find the maxima. I define x and y vector, and get matrix z=f(x,y). how can I get which (x0,y0) makes z become the maxima? I can do two loops to get the x0 and y0, but I think there may exist a function to do this.
2011 Mar 18
3
exploring dist()
Hello, everybody, I hope somebody could help me with a dist() function. I have a data frame of size 2*4087 (col*row), where col corresponds to the treatment and rows are species, values are Hellinger distances, I should reconstruct a distance matrix with a dist() function. I know that "euclidean" method should be used. When I type: dist(dframe,"euclidean") it gives me a
2017 Nov 12
2
create waveform sawtooth
My tuneR sawtooth wave function generator is broken. When I use the sine function, I get exactly what I expect: a sine wave whose frequency is defined by the freq parameter. In particular, higher frequencies have shorter wavelengths (more cycles per second means shorter waves). When I create a sawtooth wave, the opposite seems to occur: higher frequencies result in longer waves. But that?s not
2010 Jul 08
1
Time value not sorting properly
I have a dataframe of animal locations that I need to have in incremental order so that I can calculate the distance traveled between each time step. However, I have identified a few values that don't seem to sort properly. For instance, the last value in the table below should be the first value after sorting, since its time value is '00:01:35'. But, for some reason, it seems to be
2003 Apr 15
5
Summarizing levels for future commands
Hi. This will hopefully be readily understood but if not, bear with me. I have to do a repeated analysis (in spatstat) and want to batch file it. For each of my 'runs' certain variables change. At present I am manually specifying these changes and want to automate it if possible. Ok, I am creating an object which is comprised of 'levels' that are 'characters'. Further
2009 Feb 24
2
lmer, estimation of p-values and mcmcsamp
(To the list moderator: I just subscribed to the list. Apologies for not having done so longer before trying to post.) Hi all, I am currently using lmer to analyze data from an experiment with a single fixed factor (treatment, 6 levels) and a single random factor (block). I've been trying to follow the online guidance for estimating p-values for parameter estimates on these and other
2017 Nov 12
0
create waveform sawtooth
Ccing the maintainer if the tuneR package. Looks to me like sawtooth (and square) don't behave as expected when using xunit="samples". Workaround is to use xunit="time" instead: sawtooth(110,duration=1/100,samp.rate=sample_rate,xunit="time") I looked at the code but found it to be opaque. -- Sent from my phone. Please excuse my brevity. On November 12, 2017
2011 Feb 10
3
Finding length of unique numbers in a vector
Hello there, would you please look into my codes? Here I have following: > set.seed(100) > samp <- sample(c(1,-1,0), 20, replace=T); samp [1] 1 1 -1 1 -1 -1 0 -1 -1 1 -1 0 1 -1 0 0 1 -1 -1 0 Here I want to calculate the length of each unique number for above vector. How can I do that? Thanks in advance [[alternative HTML version deleted]]
2000 Feb 24
2
(-1 as index) OR (envelope for QQ)
I'm new to R (and to S) and am wondering about code from pages 72 and 83 of MASS (Venables+Ripley, 3rd edition), to draw an envelope on a QQ plot. Copying from the book, I've got: #... code whose gist is "a.fit <- nls(..." num.points <- length(resid(a.fit)) qqnorm(residuals(a.fit)) # illustrate data-model residuals qqline(residuals(a.fit)) samp <-