Kinship2 Pedigree Construction: Error "Missing Value where true or false is needed"

I am trying to construct a pedigree with kinship2 which I later intend to plot. Yet I keep receiving the error

"if (min(sex) == 0) sex <- sex + 1 : missing value where TRUE/FALSE needed".

I have already tried adding this statement in addition to my function, and as a result a new error is produced



dogped<-with(dumdog, pedigree(id, fatherid, motherid,sex))
#this produces error : if min... true/false needed, so I tried this

dogped<-with(dumdog, pedigree(id, fatherid, motherid, sex)){
    sex<-sex + 1
#this produces error "Error: unexpected '}' in '}'"

#but I also knew that I had no 0 values in my column sex (only 1 for male 
and 2 for female) so this if statement will produce an NA

#so i tried something like this:
dogped<-with(dumdog, pedigree(id, fatherid, motherid, sex)){
    sex<-sex + 0
#but I got the same "}" error as above and my pedigree dataframe still 
wasn't created.

I had this problem before with a different dataset and I ended up using a different package to make smaller pedigrees. But I need to display at least 20 generations in a pedigree in order to do some analysis, so I really hope I can get this working. There is a minnbreast example dataset you can use from the kinship2 package to do this, but it doesn't produce the error codes above so I am not sure this will be helpful.