Displaying 2 results from an estimated 2 matches for "djhurio".
2010 Feb 12
4
How to get the source code for the assignment of a variable?
'get' can give me the source code for a function. Is there a way to
get the source code for a variable? In the following example, the
source code for x is 'y*y'. Is there a way to get it using the string
'x'?
> f=function(){print('xx')}
> get('f')
function(){print('xx')}
> y=3
> x=y*y
> get('x')
[1] 9
2011 Jan 10
5
Changing a logical matrix into a numeric matrix
Hi,
I would like to turn my TRUE/FALSE matrix into a 1/0 matrix (i.e. True=1 and
False=0)
[,1] [,2] [,3]
[1,] TRUE FALSE FALSE
[2,] TRUE TRUE FALSE
[3,] TRUE TRUE TRUE
[,1] [,2] [,3]
[1,] 1 0 0
[2,] 1 1 0
[3,] 1 1 1
Is there a quick way of doing this without a loop?
Thanks Emma
--
View this message in context: