[R] Dput Help in R

SHIVI BHATIA shivi.bhatia at safexpress.com
Wed Dec 30 11:56:26 CET 2015


Dear Team, 

 

I am facing an error while performing a manipulation using a dplyr package.
In the code below, I am using mutate to build a new calculated column:

 

kp<-read.csv("collection_last.csv",header=TRUE)

mutate(kp,dif=DOC_AMOUNT-RECEIPT_AMT+TDS_AMT+REBATE)

 

However it gives an error:-

Warning messages:

1: In Ops.factor(c(28831L, 28831L, 17504L, 4184L, 36187L, 25819L, 699L,  :

  '-' not meaningful for factors

2: In Ops.factor(c(28831L, 28831L, 17504L, 4184L, 36187L, 25819L, 699L,  :

  '+' not meaningful for factors

3: In Ops.factor(c(28831L, 28831L, 17504L, 4184L, 36187L, 25819L, 699L,  :

  '+' not meaningful for factors

 

This is an error when some of my variables are factors hence I have tried to
change these to numeric so used the expression as:

kp$DOC_TYPE=as.numeric(kp$DOC_TYPE). 

 

this now shows as variable type of as "double". So expedite help on this one
i was trying to create a reproducible example and i am highly struggling to 

create one. the data i have is approx. around 1 million rows with 21 columns
hence when i use a dput option it does not capture the entire detailing and
row level info required to share and even dput(head(kp$DOC_TYPE) does not
help either. 

I have seen many stack overflow & r help column before composing this email.
Hence i need help to create this reproducible example to share with the
experts in the community. Apologies if this is a repeat.

 

PLEASE HELP AS I AM HIGHLY STRUGGLING TO BUILD ANY OUTCOME. 

Regards, Shivi

 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20151230/77760eee/attachment.pl>


More information about the R-help mailing list