From 1a259b6b89d6ee82a30dfff49147f335a4a545da Mon Sep 17 00:00:00 2001 From: corentinchoisy Date: Mon, 26 May 2025 14:59:04 +0200 Subject: [PATCH] Added option in select_weight --- R/pcm.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/pcm.R b/R/pcm.R index 3352fa3..2f184a6 100644 --- a/R/pcm.R +++ b/R/pcm.R @@ -69,7 +69,7 @@ pcm <- function(df=NULL,items=NULL,grp=NULL,dif.items=NULL,type.dif=NULL,weights if (is.null(weights)) { df <- df[,c('id',items)] } else { - df <- df[,c('id',items,"weights")] + df <- df[,c('id',items,weights)] } print(df) colnames(df)[2:(length(colnames(df)))] <- paste0("item",seq(1,length(colnames(df))-1)) @@ -115,7 +115,7 @@ pcm <- function(df=NULL,items=NULL,grp=NULL,dif.items=NULL,type.dif=NULL,weights if (is.null(weights)) { df <- df[,c('id',items,"grp")] } else { - df <- df[,c('id',items,"grp","weights")] + df <- df[,c('id',items,"grp",weights)] } colnames(df)[2:(length(colnames(df))-1)] <- paste0("item",seq(1,length(colnames(df))-2)) df.long <- reshape(df,v.names=c("item"),direction="long",varying=c(items)) @@ -208,7 +208,7 @@ pcm <- function(df=NULL,items=NULL,grp=NULL,dif.items=NULL,type.dif=NULL,weights if (is.null(weights)) { df <- df[,c('id',items,"grp")] } else { - df <- df[,c('id',items,"grp","weights")] + df <- df[,c('id',items,"grp",weights)] } colnames(df)[2:(length(colnames(df))-1)] <- paste0("item",seq(1,length(colnames(df))-2)) df.long <- reshape(df,v.names=c("item"),direction="long",varying=c(items))