Re: [R] NaNS Error Message

2013-03-26 Thread Sahana Srinivasan
pper limit). On Tue, Mar 26, 2013 at 3:41 PM, Berend Hasselman wrote: > > On 26-03-2013, at 16:25, Sahana Srinivasan > wrote: > > > Hi, > > I'm using R to do a series of calculation and I have gotten several > > warnings that say "NaNS produced".

[R] NaNS Error Message

2013-03-26 Thread Sahana Srinivasan
Hi, I'm using R to do a series of calculation and I have gotten several warnings that say "NaNS produced". Whatever I could read on line gives me an idea that this warning is produced when the number is use is a negative log or otherwise mathematically problematic. I'm getting this error while usin

Re: [R] nested 'while' loops

2013-03-25 Thread Sahana Srinivasan
while(x<=21) { while(y<=rown) { n<-as.numeric(df[[y]][x]); if(n>0) { while(k<=lim) { k<-k+1; } # while loop for k closes opdf[[y]][x]<-sum; } # if statement closes y<-y+1; } #while for y closes x<-x+1; } #while wi

Re: [R] nested 'while' loops

2013-03-25 Thread Sahana Srinivasan
0.8318080222553840.8318080222553840.8318080222553840.831808022255384 0.8318080222553843amt:Amet_0002NANANANANANANANANANANANANANANANANANANANA4 On Mon, Mar 25, 2013 at 5:43 PM, Sahana Srinivasan < sahanasrinivasan...@gmail.com> wrote: > Hi everyone, > I'm using the following code to go over every element of a data frame (row > wis

[R] nested 'while' loops

2013-03-25 Thread Sahana Srinivasan
Hi everyone, I'm using the following code to go over every element of a data frame (row wise). The problem I am facing is that the outer 'x' variable is not incrementing itself, thus, only one row of values is obtained, and the program does not proceed to the next row. This is the code: while(x<=

[R] trouble with data frame

2013-03-22 Thread Sahana Srinivasan
Hi everyone, I am trying to use the values from every cell of the data frame in a further calculation. This is the code that I am using to catch every element of the data-frame. while (a<=10) { while (b<=10) { n<-as.numeric(df[a,b)]; ...; } } The problem is that when I print out 'n' I get the fol

Re: [R] Copying rows in data frames

2013-03-19 Thread Sahana Srinivasan
uot;92", "94", "95", "97", "98", "99", "I"), class = "factor"), V10 = structure(c(109L, 36L, 32L, 3L, 46L, 9L), .Label = c("0", "1", "10",

Re: [R] Copying rows in data frames

2013-03-19 Thread Sahana Srinivasan
I.. did? Here is the whole thing: Output dataframe, df2: (NA is because I haven't filled those cells in yet, but they will have numeric values) 1462696298812268108381201091254781626868918410126662NANANANANANANANANANANANA NANANANANANANANANA Input dataframe, df1: 1GENEACDEFGHIKLMNPQRSTVWY2amt:Amet_

[R] Copying rows in data frames

2013-03-19 Thread Sahana Srinivasan
Hi, I'm trying to copy the first row of one data frame to another. This is the statement I am using : df2[1,]<-df1[1,]; I have printed them out separately: df1[1,] = A C D E F But after copying: df2[1,] = 96 29 88 122 68 Why isn't it copying? They are both data frames, and "as.character" isn't

[R] Problem with write.table

2013-03-18 Thread Sahana Srinivasan
Hi everyone, I'm trying to create unique filenames and then write a data frame into these files. This is the code I am using. str1<-"fname" str2<-".ext.txt"; FILENAME<-paste0(str1,str2); write.table(df, file=FILENAME,col.names=FALSE,row.names=FALSE,quote=FALSE,sep="\t"); Ideally, a file calle

[R] Equivalent of deal in R?

2013-03-14 Thread Sahana Srinivasan
HI, I'm looking for a function that does the same as deal() in MATLAB, i,e, for an array x[1 2 3] [a,b,c]=x; such that a=1, b=2, c=3 Does R have any functions similar to this? [[alternative HTML version deleted]] __ R-help@r-project.org mailing

[R] Copying a dataframe

2013-03-07 Thread Sahana Srinivasan
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]

[R] Generating unique filenames.

2013-03-06 Thread Sahana Srinivasan
Hi, I am trying to create unique filenames for my output text file. The idea is that I would like to append a string to ".zsc.txt" so that all my files are uniquely named but with a similar format. I have tried adding the string variable to ".zsc.txt" while creating the output file name, i.e. write

[R] Iteration through a list in R

2013-02-28 Thread Sahana Srinivasan
Hello :) I'm just starting out with R and would appreciate your help with a couple of problems I am running into. I have used Sys.glob to get a list of all filenames having a particular file extension (in my case, *.txt) I would now like to use this list in the following manner: I would like to use