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))