File: getScalarLogical.c

package info (click to toggle)
r-cran-mcmc 0.9-5-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,304 kB
  • sloc: ansic: 1,426; makefile: 14; sh: 8
file content (15 lines) | stat: -rw-r--r-- 310 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

#include <R.h>
#include <Rinternals.h>
#include "myutil.h"

int
getScalarLogical(SEXP foo, char *argname)
{
    if (! isLogical(foo))
        error("argument \"%s\" must be logical", argname);
    if (LENGTH(foo)  != 1)
        error("argument \"%s\" must be scalar", argname);
    return LOGICAL(foo)[0];
}