Re: [R] How to create a numeric data.frame

2011-06-13 Thread Richard M. Heiberger
Aparna, Something is very strange here. I think it is time to go back to the original data source and find out why the file you thought contained numbers was read as factors. Is there an unanticipated comma in a field? Did you forget to say header=TRUE? Rich On Mon, Jun 13, 2011 at 5:30 PM, Josh

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Joshua Wiley
On Mon, Jun 13, 2011 at 2:11 PM, Patrizio Frederic wrote: > On Mon, Jun 13, 2011 at 6:47 PM, Aparna wrote: >> Hi Joshua >> >> While looking at the data, all the values seem to be in numeric. As i >> mentioned, >> the dataset is already in data.frame. >> >> As suggested, I used str(mydata) and go

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Patrizio Frederic
On Mon, Jun 13, 2011 at 6:47 PM, Aparna wrote: > Hi Joshua > > While looking at the data, all the values seem to be in numeric. As i > mentioned, > the dataset is already in data.frame. > > As suggested, I used str(mydata) and got the following result: > > > str(leu_cluster1) > 'data.frame': 98

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Aparna
Hi Sarah Thanks for your advice. My dataset contains all the normalized values. I have to give this dataset as input to ClusterCons package in R. In order to run the package, it requires the data to be converted to numeric data.frame. When i check my data using class(mydataset), it is in the

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Aparna
Hi Joshua While looking at the data, all the values seem to be in numeric. As i mentioned, the dataset is already in data.frame. As suggested, I used str(mydata) and got the following result: str(leu_cluster1) 'data.frame': 984 obs. of 100 variables: $ V2 : Factor w/ 986 levels "-0.0025

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Patrizio Frederic
> > Which results in vector of numbers > > str(as.numeric(as.matrix(a))) >  num [1:100] 0.82 -1.339 1.397 0.673 -0.461 ... > > data frame is convenient list structure which can contain vectors of > various nature (numeric, character, factor, logical, ...) > and looks quite similar to Excel table. >

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.06.2011 17:19:39: > Patrizio Frederic > > On Mon, Jun 13, 2011 at 4:45 PM, Barry Rowlingson > wrote: > > On Mon, Jun 13, 2011 at 11:06 AM, Aparna wrote: > >> Hi All > >> > >> I am new to R and I am not sure of how this should be done. I have a

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Patrizio Frederic
On Mon, Jun 13, 2011 at 4:45 PM, Barry Rowlingson wrote: > On Mon, Jun 13, 2011 at 11:06 AM, Aparna wrote: >> Hi All >> >> I am new to R and  I am not sure of how this should be done. I have a matrix >> of >> 985x100 values and the class is data.frame. > >  You don't have a 'matrix' in the R sen

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Joshua Wiley
On Mon, Jun 13, 2011 at 7:45 AM, Barry Rowlingson wrote: [snip] >  now you may think it reasonable to do an 'as.numeric' on that, but what > about: > >  as.numeric(list(foo=list(bar=c(1,2,3),baz=c(34,5)),bar=c("Hello","World")) > >  how would you 'as.numeric' that? Well, "Hello" is one of the fi

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Barry Rowlingson
On Mon, Jun 13, 2011 at 11:06 AM, Aparna wrote: > Hi All > > I am new to R and  I am not sure of how this should be done. I have a matrix > of > 985x100 values and the class is data.frame. You don't have a 'matrix' in the R sense of the word. You seem to have a table of numbers which are stored

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Joshua Wiley
Hi, If your matrix is already numeric, then: as.data.frame(your_matrix_name) will do the trick. However, if you have a matrix that is not numeric (say it is character), then you could use: as.data.frame(as.numeric(your_matrix_name)) Matrices can only hold one class of data (for example, all n

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Sarah Goslee
What are you trying to do? It looks numeric, although a visual assessment isn't reliable. The output of str() would be helpful. But I'm not sure what your objective is. What do you think your data frame is now, and what do you think it should be? Sarah On Mon, Jun 13, 2011 at 6:06 AM, Aparna w

[R] How to create a numeric data.frame

2011-06-13 Thread Aparna
Hi All I am new to R and I am not sure of how this should be done. I have a matrix of 985x100 values and the class is data.frame. A sample of my dataset looks like this (Since its a huge dataset and it would make the screen look more complex, I am pasting only the first few rows and columns.