similar to: How to generate column names for pairwise comparison

Displaying 20 results from an estimated 10000 matches similar to: "How to generate column names for pairwise comparison"

2008 Feb 04
3
counts of each column that are not NA, and/or greater than column means
Hi, Given a test matrix, test <- matrix(c(1,2,3,NA,2,3,NA,NA,2), 3,3) A) How to compute the counts of each column (excluding the NA) i.e., 3, 2, 1 B) How to compute the counts of each column (excluding the NA) that are greater than the column means ? i.e., 1, 1, 0 I could write a for loop, but hope to use better alternative. [[alternative HTML version deleted]]
2008 Feb 11
4
Conditional rows
Hi, Given a simple example, test <- matrix(c(0.1, 0.2, 0.1, 0.2, 0.1, 0.1, 0.3, 0.1, 0.1), 3, 3) How to generate row indexes for which their corresponding row values are less than or equal to 0.2 ? For this example, row 2 and 3 are the correct ones. Thanks [[alternative HTML version deleted]]
2006 Jan 27
5
How to convert decimals to fractions
Dear all, Are there any functions to convert decimals to fractions in R? I have the result: > summary(as.factor(complete.ID)) 0 0.0133333333333333 0.04 2256 488 230 0.0666666666666667 0.0933333333333333 0.106666666666667 2342 310 726 0.133333333333333
2007 Mar 13
4
selecting rows with more than x occurrences in a given column (data type is names)
Despite a long search on the archives, I couldn't find how to do this. Thanks in advance for what is likely a simple issue. I have a data set where the first column is name (i.e., 'Joe Smith', 'Jane Doe', etc). The following columns are data associated with that person. I have many people with multiple rows. What I want is to get a new data frame out with only the people who
2006 Nov 28
2
Sorting a data frame when you don't know the columns
Hi Sorry to ask such a well oiled question, but even with multiple google hits I don't think this has been answered very well. It's all well and good doing a sort of a data frame on multiple columns when you know in advance which columns you want to sort on, but what about when the names of the columns you wish to sort on are in a vector? At the minute I'm messing about with
2008 Aug 15
2
Combination with repetition
Hi there! I can't find any information about creating combinations with repetitions in R. The function combn() does create combinations, but _without_ repetitions. Here is what I need to do: svIter <- 1000 xx <- matrix(rnorm(m*n), c(m, n)) sequence <- seq(range(xx)[1], range(xx)[2], length.out = svIter^(1/q)) expand.grid(secuence, secuence, .../q times/..., secuence) That is,
2004 Nov 23
5
number of pairwise present data in matrix with missings
is there a smart way of determining the number of pairwise present data in a data matrix with missings (maybe as a by-product of some statistical function?) so far, i used several loops like: for (column1 in 1:99) { for (column2 in 2:100) { for (row in 1:500) { if (!is.na(matrix[row,column1]) & !is.na(matrix[row,column2])) { pairs[col1,col2] <- pairs[col1,col2]+1
2008 Feb 12
3
Reorder data frame columns by negating list of names
Hello, I would like to reorder columns in a data frame by their names as demonstrated below: Take this data frame: > xxx <- data.frame(matrix(1:40, ncol=8)) > names(xxx) <- letters[1:8] > xxx a b c d e f g h 1 1 6 11 16 21 26 31 36 2 2 7 12 17 22 27 32 37 3 3 8 13 18 23 28 33 38 4 4 9 14 19 24 29 34 39 5 5 10 15 20 25 30 35 40 and reorder the columns like
2005 Feb 16
4
Passing colnames to graphics title
Hi, Just a quick query - if I'm creating a function to produce a number of histograms per page of output (one per column from a matrix), how can I pass the column name of the matrix into the title (or indeed to form part of the x-axis label)? TIA, Laura Laura Quinn Institute of Atmospheric Science School of Earth and Environment University of Leeds Leeds LS2 9JT tel: +44 113 343 1596 fax:
2007 Nov 19
4
sequence of vectors
Dear All, I wonder if there is any R function to generate a sequence of vectors from existing ones. For example: x 1<- c(1,2,3) x2 <- c(4,5) x3 <- c(6,7,8) The desired output is a list of all 3*2*3 = 18 possible combinations of elements of x1,x2 and x3. One element for example is (1,4,6). Many thanks in advance, Bernard
2007 Dec 13
1
Number of ways to select population members
Hi all, Suppose I have a population of 3 alphabets : A, B, C. From this population, number of ways that any 2 can be chosen is 3 i.e. AB, AC, and BC. Is there any R function to generalize this process, for any number of alphabets/numbers and for any sub-sample size? Thanks and regards, --------------------------------- [[alternative HTML version deleted]]
2007 Oct 11
2
Matching and merging two rows with missing values
Hello, I have two rows which are almost identical but miss different values at different locations. I would like to merge these two rows so that the missing values are replaced by the element in the same column on the other row making one row. If both rows contain a NA, NA remains in the output. 1 2 3 4 5 Row1 AA AG GG NA NA Row2 NA AG GG AA NA The
2007 Nov 16
2
expand.grid overflows?
>cbn<-as.matrix(expand.grid( rep( list(0:1), 50))) Error in rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) : invalid 'times' value In addition: Warning message: In rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) : NAs introduced by coercion But I'm only interested in cbn matrix rows where: cbn<- cbn[rowSums(cbn)==5,] Is there a way to evaluate it
2007 Aug 22
1
plot in for loop with "i" indexed variables does not work
Hi there Does anyone know, why this is not working?: par(mfrow = c(5, 5)) for (i in 1:10){ plot(x=time, y=Var.i) } (x-variable is time y-variable is Var out of matrix with columns Var.1 Var.2 Var.3 etc...) even for (i in 1:10){ plot(x=time, y=paste("Var", i, sep=".") } does not work Thanks marc
2008 Feb 13
3
indices of rows containing one or more elements >0
Hi, Given test <- matrix(c(0,2,0,1,3,5), 3,2) > test[test>0] [1] 2 1 3 5 These are values >0 > which(test>0) [1] 2 4 5 6 These are array indices of those values >0 > which(apply(test>0, 1, all)) [1] 2 This gives the row whose elements are all >0 I can't seem to get indices of rows containing one or more elements >0 [[alternative HTML version deleted]]
2007 May 20
2
Number of NA's in every second column
Hi R-users, How do I calculate a number of NA's in a row of every second column in my data frame? As a starting point: dfr <- data.frame(sapply(x, function(x) sample(0:x, 6, replace = TRUE))) dfr[dfr==0] <- NA So, I would like to count the number of NA in row one, two, three etc. of columns X1, X3, X5 etc. Thanks in advance Lauri [[alternative HTML version deleted]]
2008 Mar 10
1
ltm package question
Hello All, I was wondering how I can get the overall Pearson chi^2 test of model fit with its df and p value in the LTM package for the 2PL models. Thanks, -- Davood Tofighi Department of Psychology Arizona State University [[alternative HTML version deleted]]
2011 Apr 13
2
setting pairwise comparisons of columns
Hi, I have a number of genes (columns) for which I want to examine pairwise associations of genotypes (each row is an individual)...For example (see data below), I would like to compare M1 to M2, M2 to M3, and M1 to M3 (i.e. does ac from M1 tend to be found with bc from M2 more often than expected.) Down stream I will be performing chi square tests for each pair. But I am looking for a way to
2006 Sep 06
1
Covariance/Correlation matrix for repeated measures data frame
All, I have a repeated measures data frame and was wondering if the covariance matrix can be calculated via some created indexing or built-in R function. Specifically, say there are 3 variables, where potassium concentration is measured 6 times on each patient. Patient number (discrete) Time (1 to 6, discrete) Potassium (continuous variable) I want the covariance/correlation matrix for the
2008 Apr 09
4
apply lm() for all the columns of a matrix
Hi all, My question is not really urgent. I can write a loop and solve the problem. But I know that I'll be in a similar situation many more times so it would be useful to find out the answer Is there a fast way to perform linear fit to all the columns of a matrix? (or in the one dimension of a multi-dimensional array.) I'm talking about many single linear fits, not about a multiple fit.