tm575
tm575

Reputation: 1

How to get these percentages out in a table like the example shown?

I'm trying to respecify an existing journal for a university assignment which tasks us with replicating the descriptive tables and regressions as similarly to that journal as possible.

My first task is cleaning the data which I've done by removing missing values with this code:

#Feeling under strain
d$bghqe[d$bghqe < 1] <- NA

#Losing confidence
d$bghqj[d$bghqj < 1] <- NA

#Thinking of being a worthless person
d$bghqk[d$bghqk < 1] <- NA

#Been less able to enjoy day-to-day activities
d$bghqg[d$bghqg < 1] <- NA

#Been less able to face up to problems
d$bghqh[d$bghqh < 1] <- NA

#Feeling less happy
d$bghql[d$bghql < 1] <- NA

kable(summary(d[,c("bghqe", "bghqj", "bghqk","bghqg","bghqh","bghql")]))

While this doesn't return the exact mean values I need but does get pretty close and I'm planning to do a full na.omit clean on all the variables I need at the end of the cleaning process which will hopefully get the values even closer.

What I need now is to be able to get the percentages which are shown in the rest of the table. Ideally shown as similarly to the table as it is but it isn't a big deal if they're in a different visualisation as long as I can show I got the information out and presented it nicely.

Does anyone have any insight into how to do this?

Table I'm trying to replicate

I've tried using round(100*prop.table code to generate percentages but haven't gotten what I needed because I'm sure I'm not being specific enough but I'm not sure what code to use to help that.

Upvotes: 0

Views: 29

Answers (0)

Related Questions