fawda123 / SWMPr

R package for accessing, processing, and evaluating data from SWMP of NERRS
http://fawda123.github.io/SWMPr/
13 stars 11 forks source link

qaqc_keep not working? #12

Closed magelcai closed 6 years ago

magelcai commented 6 years ago

I'm having issues with qaqc in SWMPr. I wish to keep all data with '0' and '4' (historical) flag, however qaqc_keep is not working to retain both types of data. Below is the code I'm using... I run the subset(qaqc...) code and all data with flags other than '0' have been converted to 'NA'. Please let me know if you have suggestions on how to do this properly.

CharlestonNutrients_All <- import_local(path, 'soschnut') CharlestonNutrients_Final <- subset(qaqc(CharlestonNutrients_All), qaqc_keep = c('0', '4'), rem_cols = T)

ebourque commented 6 years ago

Morning Caitlin,

Try running CharlestonNutrients_Final <- subset(qaqc(CharlestonNutrients_All, qaqc_keep = c('0', '4')), rem_cols = T)

I believe that the issue you were running into was because you had a ‘)’ after CharlestonNutrients_All when it needed to be after c('0', '4'). That way it reads: qaqc Nut data and keep ‘0’, ‘4’, then subset the data and remove empty columns.

Hopefully this helps,

Ethan

From: Caitlin Magel [mailto:notifications@github.com] Sent: Tuesday, October 17, 2017 7:34 PM To: fawda123/SWMPr SWMPr@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [fawda123/SWMPr] qaqc_keep not working? (#12)

I'm having issues with qaqc in SWMPr. I wish to keep all data with '0' and '4' (historical) flag, however qaqc_keep is not working to retain both types of data. Below is the code I'm using... I run the subset(qaqc...) code and all data with flags other than '0' have been converted to 'NA'. Please let me know if you have suggestions on how to do this properly.

CharlestonNutrients_All <- import_local(path, 'soschnut') CharlestonNutrients_Final <- subset(qaqc(CharlestonNutrients_All), qaqc_keep = c('0', '4'), rem_cols = T)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/fawda123/SWMPr/issues/12, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APLBs21C-W2xwfHlxibmmEFVpoNSEJnwks5stTl0gaJpZM4P89nk.

[Dep Customer Survey]http://survey.dep.state.fl.us/?refemail=Ethan.Bourque@dep.state.fl.us

ebourque commented 6 years ago

Morning again,

Kim wanted me to let you know that another option you might try it to remove the subset term. She believes that in earlier versions of the package you had to use that, but not anymore. It’s just qaqc().

Ethan

From: Caitlin Magel [mailto:notifications@github.com] Sent: Tuesday, October 17, 2017 7:34 PM To: fawda123/SWMPr SWMPr@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [fawda123/SWMPr] qaqc_keep not working? (#12)

I'm having issues with qaqc in SWMPr. I wish to keep all data with '0' and '4' (historical) flag, however qaqc_keep is not working to retain both types of data. Below is the code I'm using... I run the subset(qaqc...) code and all data with flags other than '0' have been converted to 'NA'. Please let me know if you have suggestions on how to do this properly.

CharlestonNutrients_All <- import_local(path, 'soschnut') CharlestonNutrients_Final <- subset(qaqc(CharlestonNutrients_All), qaqc_keep = c('0', '4'), rem_cols = T)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/fawda123/SWMPr/issues/12, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APLBs21C-W2xwfHlxibmmEFVpoNSEJnwks5stTl0gaJpZM4P89nk.

[Dep Customer Survey]http://survey.dep.state.fl.us/?refemail=Ethan.Bourque@dep.state.fl.us

magelcai commented 6 years ago

Hi Ethan, thanks so much for your quick reply. This was very helpful - moving the qaqc_keep term inside the qaqc parentheses fixed the problem! Thank You - Caitlin

fawda123 commented 6 years ago

Hi, sorry I just saw this, not sure why I didn't get an email notification. Looks like you got it figured out though.

I think maybe we're confusing what rem_cols does in subset. By default, qaqc removes the flag columns with the qaqc codes, i.e., those with f_ in the column name. subset with rem_cols = TRUE removes empty columns with NA values that aren't the qaqc code columns. So you need to use both if you want to remove the qaqc columns and empty non-qaqc columns. Make sense?