[R] Unexpected error subset assignment (bug?)

2005-03-24 Thread Tuszynski, Jaroslaw W.
Hi,

I run into following problem. It seems to me that operation in the 3rd line
should be valid.

 b = matrix(as.raw(0), 8,8)
 q = as.raw(1:8)
 b[1,] = q
Error: incompatible types in subset assignment
 length(b[1,])
[1] 8
 typeof(b[1,])
[1] raw
 length(q)
[1] 8
 typeof(q)
[1] raw

Is this a bug or a feature?

Jarek
=\ 
 Jarek Tuszynski, PhD.   o / \ 
 Science Applications International Corporation  \__,|  
 (703) 676-4192  \
 [EMAIL PROTECTED]   `\



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Unexpected error subset assignment (bug?)

2005-03-24 Thread roger bos
I didn't know anything about as.raw(), so I did ?as.raw and it refer
to raw vector, so my guess is that it doesn't work with matrix types. 
The following modified code seems to work, however:

b = matrix(0, 8,8)
q = 1:8
b[1,] = q
b - as.raw(b)
dim(b) - c(8,8)

HTH,
Roger


On Thu, 24 Mar 2005 10:32:33 -0500, Tuszynski, Jaroslaw W.
[EMAIL PROTECTED] wrote:
 Hi,
 
 I run into following problem. It seems to me that operation in the 3rd line
 should be valid.
 
  b = matrix(as.raw(0), 8,8)
  q = as.raw(1:8)
  b[1,] = q
 Error: incompatible types in subset assignment
  length(b[1,])
 [1] 8
  typeof(b[1,])
 [1] raw
  length(q)
 [1] 8
  typeof(q)
 [1] raw
 
 Is this a bug or a feature?
 
 Jarek
 =\
 Jarek Tuszynski, PhD.   o / \
 Science Applications International Corporation  \__,|
 (703) 676-4192  \
 [EMAIL PROTECTED]   `\
 
[[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html