On Thu, 25 Dec 2014, David Winsemius wrote:

On Dec 25, 2014, at 1:04 AM, Mike Miller <mbmille...@gmail.com> wrote:

I just wanted to put this out there. It's just some of my observations about things that happen with R, or happened in this particular investigation. There were definitely some lessons for me in this, and maybe that will be true of someone else. The main thing I picked up is that it is good to put plenty of checks into our code -- if we expect input of a certain type or class, then I should either coerce input into that structure or test the input and throw an error. If the function works very differently for different kinds of input, this should be documented. The more people are doing this, the better things will go for everyone.


I was working with a CRAN package called RFGLS...

http://cran.r-project.org/web/packages/RFGLS/index.html

...and I was getting an error. After a few rounds of testing I realized that the error was caused by a FAMID variable that was of character type.

But The Details section of the help page does say that the accepted FTYPES are all integers between 1 and 6 and the INDIV variables are integers in range 1:4.

But FAMID and FTYPE are different variables, both required.


The problem seemed to be that gls.batch() expected FAMID to be integers, but the default ought to be character type because family and individual IDs in nearly all genetic-analysis software are character strings (they might even be people's names).

You are making up rules that were not in accord with the documentation.

I think you are confusing FTYPE with FAMID.


This was the error:

Error in sum(blocksize) : invalid 'type' (character) of argument
Calls: gls.batch -> bdsmatrix

To figure out more about it, I spent a bunch of time to go from CMD BATCH mode to an interactive session so that I could look at traceback().

Generally the first thing to check is the help page. And if there is a worked example to look at its data:

data(pedigree, package="RFGLS")
str(pedigree)
'data.frame':   4050 obs. of  5 variables:
$ FAMID: int  10 10 10 10 20 20 20 20 30 30 ...
$ ID   : int  11 12 13 14 21 22 23 24 31 32 ...
$ PID  : int  14 14 0 0 24 24 0 0 34 34 ...
$ MID  : int  13 13 0 0 23 23 0 0 33 33 ...
$ SEX  : num  1 1 2 1 2 2 2 1 2 2 …

Thanks for your efforts, but you are mistaken. Before I wrote anything here I had already worked through this with Rob Kirkpatrick, we had run the data() examples, confirmed the error there, and more.

I was a coauthor of the Human Heredity paper that introduced this software and it was based on other work I had done. I'm pretty sure I'm the #1 user of this package.

FTYPE != FAMID

Everything I said was correct.

Mike
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to