Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in .checkTypes(e, names_x) #3

Open
doberbauer opened this issue Feb 16, 2022 · 5 comments
Open

Error in .checkTypes(e, names_x) #3

doberbauer opened this issue Feb 16, 2022 · 5 comments

Comments

@doberbauer
Copy link

doberbauer commented Feb 16, 2022

I'm attempting to load my data from a .csv file and I'm encountering an error using savePlotColl2D. "Error in .checkTypos(e, names_x) :
Object 'NA' not found amongst id, x, y, m". My dataset is formatted in the same way as synthetic data generated with genSynth2D.

Here are the commands I've entered and the resulting error in situ.

dts = loadDataFromFile(fname=datapath, 
                       colMeas='m',
                       col = list(Frame='t', IDobj = 'id'))
dcoll = ARCOS::trackColl(dts[m>0], eps = 58.5918)
dcollch = dcoll[,
                .SD[grDevices::chull(x,y)], 
                by = .(t, collid)]
ARCOS::savePlotColl2D(dts, dcoll, 
                      outdir = "./frames",
                      xlim = c(-.5,9),
                      ylim = c(-.5,9),
                      plotwh = c(4,3),
                      imtype = "png")

Error in .checkTypos(e, names_x) : 
  Object 'NA' not found amongst id, x, y, m

The above methods work fine when dts is generated by genSynth2D as per the example in the documentation.
I suspect I'm improperly formatting my inputs for loadDataFromFile but I'm unsure how to proceed.

@doberbauer
Copy link
Author

I forgot to mention, when I started R and entered 'library(ARCOS)' in the console I received a warning message:
Warning message:
replacing previous import ‘data.table::melt’ by ‘reshape2::melt’ when loading ‘ARCOS’

This may be unrelated to my above issue but perhaps not.

@doberbauer
Copy link
Author

doberbauer commented Feb 16, 2022

I managed to get around the error by circumventing the loadDataFromFile function and creating an arcosTS object directly.
I also set the interVal back to 1. What does interVal actually do?

locDT= data.table::fread(datapath)
dts = ARCOS::arcosTS(locDT,colPos = c("x", "y"),
                     colMeas = "m",
                     col = list(Frame = "t",
                                IDobj = "id",
                                RT = NULL,
                                IDcoll = NULL),
                     interType = "fixed",
                     interVal = 1)
dcoll= ARCOS::trackColl(dts[m > 0], 
                        eps = 58.5918)
dcollch = dcoll[,
                .SD[grDevices::chull(x, y)],
                by = .(t,
                       collid)]
ARCOS::savePlotColl2D(dts, dcoll, 
                      outdir = "./frames",
                      imtype = "png")

@dmattek
Copy link
Owner

dmattek commented Feb 17, 2022

When you use the loadDataFromFile function, what is the output of str(dts)?

In your example, you haven't explicitly specified column names. The default value of colPos in loadDataFromFile is x. In your case it should likely be colPos = c("x", "y") just as you do it via the arcosTS function.

You can ignore the warning about melt but when you use melt in your code, be sure to explicitly specify the package from which you want the function to be, i.e., data.table::melt or reshape2::melt.

The parameter interVal specifies the interval of your frame column. It's used when interpolating missing data.

@doberbauer
Copy link
Author

Thanks for your reply.

str(dts) yielded the following:

Classes ‘arcosTS’, ‘data.table’ and 'data.frame': 78792 obs. of 5 variables:
$ t : int 1 1 1 1 1 1 1 1 1 1 ...
$ x : num 43.6 33.8 49.7 40 35.7 ...
$ y : num 1141.1 121.4 52.8 1196.9 1244 ...
$ m : int 0 0 0 0 1 0 0 0 0 0 ...
$ id: int 1 2 3 4 5 6 7 8 9 10 ...

  • attr(*, ".internal.selfref")=
  • attr(*, "colPos")= chr [1:2] "x" "y"
  • attr(*, "colFrame")= chr "t"
  • attr(*, "colIDobj")= chr "id"
  • attr(*, "colMeas")= chr "m"
  • attr(*, "interVal")= num 1
  • attr(*, "interType")= chr "fixed"

Regarding colPos, using colPos = c("x", "y") gave the following warning:

Warning message: In if (!(colPos %in% locColNames)) stop("Position columns missing from the data file.") : the condition has length > 1 and only the first element will be used

I have additional questions regarding ARCOS that aren't support related. May I contact you directly?

@dmattek
Copy link
Owner

dmattek commented Feb 17, 2022

Sure DM me on Twitter or drop me an email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants