Hi

Although not specifically stated in help page, matrix is a vector with dim 
attribute. Therefore it can have only one type of values either numeric or 
character or logical or factor. So if you want textual and numeric values 
you probably have to stick with data frames.

Regards
Petr
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 11.09.2007 15:43:20:

> Hi,
> 
> I would like to store some text and decimal values in the following 
> form:
> 
> name   dec.val   dec.val   ...   dec.val
> name   dec.val   dec.val   ...   dec.val
> ...
> name   dec. val    dec.val   ...   dec.val
> 
> To do so, I created a matrix of the necessary size (x row per y cols) 
> with the command
> 
> matrixname <- matrix(0,x,y)
> 
> and proceeded to fill in the matrix with information drawn from a 
> data frame.
> 
> The problem is that the resulting matrix only has integers at the end 
> of the filling process.
> 
> When I ask:
> class(dataframename[i,j])
> The answer is "factor"
> 
> What is the best way of solving the problem. Should I use a data 
> structure other than a matrix? Or should I make the elements be a 
> different class (other than "factor") when I assign them to the matrix?
> 
> Thanks for any help!
> 
> G.
> 
> 
> 
> 
> 
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to