Displaying 2 results from an estimated 2 matches for "dattaf".
Did you mean:
dataf
2017 Sep 26
2
Surprising message "Error in FUN(newX[, i], ...) : all arguments must have the same length"
...data as it's a huge data frame but I think this has enough diagnostic information to show the issue. I am sure I am missing something obvious. I've put some extra comments in but otherwise this is cut and pasted from Rstudio.
### I wanted a table of the values in four columns:
> apply(datTAF[,75:78],2,table,na.rm=TRUE)
Error in FUN(newX[, i], ...) : all arguments must have the same length
### odd, surely as it's a data frame all x going into table() should be same length. Check:
> apply(datTAF[,75:78],2,length)
RiskSuicide RiskSelfHarm RiskHarmOth RiskLegal
3009...
2017 Sep 26
0
Surprising message "Error in FUN(newX[, i], ...) : all arguments must have the same length"
Hi Chris,
Maybe the na.rm=TRUE is affecting things. Try this
apply(datTAF[,75:78],2,function(x){ sum(!is.na(x)) })
HTH,
Eric
On Tue, Sep 26, 2017 at 9:53 AM, Chris Evans <chrishold at psyctc.org> wrote:
> I am hitting an odd message "Error in FUN(newX[, i], ...) : all arguments
> must have the same length". I can't supply the data as it'...