search for: opdf

Displaying 3 results from an estimated 3 matches for "opdf".

Did you mean: gpdf
2013 Mar 12
2
Troubleshooting code
...ting all files of a particular extension, saving in a list* a<-1; while(a<=length) *#going through every element of the list* { df1<-read.table(files[a]); c.leng<-length(files[,1]); r.leng<-length(files[1,]); *#creating data frame for output with the same dimensions as input* opdf<-data.frame(matrix(rep(NA,nrow(df1)*ncol(df1)),nrow=nrow(df1))); opdf[,1]<-df1[,1]; opdf[1,]<-df1[1,]; *#copying the first row and first column so they have the same headers* b<-2; while(b<=c.leng) *#working through each row of the input data frame* { c<-2; while...
2013 Mar 07
2
Copying a dataframe
Hi, I am trying to create a data frame using the dimensions of another data frame that I have input. This is the code I am using: tab is the data frame that is input. c.leng<-length(tab[,1]); r.leng<-length(tab[1,]); opdf<-data.frame(ncol=c.leng, nrow=r.leng); a<-1; while(a<=c.leng) { opdf[[1]][a]<-tab[[1]][a]; a<-a+1; } This is the error message I am getting: Error in `[[<-.data.frame`(`*tmp*`, 1, value = c(4626L, 1L)) : replacement has 2 rows, data has 1 I have tried printing out the dimensions...
2013 Mar 25
3
nested 'while' loops
...tself, thus, only one row of values is obtained, and the program does not proceed to the next row. This is the code: while(x<=coln) { while(y<=rown) { n<-as.numeric(df[[y]][x]); if(n>0) { lim<-(n-1); S<-100; (...) } opdf[[y]][x]<-sum; } y<-y+1; } x<-x+1; } Here is a sample of the input data: GENE A CD EF GH IK LM NP QR ST VW Y 2amt:Amet_0001 29 023 3417 1612 4229 39635 20 1325 3427 323 12 3amt:Amet_0002 19 315 4212 188 3525 437 2613 914 2120 30 0 8 [[alternative HTML version deleted]]