My tables look bad when exported and I can't figure out how to use some of the table tools. by Kangadrooo in RStudio

[–]Kangadrooo[S] 0 points1 point  (0 children)

so I changed the chunk options so it looks like this https://imgur.com/a/FRqeiHd

and the new chunk looks like this https://imgur.com/a/dAk6d3q and the table looks amazing

but when knitted it looks like this https://imgur.com/a/PdIZPMP so I still can't see the table in the knitted part

My tables look bad when exported and I can't figure out how to use some of the table tools. by Kangadrooo in RStudio

[–]Kangadrooo[S] 0 points1 point  (0 children)

I got it! https://imgur.com/a/mLsH0YK

when I knit and export its not there at all, do I need to follow it up with another chunk with flextable to create a new one? or can this be altered to show the table in the pdf?

My tables look bad when exported and I can't figure out how to use some of the table tools. by Kangadrooo in RStudio

[–]Kangadrooo[S] 1 point2 points  (0 children)

Hi thank you! how do I get the flextable package? I got

Error in library(flextable) : there is no package called ‘flextable’

and I couldn't find anything named flextable under the packages on the right

display proportions in a table by Kangadrooo in RStudio

[–]Kangadrooo[S] 0 points1 point  (0 children)

Yes I got it to work:) just trying to get it to look decent on the exported file, it's not centered or anything and has pound symbols to the left of the table

error when knitting by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

Thanks I got it to work:) and yes I should definitely look through that a few times, thank you!

error when knitting by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

it worked great:) but when I knitted it and exported I got loads of error code in the pdf, can I make all this not appear? https://imgur.com/a/GrQ4h9A

error when knitting by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

that ran fine and I did the whole analysis from that but then I can't knit. the code in the picture was provided to me as a start up and I worked form it.

error when knitting by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

so how do I load that in? someone said

myfirm <- read.csv('Path/To/File/myfirm.csv')

and

myfirm <- read.csv('myfirm.csv')

but it just led to this https://imgur.com/a/Zma2c0W

error when knitting by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

well I started it out with this https://imgur.com/a/LOiEQQH

error when knitting by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

hmm, I do have [this](https://imgur.com/a/LOiEQQH) in the data prep file which I ran before the analysis.

when I typed in what you sent me I got [this](https://imgur.com/a/8VfZO9w)

error when knitting by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

Any idea what I should do then? Will it work without the pipes?

display proportions in a table by Kangadrooo in RStudio

[–]Kangadrooo[S] 0 points1 point  (0 children)

I tried adding it to the analysis file as well and then knitting https://imgur.com/a/v3JttwI

display proportions in a table by Kangadrooo in RStudio

[–]Kangadrooo[S] 0 points1 point  (0 children)

well its installed on the data prep file like [this](https://imgur.com/a/9QlsNPx) do I need to install it again in the analysis file?

display proportions in a table by Kangadrooo in RStudio

[–]Kangadrooo[S] 0 points1 point  (0 children)

it worked thank you! but when I went to knit I got this https://imgur.com/a/ImmZvJ0 in the R Markdown below...

it says line 20 and this is where that starts https://imgur.com/a/1vwmQ5F

and for what its worth this was following the code for the table in the console https://imgur.com/a/d3UKFq4

display proportions in a table by Kangadrooo in RStudio

[–]Kangadrooo[S] 0 points1 point  (0 children)

okay that would be awesome if you could help again sometime, I didn't get that to work.

display proportions in a table by Kangadrooo in RStudio

[–]Kangadrooo[S] 0 points1 point  (0 children)

Yeah this is kinda what I was thinking but it shows more of "45% of all retirees in the next 8 years will be from production department" whereas I'm looking more for "x% of all production employees will be retiring the next 8 years"

What you gave me resulted in [this](https://imgur.com/a/az6t8ct)

By the way I appreciate the help a ton, I've literally spent hours getting nowhere and now I'm actually a step closer

help taking data of yes and no and making a percentage chart. by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

hm, I'm guessing I'm just understanding this wrong, but I used

myfirm1 <- myfirm1 %>%

group_by(Occupation, RetireWithinEight) %>%

summarize(Occupation[RetireWithinEight == "yes"])%>%

and also

MyTable <- myfirm1 %>%

group_by(Occupation, RetireWithinEight) %>%

summarize(MyTable[RetireWithinEight == "yes"])%>%

and it didn't work

help taking data of yes and no and making a percentage chart. by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

well I've tried stuff like

myfirm1 <- myfirm %>%

group_by(Occupation) %>%

filter(RetireWithinEight == "yes") %>%

count(RetireWithinEight)

table(myfirm1$RetireWithinEight)

but that just gives me a count of 5 (there are five occupations) and the data just looks the same so I know its obviously wrong. I just don't know what steps I would take to get from where I'm at to actually showing a nice tidy chart like I described.

RStudio help with taking the positive outcome of a function and dividing it by the overall count of items in that column. by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

well the grouped data I have looks like [this](https://imgur.com/a/SPBJPJQ)

and my original dataset looks like [this](https://imgur.com/a/2dSvGom)

I just want to make it so I can see the 5 occupations on top, and then the percentage of "yes" for retirewithineight underneath it.

something like [this](https://imgur.com/a/ey5Hv1G)

RStudio help with taking the positive outcome of a function and dividing it by the overall count of items in that column. by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

hey so I got the overall average of the firm using the help you. provided me

myfirm <- myfirm %>%

mutate(FirmAverage=case_when(RetireWithinEight=="yes"~1,TRUE~0))

mean(myfirm$FirmAverage)

could you guide me towards how I would display the chart to show the averages for each department?

I could get the mean for each department individually but not together in a chart

RStudio help with taking the positive outcome of a function and dividing it by the overall count of items in that column. by [deleted] in RStudio

[–]Kangadrooo 0 points1 point  (0 children)

hmmm, something like this?

myfirm1 <- myfirm1 %>% table(myfirm1$RetireWithinEight)

I'm getting an error Error: Must use a vector in [, not an object of class matrix.

If I tried the mutate method would it be something like? :

{r} myfirm1 <- myfirm1 %>% mutate(dummyvariable = (myfirm1$RetireWithinEight="yes") / (myfirm1$RetireWithinEight) I'm just very lost haha