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

check_strat not working #78

Open
afredston opened this issue Jun 22, 2018 · 4 comments
Open

check_strat not working #78

afredston opened this issue Jun 22, 2018 · 4 comments

Comments

@afredston
Copy link

When I run the check_strat example provided in the documentation ?check_strat, I get an error:

> neus.check <- check_strat(neus[,c("year"):=list(as.integer(year))], "neus")
Error in is.finite(y) : default method not implemented for type 'list'

Thanks for looking into this!

@rBatt
Copy link
Owner

rBatt commented Jun 25, 2018

I think this has been fixed. The problem was, apparently, some change to data.table.

Previously, doing something like

a <- data.table(ref=sample(LETTERS, 20, replace=TRUE), goat=rnorm(20))
a[,1:length(unique(ref))]

would return something like

[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14

i.e., a sequence of integers beginning at 1 and increasing to the maximum number of unique values in the column ref. Now, however, it returns something like this:

ref

1: M
2: V
3: X
4: F
5: K
6: K
7: S
8: A
9: T
10: N
11: C
12: I
13: K
14: C
15: U
16: L
17: A
18: G
19: F
20: M

I'm not entirely sure what it's getting at, here. The fix is to simply wrap the j statement (the stuff after the first comma) in ():

a[,(1:length(unique(ref)))]

@afredstonhermann --- if it works for you now, I can assume the fix was good and I'll close the issue. Thanks for calling this to my attention, and for helping me test!

@afredston
Copy link
Author

Thanks @rBatt! Happy to test the function, but I can't get devtools::install_github("rBatt/trawlData") to run. I get basically the same error on the NCEAS server and on my local machine (except the path name to the package, of course):

Error in load(zfile, envir = envir) : 
  bad restore file magic number (file may be corrupted) -- no data loaded
ERROR: lazydata failed for package ‘trawlData’
* removing ‘/home/fredstonhermann/R/x86_64-pc-linux-gnu-library/3.4/trawlData’

Any ideas for what might be the issue? Sorry this bug refuses to die...

@rBatt
Copy link
Owner

rBatt commented Jun 26, 2018 via email

@afredston
Copy link
Author

OK, took a minute to figure that out on the server, but it works perfectly now--and isn't even that slow ;) Thank you!

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