[R] [External] Re: Help please

Rasmus Liland jr@| @end|ng |rom po@teo@no
Thu Mar 11 15:03:05 CET 2021


Dear Areti,

this dcast data.frame presents the same 
info as Jim's barplot

	reshape2::dcast(data=scrounging, formula=behav~substr, fun.aggregate=length)

yielding

	     behav air ground tree vine
	1   active   5      4    3    3
	2 foraging   2      1    3    4
	3 inactive   0      4    4    5
	4 snoozing   3      5    1    3

I tried to use likert by the example in 
the example in ?likert::likert

	library(likert)
	data(pisaitems)
	items29 <- pisaitems[,substr(names(pisaitems), 1,5) == 'ST25Q']
	names(items29) <- c("Magazines", "Comic books", "Fiction",
	                   "Non-fiction books", "Newspapers")
	l29 <- likert(items29)
	l29
	lapply(items29, levels)

like this 

	u <- unique(scrounging$behav)
	levels.behav <- c("inactive", u[u!="inactive"])
	scrounging$behav <- factor(x=scrounging$behav, levels=levels.behav)
	u <- unique(scrounging$substr)
	levels.substr <- c("ground", u[u!="ground"])
	scrounging$substr <- factor(x=scrounging$substr, levels=levels.substr)
	likert::likert(scrounging)

yielding

	    Item inactive active foraging snoozing
	1  behav       36     20       20       24
	2 substr       20     28       30       22

but I doubt this is meaningful ... 

Best,
Rasmus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210311/5e5a412e/attachment.sig>


More information about the R-help mailing list