similar to: repeating the same procedure with a number of files within a directory

Displaying 20 results from an estimated 50000 matches similar to: "repeating the same procedure with a number of files within a directory"

2006 Sep 04
3
opening files in directory
Hi there I want to be able to take all the files in a given directory, read them in one at a time, calculate a distance matrix for them (the files are data matrices) and then print them out to separate files. This is the code I thought I would be able to use (all files are in directory data_files) for(i in 1:length(files)) + { + x<-read.table("data_files/files[[i]]") +
2006 Aug 07
5
kmeans and incom,plete distance matrix concern
Hi there I have been using R to perform kmeans on a dataset. The data is fed in using read.table and then a matrix (x) is created i.e: [ mat <- matrix(0, nlevels(DF$V1), nlevels(DF$V2), dimnames = list(levels(DF$V1), levels(DF$V2))) mat[cbind(DF$V1, DF$V2)] <- DF$V3 This matrix is then taken and a distance matrix (y) created using dist() before performing the kmeans clustering. My query
2010 May 25
1
Hierarchical clustering using own distance matrices
Hey Everyone! I wanted to carry out Hierarchical clustering using distance matrices i have calculated ( instead of euclidean distance etc.) I understand as.dist is the function for this, but the distances in the dendrogram i got by using the following script(1) were not the distances defined in my distance matrices. script: var<-read.table("the distance matrix i calculated",
2012 Feb 27
1
How to incorporate interaction terms in MRM function of ecodist library?
Hi, I'm interested in incorporating some interaction terms between my explanatory variables (distance matrices in this case) when I'm using the function MRM of the package ecodist. The function is doing a multiple regression on distance matrices. I can get the function to work perfectly on my explanatory matrices by adding a (+) sign as known. However, when I try to use the (*) sign or
2013 Apr 06
1
list of distance matrices
Dear UseRs, i want to apply mantel test by comparing a list of 124 distance matrices with a reference distance matrix "q". The list of distance matrices was created by the following command.. u<-lapply(el, function(x) dist(x)) where "el" is a data frame of 75 columns and 124 rows. Therefore, the list of distances matrices, made out of it should have 75 elements each
2005 Oct 06
1
Compare two distance matrices
Hi all, I am trying to compare two distance matrices with R. I would like to create a XY plot of these matrices and do some linear regression on it. But, I am a bit new to R, so i have a few questions (I searched in the documentation with no success). The first problem is loading a distance matrix into R. This matrix is the output of a the Phylip program Protdist and lookes like this: 5
2007 May 25
1
testing difference (or similarities) between two distance matrices (not independent)
Hi, i'm looking to test if two distance matrices are statistically different from each others. These two matrices have been computed on the same set of data (several population samples) 1. using a particular genetic distance 2. weighting that genetic distance with an extra factor (we can look at this as one set is computed before applying a treatment and the second one after applying
2008 Jul 25
1
Write lower half of distance matrix only
Hi, I'm very new to R. I want to know if there is any way to write only the lower half of a distance matrix created in R to a csv file for example. I get the 'cannot coerce class "dist" into a data.frame' message when I try. I have used as.matrix and can write to a file this way, but as a full matrix. The reason I only want the lower half is that I've been doing some
2013 Apr 24
2
Distance matrices Combinations
Dear UseRs, MY PROBLEM IS A SMALL PIECE OF A REAL BIG AND A COMPLICATED PROBLEM. IF I DELIBERATE IN A VERY SIMPLE WAY THEN ALL I WANT IS TO PUT ALL THE POSSIBLE COMBINATIONS OF 75 DISTANCE MATRICES (BY TAKING 4 MATRICES, MORE COMMONLY 75C4), in the following equation. t<-as.matrix((MAT1)^2+(MAT2)^2+(MAT3)^2+(MAT4)^2+,upper=T,diag=T)) Then "1215450" values of "t"(one for
2012 Nov 18
2
euclidean dist. between matrices
Dear Users,I have two matrices A=15*365 and B=1*365. i want to calculate "Euclidean Distance" between these matrices in such a way that i should have euclidean distance of matrix B against all the columns of matrix A. More precisely, first i want euclidean dist. of column 1 of A against B, then column 2 against B, 3rd column of A against B and so on.is there a way in r to do it?your help
2008 Jul 15
1
manipulating (extracting) data from distance matrices
Hi all, Does anyone have any tips for extracting chunks of data from a distance matrix? For instance, if one was interested in only a subset of distance comparisons (i.e., that of rows 4 thru 6, and no others), is there a simple way to pull that data out? >From some playing around with an example (below), I've been able to figure out that a distance matrix in R is stored as a single
2017 Dec 31
1
Perform mantel test on subset of distance matrix
I'm trying to perform a mantel test that ignores specific pairs in my distance matrices. The reasoning is that some geographic distances below a certain threshold suffer from spatial autocorrelation, or perhaps ecological relationships become less relevant that stochastic processes above a certain threshold. The problem is that I can't find a way to do it. If I replace values in either or
2006 Aug 16
1
advice on exporting a distance matrix in the correct format needed please
Hi there Could anyone please tell me how to export a distance matrix to a .csv file please? when I tried write(matrix) I got the values but not in the format of a distance matrix - just a list of numbers in 4 columns - and when I try write.table(matrix, file="distance.csv") I get the following Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce class
2010 Apr 21
1
Cross-checking a custom function for separability indices
Hi list! I have prepared a custom function (below) in order to calculate separability indices (Divergence, Bhattacharyya, Jeffries-Matusita, Transformed divergene) between two samples of (spectral land cover) classes. I need help to cross-compare results to verify that it works as expected (since I don't know of any other foss-tool that will give me quickly some results). Does anybody
2017 Jun 17
1
dist function in R is very slow
Dear R developers, I am visualising high dimensional genomic data and for this purpose I need to compute pairwise distances between many points in a high-dimensional space (say I have a matrix of 5,000 rows and 20,000 columns, so the result is a 5,000x5,000 matrix or it's upper diagonal).Computing such thing in R takes many hours (I am doing this on a Linux server with more than 100 GB of RAM,
2006 Aug 05
1
formating for dist function
Hi there I have a list that looks like this object1 object1 78 object1 object2 45 object1 object3 34 object1 object4 45 object2 object2 89 object2 object3 32 object2 object4 13 but i want to create a matrix like this in order to use the dist function of R object1 object2 object3 object4 object1 78 45 34 45 object2 45
2006 Sep 08
1
Connecting to R using Perl?
Hi there Can anyone tell me please if I can access R though a perl script? And whether there are some internet resources/books I can use to help me? Thanks [[alternative HTML version deleted]]
2011 Mar 24
1
Two matrix loop
Hi, I'm trying to create a distance matrix. And it works out somewhat ok. However, I suspect that there are some efficiency issues with my efforts. Plz have a look at this: donor <- matrix(c(3,1,2,3,3,1,4,3,5,1,3,2), ncol=4) receiver <- matrix(c(1,4,3,2,4,3,1,5,1,3,2,1,4,5,3,5,1,3,2,4,5,1,2,3,1,4,5,5,1,2,1,3,4,3,2,5,5,1,4,2,5,4,3,2), ncol=4) The above creates my two matrices. I have
2007 Oct 09
1
Plotting two distance matrices
Hi all, I'm trying to plot two distance matrices against each other (74x74,phylogenetic distance and phenotypic distances). However R gives an error message:"Error in plot.new() : figure margins too large". Is it because I have too many points to plot? Thanks in advance, Muri ____________________________________________________________________________________
2017 Jun 18
2
dist function in R is very slow
Hi Stefan, Thank you very much for pointing me to the wordspace package. It does the job a bit faster than my C code but is 100 times more convenient. By the way, since the tcrossprod function in the Matrix package is so fast, the Euclidean distance can be computed very fast: euc_dist <- function(m) {mtm <- Matrix::tcrossprod(m); sq <- rowSums(m*m);? sqrt(outer(sq,sq,"+") -