Reputation: 41
I am using
pwfst <-stamppFst(gl, nboots=1, percent=95, nclusters=1)
round(pwfst,3)
This works perfectly if nboots = 1,
but when I try nboots = 3,
I get the following error:
Error in round(pwfst, 3) : non-numeric argument to mathematical function
I want to eventually use nboots = 100
I have read several posts with
non-numeric argument to mathematical function
But none relate to this problem. One post advised advised ensuring I only had the necessary packages loaded. I have done that and no change.
Has anyone any ideas please? thanks.
EDIT: pwfst
is not a list.
It has this form - there are 5 more columns
Bees Nest Ridge_12 Bees Nest Ridge_15 Broken Back Trail Cousins Creek
Bees Nest Ridge_12 NA NA NA NA
Bees Nest Ridge_15 0.092 NA NA NA
Broken Back Trail 0.124 0.067 NA NA
Cousins Creek 0.396 0.352 0.376 NA
Sawpit Rd 0.104 0.046 0.077 0.349
Wallaby Rocks 0.450 0.384 0.421 0.540
Bees Nest Ridge_13 0.161 0.098 0.132 0.403
Wingen Maid 0.433 0.376 0.409 0.537
Bees Nest Ridge_14 0.086 0.025 0.056 0.354
Second edit:
str(pwfst)
returns
num [1:9, 1:9] NA 0.0922 0.1243 0.3964 0.1038 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:9] "Bees Nest Ridge_12" "Bees Nest Ridge_15" "Broken Back Trail" "Cousins Creek" ...
..$ : chr [1:9] "Bees Nest Ridge_12" "Bees Nest Ridge_15" "Broken Back Trail" "Cousins Creek" ...
Hopefully that is enough info for someone to be able to help me. Thanks, Ruth P
Upvotes: 0
Views: 88
Reputation: 6132
The documentation for the stamppFst()
function reads: "If nboots<2, no bootstrapping is performed and therefore only a matrix of Fst values is returned." Therefore, when pwfst
is a result of an analysis using 1 boot you supply a matrix to the round
function, which the round
function can handle. In other cases (when nboots >= 2), you supply a list to the round
function, which it is not able to handle this way.
If pwfst
is a list, you could run lapply(pwfst, round)
so that it runs round on every matrix in the list.
Upvotes: 1