I was trying to acquaint myself with R’s nChooseK function but I can’t get it to work. I thought it was part of the standard setup (i.e. no additional package needed).
Please help. Here is what I tried:
> nChooseK(10,2)
Error: could not find function "nChooseK"
> n<-4;k<-2
> print(nChooseK(n,k))
Error in print(nChooseK(n, k)) : could not find function "nChooseK"
the last one was an example I saw here: R basic nChooseK
As joran mentions the function
nChooseKis a part of R.basic. You can tell this from the example you posted by looking at the top of the page:You’ll notice the “R.basic” in the curley braces which tells you that that function is a part of the “R.basic” package. So to use
nChooseKyou’ll first need to load that packageIf you don’t have R.basic installed yet then you’ll need to install it
But as noted the
choosefunction in base R does the same thing