How to create a dataset that includes aggregate scales and other variables of choice

https://stackoverflow.com/questions/57023935/r-question-how-to-do-a-calculation-of-a-mean-off-multiple-columns-and-select-va/57023959#57023959

 

x2 <- transmute(mydata, circumference,
                average_2items = rowMeans(cbind(age, circumference)),
                age)

 

My example that worked.

> x2<-transmute(time1data,commonID,
+ GrowthMindset=rowMeans(cbind(q0008_0001, q0008_0002, q0008_0003, q0008_0004, q0008_0005, q0008_0006, q0008_0007, q0008_0008)),
+ SelfEfficacy=rowMeans(cbind(q0009_0001, q0009_0002, q0009_0003, q0009_0004, q0009_0005))
+ )

How to get a mean off multiple column values in R

In SAS, this would be:

newvariable=mean(of x1, x2, x3, x4);

Stockoverflow

https://stackoverflow.com/questions/57015735/how-to-get-a-mean-of-multiple-column-values-using-r-dplyr/57015890#57015890

R

Approach 1:

x2 <-subset(time1data,select=c(x1, x2, x3, x4, x5))
time1data$newvar<-rowMeans(x2,na.rm=TRUE)

Approach 2

time1data$newvar<-rowMeans(time1data[,c("q0008_0001", "q0008_0002", "q0008_0003", "q0008_0004", "q0008_0005", "q0008_0006", "q0008_0007", "q0008_0008")])

Approach 3

time1data$newvar<-rowMeans(time1data[,c("q0008_0001", "q0008_0002", "q0008_0003", "q0008_0004", "q0008_0005", "q0008_0006", "q0008_0007", "q0008_0008")],na.rm=TRUE)

How to listen from the laptop base

Choose speakers/headphones properties by clicking on the speaker icon on the right-bottom corner of the screen.

You get a window that says "Speakers/Headphones Properties" at the top.

Click around.  Somehow you get back the ability to listen to sound via. the laptop base.

Rasch model -- winstep file examples

&INST
Title= "Student scales"
ITEM1 = 25 ; Starting column of item responses
NI = 9 ; Number of items
NAME1 = 1 ; Starting column for person label in data record
NAMLEN = 15 ; Length of person label
XWIDE = 1 ; Matches the widest data value observed
; GROUPS = 0 ; Partial Credit model: in case items have different rating scales
CODES = 1234; matches the data
TOTALSCORE = Yes ; Include extreme responses in reported scores
PFILE=personfile.txt
IFILE=itemfile.txt
; Person Label variables: columns in label: columns in line
&END

<DATA HERE>

 

ANCHORING ITEM PARAMETERS

&INST
Title= "Student scales"
ITEM1 = 34 ; Starting column of item responses
NI = 9 ; Number of items
NAME1 = 1 ; Starting column for person label in data record
NAMLEN = 15 ; Length of person label
XWIDE = 1 ; Matches the widest data value observed
; GROUPS = 0 ; Partial Credit model: in case items have different rating scales
CODES = 1234; matches the data
TOTALSCORE = Yes ; Include extreme responses in reported scores
IAFILE=*
1 .44
2 -1.05
3 2.04
4 .48
5 -.12
6 .32
7 -.98
8 -.57
9 -.56
*
PFILE=personfile_post.txt
IFILE=itemfile_post.txt
; Person Label variables: columns in label: columns in line
&END

<DATA HERE>

 

My R function didn't work

ネットを参考にやってみました。

これがマクロでないもの。

time1data$teacher[time1data$CollectorNm=="Web Link 7"]<-"Smith"

 

FUNCTIONというのをつかえばいいかなと思ってやってみましたが、ダメでした、、。

kaz <- function(teachername,weblink){

time1data$teacher[time1data$CollectorNm==weblink]<-teachername

}

kaz("Smith","Web Link 7")

kaz("Adams","Web Link 8")