Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

R package psych two means in one variable after combining

$
0
0

I'm currently analysing data for a student project. During the analysis, I combined two variables into one with cbind():

interpas$GA02_01 <- cbind(interpas$LP02_01, interpas$ST02_01)

The two variables LP02_01 and ST02_01 are measuring the same questions but for different media-formats. There's no overlapping between the two. The structure is like this:

LP02_01 ST02_01
1        NA
NA       2
NA       5
4        NA

So they just get combined. When I calculate the mean with the built-in mean() function from R, I get the mean of the new variable GA02_01.

But when I'um using the mean function of the package psych, or any other function for descriptive statistics (like describe) from this package, it's calculating the two variables LP02_01 and ST02_01 still seperately. Like this:

> describe(interpas$GA02_01)
   vars   n mean   sd median trimmed  mad min max range skew kurtosis   se
X1    1 151 3.62 1.89      4    3.59 1.48   1   7     6 0.00    -1.24 0.15
X2    2  63 2.70 1.92      2    2.45 1.48   1   7     6 0.85    -0.64 0.24

Does anyone know a solution to this? Unfortunately, I need the descriptive functions skew and kurtosi from the psych package for further analysis and a function to check for normal distribution.

Thanks a lot!


Viewing all articles
Browse latest Browse all 201839

Trending Articles



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