[R] couple of how-to-do it in R questions regarding corelations and mean and SD of likert items

faiz rasool faiz7r at gmail.com
Tue Mar 6 13:03:46 CET 2018

Dear list, I have the following how-to-do it in R, questions.

Suppose I have ten independent variables, and one dependent variable.
I want to find the Pearson correlation of all the IVs with the DV, but
not the correlation between the IVs.

What I know so far, about R, that I have to type the cor () function
ten times, each time requesting for a correlation between one IV and
the DV.

I was wondering that is there a way that I can accomplish what I want
with a single function or a fewer line of codes.

My final goal is to create a table in Microsoft word comprising of ten
rows, each row for each independent variable and its correlation with
the DV.

Based on what I know, I’ll be typing cor (IV,,DV), ten times, and then
typing the values in the table in MS  Word.

Secondly, I  would like to create a table that provides the details of
means and standard deviations, of multiple variables.

The variables are  ratings scores of  likert  type items. What I’d
like to do is to construct a table, where each row has the question,
its mean and standard deviation. I know that using the psych package,
I can have the mean of each item in the scale, but, how to develop a
table that has the item, mean, and SD on a same row? I do not know.

Thank you for reading my questions.


More information about the R-help mailing list