Watts-College / cpp-527-spr-2022

https://watts-college.github.io/cpp-527-spr-2022/
0 stars 1 forks source link

Lab 4 Q3 #24

Open dholford opened 2 years ago

dholford commented 2 years ago

I'm really struggling with matching trailing spaces. I've tried a number of different options for matching the sum of mission statements with trailing spaces, but once I use trimws( ) then run it again nothing changes. So I'm assuming I'm doing it wrong.

I've tried:

grepl("\s$", dat$mission)

grepl(". $", dat$mission)

grepl(" $", dat$mission)

any searching I've done has lead me to removing trailing spaces but I haven't found anything on matching trailing spaces.

Dselby86 commented 2 years ago

Can you post an example of a string where you can't remove the trailing spaces from?

On Sun, Feb 6, 2022, 10:49 PM dholford @.***> wrote:

I'm really struggling with matching trailing spaces. I've tried a number of different options for matching the sum of mission statements with trailing spaces, but once I use trimws( ) then run it again nothing changes. So I'm assuming I'm doing it wrong.

I've tried:

grepl("\s$", dat$mission)

grepl(". $", dat$mission)

grepl(" $", dat$mission)

any searching I've done has lead me to removing trailing spaces but I haven't found anything on matching trailing spaces.

— Reply to this email directly, view it on GitHub https://github.com/Watts-College/cpp-527-spr-2022/issues/24, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4EHB5NLOIQXSYEUTTYAT3UZ5MPJANCNFSM5NWO64QA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

dholford commented 2 years ago

Hey Dr. Selby,

Thanks for following up. Your question knocked something loose and I realized my issue was trimws( ) returns the variable without whitespaces, but it wasn't actually saving those results in the data frame. So I updated from:

trimws(dat$mission) to dat$mission <- trimws(dat$mission) and when I ran the count of trailing spaces again it worked.

Dselby86 commented 2 years ago

In programming there is something called being a rubber duckie. Where you explain a problem to someone as if they were a rubber duckie in your bath tube, and use that to figure out the solution.

I'm glad I could be your Rubber Duckie

On Mon, Feb 7, 2022 at 9:15 AM dholford @.***> wrote:

Hey Dr. Selby,

Thanks for following up. Your question knocked something loose and I realized my issue was trimws( ) returns the variable without whitespaces, but it wasn't actually saving those results in the data frame. So I updated from:

trimws(dat$mission) to dat$mission <- trimws(dat$mission) and when I ran the count of trailing spaces again it worked.

— Reply to this email directly, view it on GitHub https://github.com/Watts-College/cpp-527-spr-2022/issues/24#issuecomment-1031649027, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4EHB3KPKR5WZEL4V3I3FTUZ7V3BANCNFSM5NWO64QA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

dholford commented 2 years ago

image

Thanks!