[RkWard-devel] length() and na.rm

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Aug 16 16:59:29 UTC 2006


> Thanks,
> I'll will look at this later. Ralf T. (thanks again) gave me a quite good
> hint via pm:
>
> which(!is.na(x))
>
> does the job as well. 

Indeed. I think it would be good to have separate counts for total length and 
NAs, though, instead of just the length with NAs silently removed. I've added 
this to the plugin, and resending the relevant files (I've also committed 
them to CVS, but for convenience).

> I attached the changed files plus my test file. 
> BUT, for any reason I get a wrong output when I apply it in the plugin,
> though it's working in the console. Really strange to me. I guess I oversee
> something simple again.

I think the problem came from this line:

if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval 
(which(!is.na(var)))))

it would have to be

if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length 
(which(!is.na(eval (var)))))

The "eval (...)" is only there to re-substitute var with the actual variable.

Fixed that as well.

Finally, I noticed an unrelated deficiency in rk.get.description, which would 
result in getting bad labels in the output. This is fixed in CVS.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: descriptive.tar.gz
Type: application/x-tgz
Size: 1680 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20060816/6e5c7dd1/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20060816/6e5c7dd1/attachment.sig>


More information about the Rkward-devel mailing list