Error in xj[i] (get_mis.R#L32): invalid subscript type 'list'
In simple_dup.R#L139-143
and in other scripts that use the get_mis()
function (e.g new_get_pairs.R
)
We have an error that keeps appearing, when the functions built by the package are used. This error disappears if the function is source in.
The following works:
source("~/icoads-r-hostace/rutils/get_mismatch.R")
pp.dup.mo<- get_mis(df.in=sub,key.list=key.list,close.list=close.list,
tol.pos=0.51,tol.id=9, tol.w=2,tol.d=13,
tol.sst=1.01,tol.at=1.01,tol.dpt=1.01,tol.slp=1.01,
tol.ww=99,tol.w1=99,tol.vv=99)
The following fails:
pp.dup.mo<- icoads.utils::get_mis(df.in=sub,key.list=key.list,close.list=close.list,
tol.pos=0.51,tol.id=9, tol.w=2,tol.d=13,
tol.sst=1.01,tol.at=1.01,tol.dpt=1.01,tol.slp=1.01,
tol.ww=99,tol.w1=99,tol.vv=99)
Error in xj[i] (simple_dup.R#131): invalid subscript type 'list' Show stack trace
The trace points to icoads.utils::get_mis()
function in get_mis.R#L32
And then points to [data.table and [data.frame R functions..
Is there another way of writing these lines?
data <- data.table::data.table(df.in, key = key.list)
pp <- data[data, allow.cartesian = TRUE]
following the trace the error points on a mix of errors in data.table and data.frame
Maybe there is a conflict when creating the data.table and sub setting by a list. This of course does not happen if the functions is source in with a path-to-r-script