Hi Gang,
This is one way:
gangdat<-read.table(text="subject QMemotion yi
s1 75.1017 neutral -75.928276
s2 -47.3512 neutral -178.295990
s3 -68.9016 neutral -134.753906
s1 17.2099 negative -104.168312
s2 -53.1114 negative -182.373474
s3 -33.0322 negative -137.
One thing to watch out for are there always two samples (one of each type)
for each subject? You had better sort by the emotion to make sure that
when you do the difference, it is always with the data in the same
order.Here is an example of some of these cases where they are ignored:
> libra
Hi Jim and Jeff,
Thanks for the quick help!
Sorry I didn't state the question clearly: I want the difference
between 'neutral' and 'negative' for each subject. And another person
offered a solution for it:
aggregate(cbind(QM, yi) ~ subject, data = mydata, FUN = diff)
On Thu, Jul 28, 2016 at 4:
What represents the difference when multiple values are present? sd?
--
Sent from my phone. Please excuse my brevity.
On July 28, 2016 1:40:16 PM PDT, Gang Chen wrote:
>With the following data in data.frame:
>
>subject QMemotion yi
> s1 75.1017 neutral -75.928276
> s2 -47.3512
Not sure what you mean by "nice way", but here is a dplyr solution:
> library(dplyr)
> mydata <- read.table(text = "subject QMemotion yi
+s1 75.1017 neutral -75.928276
+s2 -47.3512 neutral -178.295990
+s3 -68.9016 neutral -134.753906
+s1 17.2099 negative -10
With the following data in data.frame:
subject QMemotion yi
s1 75.1017 neutral -75.928276
s2 -47.3512 neutral -178.295990
s3 -68.9016 neutral -134.753906
s1 17.2099 negative -104.168312
s2 -53.1114 negative -182.373474
s3 -33.0322 negative -137.420410
I can
6 matches
Mail list logo