Quantcast
Channel: Active questions tagged kable - Stack Overflow
Viewing all articles
Browse latest Browse all 105

Kable Ignoring Ordered Factor [closed]

$
0
0

I have created an ordered factor within a dataframe, as shown below:

med_ttest_tbl2$injury_prepost <- factor(med_ttest_tbl2$injury_prepost, levels=desired_order)

Wheredesired_order <- c("Pre","Post")

The intent was to switch the order of "Pre" and "Post" in this column. When I run levels() to confirm the ordering, it appears to run properly:

levels(med_ttest_tbl2$injury_prepost)Gives the output:[1] "Pre" "Post"

I then included this table in my RMD file, which I'm using to create an HTML output, using the following code in RMD:

kable(med_ttest_tbl2, "html") %>% kable_styling("striped", full_width = F)

The order is then switched back to what it was before that ordered factor was introduced. Is this an issue with table()? kable()? Something else? Here's the final output:enter image description here

Thanks in advance!


Viewing all articles
Browse latest Browse all 105

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>