I am trying to create a grouped boxplot using a fairly simple, but long dataset called trch
.
First I used trchtrue<- trch[complete.cases(trch), ]
to create a matrix with two columns and no 'NaN' values.
> head(trchtrue)
REACH WTEMP
2 1 11.090
3 2 11.120
4 3 11.200
5 4 9.334
6 5 9.556
7 6 9.263
> tail(trchtrue)
REACH WTEMP
1342315 99 0.100
1342316 100 5.131
1342317 101 0.100
1342318 102 0.100
1342319 103 0.100
1342321 105 4.994
When trying to create a grouped box plot using boxplot(trchtrue$REACH~trchtrue$WTEMP)
, I get the following error:
Error in x[floor(d)] + x[ceiling(d)] : non-numeric argument to binary operator
With the exception of the column titles, all of the values appear to be numeric, however, I get this result:
is.numeric(trchtrue)
[1] FALSE
I am not able to convert the matrix to numeric either.
> as.numeric(trchtrue)
Error: 'list' object cannot be coerced to type 'double'
> mode(trchtrue) = "numeric"
Error in mde(x) : 'list' object cannot be coerced to type 'double'
How can I convert this matrix to numeric so I can make the box plot?
EDIT: In the original dataset, the values were in E notation. Could this be part of the problem?
EDIT 2: Here is the reprex.
boxplot(trchtrue$REACH~trchtrue$WTEMP)
#> Error in eval(predvars, data, env): object 'trchtrue' not found
Created on 2020-12-31 by the reprex package (v0.3.0)