similar to: Breaking a matrix into parts

Displaying 20 results from an estimated 1000 matches similar to: "Breaking a matrix into parts"

2006 May 11
2
Break Matrix
Hi All, I have a (331*12) matrix. I wan t to braek it into 28 parts each window having 12 rows, so that each matrix become (12*12) matrix. How can i do this. Thanks, Sumanta. --------------------------------- Send instant messages to your online friends - NOW [[alternative HTML version deleted]]
2006 May 03
3
Giving Error
I tried your code, but it's giving the following error.. Error in match.fun(FUN) : argument "FUN" is missing, with no default
2006 Jul 06
2
questions on data management
Dear friends, suppose i have two datasets: A and B A: id<-1:6 x<-c(1,2,3,4,5,6) y<-c(2,4,6,8,3,2) xy<-data.frame(id,x,y) B m<-c(1,1,3,3,5,5) n<-c(2,2,6,6,3,3) mn<-data.frame(m,n) Now, i want to perfomr two tasks: 1. get a subset of B,no duplicate values,: C: m n 1 2 3 6 5 3 2.Extract the values in A on the conditions that x=m and y=n the results should be: id x y 1 1 2 3
2006 Jul 18
2
A contingency table of counts by case
Here is an example of the data.frame that I have, df<-data.frame("case"=rep(1:5,each=9),"id"=rep(1:9,times=5),"x"=round(runif(length(rep(1:5,each=9))))) "case" represents the cases, "id" the persons, and "x" is the binary state. I would like to know in how many cases any two persons a. both have "1", b. the first has
2006 Sep 26
2
Vectorise a for loop?
Hi R guru coders I wrote a bit of code to add a new column onto a "topTable" dataframe. That is a list of genes processed using the limma package. I used a for loop but I kept feeling there was a better way using a more vector oriented approach. I looked at several commands such as "apply", "by" etc but could not find a good way to do it. I have this feeling there
2006 May 18
1
Function (x) as consecutive values
Hi - I'm trying to avoid using a 'for' loop due to inefficiency and instead use a function (and ultimately tapply as I'm working on a matrix) but I can't figure out how to get 'function' to take the variables as anything other than vectors for example aa<-0 x<-1:4 test.fun<-function(x) {aa<-(x*x +aa) return(aa)} test.fun(1:4) This code
2006 Jun 06
2
SPSS variable lables import
Hi, I try to get the variable labels of a SPSS data file into R but don't find this mentioned in the help file for foreign. Is there another way to get them ? BTW: An SPSS variable name is like: VAR001, whereas the variable label might be 'Identification no.' Thanks in advance, F. Thomas -- .......................................... Dr. Frank Thomas FTR Internet Research 93110
2006 Jun 13
1
plotting gaussian data
Ok I guess it's time to ask. So I want to plot my data. It's my data from a frequency table, "temp". My formula is just a Gaussian eq. I have done the nls function to get my parameters and now I want to do the whole plot (...) and then lines(..) This is what I have done. > temp bin x 1 -4.0 0 2 -3.9 0 3 -3.8 0 4 -3.7 0 5 -3.6 0 6 -3.5 0 .... and so
2006 Jul 10
1
How to include NA's of a factor in table?
Dear All, Is there a better way to include NA's of a factor in the output of table() than using as.character()? Admittedly, I do not understand the help page for table concerning the exclude argument applied to factors. I tried in different ways, but could not get NA to be included in the table, if not using as.character() (see example). Greetings, Heinz ## example fcv <-
2006 Jul 11
1
Table of P values for Fisher's exact test
Hi, I have a table of observed counts for various genetic markers. Instead of doing Fisher's exact test for each marker one at a time and recording the P value manually, is there a script to go through the whole list and generate the P value column automatically? An example of my data: Counts_CHB and Counts_AA are the observed counts for one allele. 2N_CHB and 2N_AA are the total number
2006 Jul 13
2
simple question about variables....
Dear R users, I have a simple question on variable manipulation. Imagine I have an object "OBJ" that has "toto" as one of its variables. I would like to understand why if I do > varname <- "toto" >OBJ$varname returns no results whereas > OBJ[varname] returns the column entitled
2006 Jul 13
1
Problems plotting a function defined as a product
In order to define a function f as: > f <- function(x) (x+1)*(x+2) I want to use the notation: > v = c(1,2) > g <- function(x) prod((v+x)) That apparently works and, for instance, the loop: >for (i in 1:100) { print(f(i)-g(i)) } Produces a sequence of zeros. Nevertheless, if I try to plot the function g by: >t = seq(0,100,1) >plot(t,g(t),type="l") I
2006 Jul 13
3
colors on graph
Hy all, I need to draw something in 2 dimension that has 3 dimension, the choice has been made to use colors to display the third dimension into the graph. Has someone done something like that, i can't figure out how to parametize the colors. Thks for all ideas, COMTE Guillaume [[alternative HTML version deleted]]
2006 Jul 20
1
hist or barplot
Hi all, I wish to draw 2 hist (or barplot) on the same graph. I can do it simply by using par(new=TRUE) , but it overlap with the first drawn, how to tell R to put in front of the graph the min value of the two graph in order for it to be seen and don't hide each other. I've been looking at help for barplot or hist but didn't find anything... (or my english is too poor to
2006 Jul 31
2
Problem with allp ossible combination.
Dear R Users, Suppose I have a dataset like this: a b 39700 485.00 39300 485.00 39100 480.00 38800 487.00 38800 492.00 39300 507.00 39500 493.00 39400 494.00 39500 494.00 39100 494.00 39200 490.00 Now I want get a-b for all possible combinations of a and b. Using two 'for' loop it is easy to calculate. But problem arises when row length of the data set is
2006 Aug 02
1
questions on aggregate data
Dear friends, my question is how to aggregate dataset and the inverse manipulation. e.g.My dataset data structure1: x 1 1 2 3 3 data structure2: x freq 1 2 2 1 3 2 Then how to generate dataset2 from dataset1 and generate dataset1 from dataset2? e.g. dataset2 from dataset1 : x<-c(1,1,2,3,3) a<-tab(x) as.data.frame(a) *But i can't do the inverse manipulation:generate dataset1 from
2006 Aug 02
2
missing value
Hi all # I have this data set and how can I assign NA?s in just one command ? And why the summary(dat) function preserves the value 9 as real. ? x <- c(1,2,3,9,4) y <- c(3,6,9,2,3) z <- c(9,9,2,2,8) w <- c(6,5,3,0,9) dat <- cbind(x,y,z,w) summary(dat) x[x==9] <- NA y[y==9] <- NA z[z==9] <- NA w[w==9] <- NA summary(dat) summary(x) summary(y) summary(z) summary(w)
2006 Aug 09
1
Combinations question
I need to generate a {0,1} matrix wifht nCr rows and n columns. The rows of the matrix will consist of all possible combinations containing r ones. My clumsy attempt for n = 6 and r = 3 is X <- expand.grid(c(1,0),c(1,0),c(1,0),c(1,0),c(1,0),c(1,0)) Y <- X[rowSums(X)==3,] I can genralize this in a function but the result is quite ugly. Any suggestions? Thank you in advance. Martin
2006 Aug 29
1
First elements of a list.
Suppose I have the following list: a <- strsplit(c("John;Smith", "Jane;Doe", "koda", "gunner"), ";") I want to get to these two vectors without looping... firstNames: c("John", "Jane", "koda", "gunner") lastNames: c("Jane", "Doe", NA, NA) Thanks cn [[alternative HTML
2006 Nov 24
1
barplot help needed
hello, I would like to create the following barplot: I have 4 different data sets (same length + stddev for each data point) data1 sd1 data2 sd2 data3 sd3 data4 sd4 now, I'd like to plot in the following way: data1[1],data2[1],data3[1],data4[1] with it's sd-values side-by-side at one x-axis label (named "position 1") and each bar in different colors.