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

Stefan Rödiger stefan_roediger at gmx.de
Wed Aug 16 16:56:35 UTC 2006


Am Mittwoch, 16. August 2006 14:37 schrieb Thomas Friedrichsmeier:
> Hi,
>
> On Tuesday 15 August 2006 16:41, Stefan Rödiger wrote:
> > I tried to add length() to Descriptive statistics. But I stumbled over
> > something rather simple. How can I strip NAs from numeric columns?
> > length() does not support the the na.rm=T argument.
>
> you could use
>
> length (na.omit (x))
>
> Slightly more complicated to add in the plugins than simple options, as
> you'll acutally have to use some simple php-logic to add "na.omit (" before
> and ")" after the variable name.
>
> Something like
>
> function printout () {
> 	$xvalue = getRK_val ("x");
> 	if (getRK_val ("omitnas") == "1") {
> 		// you'd use "1" as the value when checked for the "omitnas"-option
>
> 		$xvalue = "na.omit (" . $xvalue . ")";
> 	}
> 	echo ('length ("' . $xvalue . '")');
> }
>
> Let me know, if you need more instructions.
>
> Regards
> Thomas

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. 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.
Well, let's see.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.r
Type: application/octet-stream
Size: 27758 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20060816/4f7d6c4a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20descriptive.tar.gz
Type: application/x-tgz
Size: 1677 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20060816/4f7d6c4a/attachment.bin>


More information about the Rkward-devel mailing list