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 sometimes returns visibly, however it should be invisible #1852

aaronmcdaid opened this issue Sep 22, 2016 · 1 comment


Copy link

@aaronmcdaid aaronmcdaid commented Sep 22, 2016

x=data.table(1)[0]  # an empty data.table

Typing x on its own calls the data.table print method:

> x
Empty data.table (0 rows) of 1 col: V1

Typing print(x) should give the same result as above, however there is extra output:

> print(x)
Empty data.table (0 rows) of 1 col: V1

Very low priority I guess, but a bug nonetheless (I think).

I think it's because, in such cases, the return statement (within the code for is as follows:


However, it should return invisibly, as expected by the ?print documentation

‘print’ prints its argument and returns it invisibly (via

The method should return the value (not NULL) and it should return invisibly. Something like:

Copy link

@MichaelChirico MichaelChirico commented Sep 29, 2016

@mattdowle mattdowle added this to the v1.10.6 milestone May 17, 2017
@mattdowle mattdowle closed this in 9700b49 May 18, 2017
mattdowle added a commit that referenced this issue May 18, 2017
Closes #1852 -- print( no longer visibly returns NULL
mattdowle added a commit to mattdowle/SpaDES.core that referenced this issue Apr 28, 2018
Reverse dependency testing revealed `SpaDES.core` will break with the data.table v1.11.0 update to CRAN.
Bug fix 8 in v1.11.0 NEWS is :
> 8. Printing a null `data.table` with `print` no longer visibly outputs `NULL`, [#1852](Rdatatable/data.table#1852). Thanks @aaronmcdaid for spotting and @MichaelChirico for the PR.

This PR should make SpaDES.core pass R CMD check with data.table both before and after v1.11.0

The failure is :
── 1. Failure: simList object initializes correctly (@test-simList.R#17)  ──────────────────────────
length(out) not equal to 75.
1/1 mismatches
[1] 73 - 75 == -2
══ testthat results  ═══════════════════════════════════════════════════════════
1. Failure: simList object initializes correctly (@test-simList.R#17) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants