data so you can be explicit about the variables to summarize. I would also recommend using the data pronoun. ![]() Mutate(Use = ifelse(Use = 0, "No", "Yes")) %>% When building the dplyr::summarize call you can use the qwraps2::frmtci call to format the output of qwraps2::meanci into a character string of length one. My answer is similar to that from but (1) I don't combine the Y values with Use and (2) I do some renaming to get output more like the example. with 3 more variables: X4_sd, X5_sd, X6_sd Summarise_at(vars(starts_with("X")), funs(mean = mean(.), sd = sd(.))) Table1 = pd.concat(frames, keys=, ignore_index=False) So how can I code this so it looks like Figure 1?įWIW, this is more or less the code I used in python but I need it for R. However this only gives me the summary for the variable X1 and I need it to be grouped-by Y1, Y2, Y3 and the rest of the X variables. So far I've figured out I can use the dplyr package to groupby and summarize a dataset: df %>% I want to be able to convert df to look like Figure 1 in R. ![]() ![]() Imagine that the starting dataframe df looks like this: Y1 Y2 Y3 Sex X1 X2 X3 X4 X5 X6 summarize function needs to apply some functions on input, so we can either keep text out of it and keep together with id within groupby, or use first function within summarize: text should be in groupby to show up in result mydf > groupby (id, text) > summarize (meanvalue mean (value)) or within summarise use first. agg to convert a dataframe into a summary table, and am having trouble converting into R.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |