SCBI-ForestGEO / 2023census

Repository for the 2023 recensus of the SCBI ForestGEO plot
Creative Commons Attribution 4.0 International
3 stars 0 forks source link

Mortality - to collect or not #15

Closed jess-shue closed 1 year ago

jess-shue commented 1 year ago

Sorry @ValentineHerr, I completely skipped reading a section of my code earlier:

add mortality column: 1 = record mortality data, 0 = do not

filter the data for stems >= 100 mm and mortality status 2022 of 'A', 'AU', or 'DS'

stem.mort$mortality <- with(stem.mort, ifelse(dbh >= 100 & current_year_status != "DC", 1, 0))

My thoughts on this were to skip any stems in the mortality data that are less than 100 mm DBH (the small ash etc.) and anything previously recorded as 'DC' - down and dead. Does that make sense?

jess-shue commented 1 year ago

Sorry, I think this is causing a problem because some trees don't have a: <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

current_year_status | current_year_comment -- | -- NA | stem not sampled, info automatically filled from previous year info

Even though they have a DBH >= 100 mm

jess-shue commented 1 year ago

OK, @ValentineHerr, I think I have it using this:

stem.mort$mortality <- with(stem.mort, ifelse(dbh >= 100 & current_year_status != "DC" | is.na(current_year_status), 1, 0))

Does that look correct? (Thank you for your help!)

ValentineHerr commented 1 year ago

Sorry for the delay, my emails were not updating...

The only thing with your statement, I think, is that it will include all is.na(current_year_status), even if dbh < 100.

so I think you need:

stem.mort$mortality <- with(stem.mort, ifelse(dbh >= 100 & (current_year_status != "DC" | is.na(current_year_status)), 1, 0))

(I added parrenthesis around the 2 current_year_status statement)

Also, I tend to prefer using %in% instead of == (using ! when I need !=). Doing so helps dealing with NA properly. If you do that, your code would be:

stem.mort$mortality <- with(stem.mort, ifelse(dbh >= 100 & (!current_year_status %in% "DC" | is.na(current_year_status)), 1, 0))

Do you have NAs in dbh?

ValentineHerr commented 1 year ago

tagging you @jess-shue in case you did not get notified of my answer (just one minute ago)

jess-shue commented 1 year ago

Thanks @ValentineHerr, unfortunately there are NA's in DBH and some with NA's in current_year_status, but DBH >= 100 mm.

I think I've got it now, but it wasn't a clean line of code like you wrote for me! I had to take a look at some stems individually and make a yes/no (1/0) decision. I've added list here: mortality_census_questions

I was running into the following categories that were tricky: <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

dbh_2018 | current_year_status | count | mortality | notes -- | -- | -- | -- | -- <100 | NA, A etc. | - | 0 |   NA | NA, DC | - | 0 |   NA | AU, DS | 6 | 1 | two stems were 0 for mortality - broken below DBH ≥100 | NA | 373 | 1 | some were DC and others DN or DS;R in last census and therefore shouldn't be sampled ≥100 | A, AU, DS | 7447 | 1 |   ≥100 | DC | 112 | 0 |  

ValentineHerr commented 1 year ago

Hmmm weird status… I’ll look into that.... thanks for reporting.

Get Outlook for iOShttps://aka.ms/o0ukef


From: jess-shue @.> Sent: Friday, March 17, 2023 8:53:42 AM To: SCBI-ForestGEO/2023census @.> Cc: Herrmann, Valentine @.>; Mention @.> Subject: Re: [SCBI-ForestGEO/2023census] Mortality - to collect or not (Issue #15)

External Email - Exercise Caution

Thanks @ValentineHerrhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FValentineHerr&data=05%7C01%7Cherrmannv%40si.edu%7C9e50490d7d144cd4f0ef08db26e6a384%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C638146544404497731%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=nJetBBFPOA3b35U1GIae9CrwEr7pxwoIoICRzHQ9wxI%3D&reserved=0, unfortunately there are NA's in DBH and some with NA's in current_year_status, but DBH >= 100 mm.

I think I've got it now, but it wasn't a clean line of code like you wrote for me! I had to take a look at some stems individually and make a yes/no (1/0) decision. I've added list here: mortality_census_questionshttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSCBI-ForestGEO%2F2023census%2Fblob%2Fmain%2Fexample_data%2Fmortality_census_questions.xlsx&data=05%7C01%7Cherrmannv%40si.edu%7C9e50490d7d144cd4f0ef08db26e6a384%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C638146544404497731%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=vzlwvLn%2FsfEE08nNOPgDH5gNElJ4gZ7dkFWGsBTkA3w%3D&reserved=0

I was running into the following categories that were tricky:

dbh_2018 current_year_status count mortality notes <100 NA, A etc. - 0 NA NA, DC - 0 NA AU, DS 6 1 two stems were 0 for mortality - broken below DBH ≥100 NA 373 1 some were DC and others DN or DS;R in last census and therefore shouldn't be sampled ≥100 A, AU, DS 7447 1 ≥100 DC 112 0

― Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSCBI-ForestGEO%2F2023census%2Fissues%2F15%23issuecomment-1473794051&data=05%7C01%7Cherrmannv%40si.edu%7C9e50490d7d144cd4f0ef08db26e6a384%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C638146544404497731%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=2I5%2F5hhmrTwnpq%2BTTnNWvD8hmNXo%2FeNreMXydVnn%2Fxw%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAEWDCIIDK5HYZ26NFPKG2YTW4RNFNANCNFSM6AAAAAAV5R3UP4&data=05%7C01%7Cherrmannv%40si.edu%7C9e50490d7d144cd4f0ef08db26e6a384%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C638146544404497731%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=310JVjb2XUYsZjkBeF5UgopF8XVTRA2%2FSgfcs2yar0c%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

ValentineHerr commented 1 year ago

Oh, I think I misunderstood and thought you found cases where the status as actually "AU,DS" etc...

jess-shue commented 1 year ago

@ValentineHerr Oh, my bad! Those are just the different cases and how they should be categorized.

ValentineHerr commented 1 year ago

@jess-shue , I am sorry I don't have my notes from our meeting with me right now....

Did we say that crown_position_if_dead will be removed? if not can you remind me of the difference between between crown_position and crown_position_if_dead ? (this may be a question for @teixeirak)

jess-shue commented 1 year ago

@ValentineHerr crown_position_if_dead will no longer be collected - there is a slight difference in the categories, but no longer will be an issue.

ValentineHerr commented 1 year ago

fantastic! thanks

And, to confirm, we are not doing emerald ash borer related measurements anymore, correct?

@jess-shue, as I was trying to figure this out I notices FAD choices are not listed in your dictionary (like you did for census_status tab, code_choices tab, etc...). just FYI.

jess-shue commented 1 year ago

@ValentineHerr Yes, I just haven't added them all yet - I've been adding them from the protocol.

teixeirak commented 1 year ago

And, to confirm, we are not doing emerald ash borer related measurements anymore, correct?

correct. I don't want to risk slowing down the census too much.

ValentineHerr commented 1 year ago

I think we can close this