This data was collected to an answer the research question: “Does antimicrobial prescription compared to no antimicrobial prescription and (separately) gastrointestinal nutraceutical prescription compared to no gastrointestinal nutraceutical prescription for acute diarrhoea in dogs cause a difference in clinical resolution and time to treatment escalation?”.
This study was done as part of a larger PHD thesis, more information can be found at the authors data site: “https://github.com/cpegram92/causal-inference-phd”.
Rows: 894 Columns: 21
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (8): BirthDate, SexNeuterStatus, VetCompassBreed, DateofFirstPresentati...
dbl (13): PatientID, DataSilo, InsuranceStatus, Bodyweight, Vomiting, Reduce...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
names(Diarrhea.trials) #quick visual of variable names
These three functions are found in the stringr package and are string manipulators that change how values or variable names with mutliple words are visualized.
This function converts chosen string by capitalizing the first letter of each word within the string. The default setting will not capitalize the first letter(first_upper = FALSE).
To capitalize the first letter of every word use: first_upper = TRUE.
This function is also called “camel case”.
In this example I changed all the variable names to the default camel case, using the recently made dataset, D.Snake.2.
In this example I showed how this function can be used to change a dataset’s variable names to the camel case using the first_upper = TRUE on the dataset D.Snake.2.
# first letter of every word capitalized D.Camel.2<- D.Camel.1|>select(1:10) |>rename_with(str_to_camel, first_upper =TRUE)names(D.Camel.2)
These functions can be useful tools in data cleaning as they can easily and quickly change how variable names and character values are shown. Of the three, I liked the str_to_snake the best as this one aligns more with our naming conventions and is the easiest to read quickly.
The dataset used here, utilized str_to_camel without the default setting so it was nice to see one of these options being used in real world studies.