MarcusRowcliffe / camtrapDensity

1 stars 0 forks source link

subset_deployments() not working when media = FALSE #4

Closed bramdhondt closed 1 year ago

bramdhondt commented 1 year ago

Dear Dr. Rowcliffe,

for my dataset, the following lines work properly.

pkg <- read_camtrap_dp("./datapackage.json", media = TRUE)
sub <- subset_deployments(pkg, start >= as_datetime("2023-02-01") &
                            start <= as_datetime("2023-02-28"))

But the following lines do not. The difference lies with the media statement.

pkg <- read_camtrap_dp("./datapackage.json", media = FALSE)
sub <- subset_deployments(pkg, start >= as_datetime("2023-02-01") &
                            start <= as_datetime("2023-02-28"))

The error reads:

Error in UseMethod("filter") : no applicable method for 'filter' applied to an object of class "NULL"

Thus the presence of media seems mandatory for the function to work, when in fact it is optional. This isn't a critical error (as I can read in media), but it might lead other users to frustatingly seek for an explanation. So it would seem best to mention this in the Help file, or fix it.

I still love these functions, as they come in very handy!

Regards, Bram D'hondt Research Institute for Nature & Forest Brussels

MarcusRowcliffe commented 1 year ago

Hi Bram Many thanks for raising this - I'll get that fixed soon as I can. Best Marcus

From: bramdhondt @.> Sent: Friday, May 12, 2023 2:52 PM To: MarcusRowcliffe/camtrapDensity @.> Cc: Subscribed @.***> Subject: [EXT]: [MarcusRowcliffe/camtrapDensity] subset_deployments() not working when media = FALSE (Issue #4)

Dear Dr. Rowcliffe,

for my dataset, the following lines work properly.

pkg <- read_camtrap_dp("./datapackage.json", media = TRUE)

sub <- subset_deployments(pkg, start >= as_datetime("2023-02-01") &

                        start <= as_datetime("2023-02-28"))

But the following lines do not. The difference lies with the media statement.

pkg <- read_camtrap_dp("./datapackage.json", media = FALSE)

sub <- subset_deployments(pkg, start >= as_datetime("2023-02-01") &

                        start <= as_datetime("2023-02-28"))

The error reads:

Error in UseMethod("filter") : no applicable method for 'filter' applied to an object of class "NULL"

Thus the presence of media seems mandatory for the function to work, when in fact it is optional. This isn't a critical error (as I can read in media), but it might lead other users to frustatingly seek for an explanation. So it would seem best to mention this in the Help file, or fix it.

I still love these functions, as they come in very handy!

Regards, Bram D'hondt Research Institute for Nature & Forest Brussels

- Reply to this email directly, view it on GitHubhttps://github.com/MarcusRowcliffe/camtrapDensity/issues/4, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AG2EJMGRKPNFS3MTLDC76N3XFY6APANCNFSM6AAAAAAX7SACDY. You are receiving this because you are subscribed to this thread.Message ID: @.***>


The Zoological Society of London is incorporated by Royal Charter - Registered Charity in England and Wales no. 208728. Principal Office England - Company Number RC000749 - Registered address Regent's Park, London, England NW1 4RY


This e-mail has been sent in confidence to the named addressee(s). If you are not the intended recipient, you must not disclose or distribute it in any form, and you are asked to contact the sender immediately. Views or opinions expressed in this communication may not be those of The Zoological Society of London and, therefore, The Zoological Society of London does not accept legal responsibility for the contents of this message. The recipient(s) must be aware that e-mail is not a secure communication medium and that the contents of this mail may have been altered by a third party in transit.

If you have any issues regarding this mail please visit: https://www.zsl.org/about-us/contact-us

MarcusRowcliffe commented 1 year ago

Fixed by replacing subset_deployments with a new function - filter_camtrap_dp - which doesn't assume media data are included in the input. The new function allows filtering by time slice as well or instead of dropping whole deployments.

MarcusRowcliffe commented 1 year ago

Hi Bram You may have seen that I closed this issue. I've deprecated subset_deployments and replaced it with filter_camtrap_dp. This function:

From: bramdhondt @.> Sent: Friday, May 12, 2023 2:52 PM To: MarcusRowcliffe/camtrapDensity @.> Cc: Subscribed @.***> Subject: [EXT]: [MarcusRowcliffe/camtrapDensity] subset_deployments() not working when media = FALSE (Issue #4)

Dear Dr. Rowcliffe,

for my dataset, the following lines work properly.

pkg <- read_camtrap_dp("./datapackage.json", media = TRUE)

sub <- subset_deployments(pkg, start >= as_datetime("2023-02-01") &

                        start <= as_datetime("2023-02-28"))

But the following lines do not. The difference lies with the media statement.

pkg <- read_camtrap_dp("./datapackage.json", media = FALSE)

sub <- subset_deployments(pkg, start >= as_datetime("2023-02-01") &

                        start <= as_datetime("2023-02-28"))

The error reads:

Error in UseMethod("filter") : no applicable method for 'filter' applied to an object of class "NULL"

Thus the presence of media seems mandatory for the function to work, when in fact it is optional. This isn't a critical error (as I can read in media), but it might lead other users to frustatingly seek for an explanation. So it would seem best to mention this in the Help file, or fix it.

I still love these functions, as they come in very handy!

Regards, Bram D'hondt Research Institute for Nature & Forest Brussels

- Reply to this email directly, view it on GitHubhttps://github.com/MarcusRowcliffe/camtrapDensity/issues/4, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AG2EJMGRKPNFS3MTLDC76N3XFY6APANCNFSM6AAAAAAX7SACDY. You are receiving this because you are subscribed to this thread.Message ID: @.***>


The Zoological Society of London is incorporated by Royal Charter - Registered Charity in England and Wales no. 208728. Principal Office England - Company Number RC000749 - Registered address Regent's Park, London, England NW1 4RY


This e-mail has been sent in confidence to the named addressee(s). If you are not the intended recipient, you must not disclose or distribute it in any form, and you are asked to contact the sender immediately. Views or opinions expressed in this communication may not be those of The Zoological Society of London and, therefore, The Zoological Society of London does not accept legal responsibility for the contents of this message. The recipient(s) must be aware that e-mail is not a secure communication medium and that the contents of this mail may have been altered by a third party in transit.

If you have any issues regarding this mail please visit: https://www.zsl.org/about-us/contact-us