Displaying 20 results from an estimated 7000 matches similar to: "Nested loop R code"
2017 Sep 04
1
Dataframe Manipulation
Hello Ulrik,
Can you please explain this code means how and what this code is doing
because I'm not able to understand it, if you can explain it i can use it
in future by doing some Lil bit manipulation.
Thanks
data_help <-
data_help %>%
mutate(Purchase_ID = 1:n()) %>%
group_by(Purchase_ID) %>%
do(split_items(.))
cat_help %>% gather("Foo",
2017 Aug 31
0
Dataframe Manipulation
Hi Hemant,
the solution is really quite similar, and the logic is identical:
library(readr)
library(dplyr)
library(stringr)
library(tidyr)
data_help <- read_csv("data_help.csv")
cat_help <- read_csv("cat_help.csv")
# Helper function to split the Items and create a data_frame
split_items <- function(items){
x <- items$Items_purchased_on_Receipts %>%
2017 Sep 08
1
nested loop
i have a vector containing values ranging from 0 to 24
i want to create another variable which can categorize those values like
this
please help me with an R code
Thanks
*Value New_Var*1 0 -5
3 0 -5
5 0 -5
9 6-10
7 6-10
5 6-10
4 0-5
11 11-15
12 11-15
18 16-20
23 21 -25
--
2017 Aug 30
1
Dataframe Manipulation
by using these two tables we have to create third table in this format
where categories will be on the top and transaction will be in the rows,
On 30 August 2017 at 16:42, Hemant Sain <hemantsain55 at gmail.com> wrote:
> Hello Ulrik,
> Can you please once check this code again on the following data set
> because it doesn't giving same output to me due to absence of quantity,a
2017 Oct 10
0
Help RFM analysis in R (i want a code where i can define my own breaks instead of system defined breaks used in auto_RFM package)
Hello Jim,
i have converted all my variable data type according to your attached
example including date, and my dataset looks like this.
ID purchase date
1234 10.2 2017-02-18
3453 18.9 2017-03-22
7689 8 2017-03-24
but when I'm passing the data
2017 Oct 11
0
RFM analysis
Hi Hemant,
Let's take it one step at a time. Save this code as "qdrfm.R" in your
R working directory: It includes the comments I added last time and
fixes a bug in the recency scoring.
qdrfm<-function(x,rbreaks=3,fbreaks=3,mbreaks=3,
date.format="%Y-%m-%d",weights=c(1,1,1),finish=NA) {
# if no finish date is specified, use current date
if(is.na(finish))
2017 Oct 23
1
How to define proper breaks in RFM analysis
hello,
I'm confused what you guys are talking about.
i just want to set ideal threshold values for my RFM scores which can be
done using Quantiles but i don't want to use quantiles because my data is
not normally distributed so it will lead to wrong ranges of breaks. to fix
this problem I'm looking for an approach which can define the ideal range
to breaks to categorize RFM scores into
2017 Oct 09
2
Help RFM analysis in R (i want a code where i can define my own breaks instead of system defined breaks used in auto_RFM package)
I seriously doubt that you are running the code I sent. What you have
probably done is to run your data, which has a different date format,
without changing the breaks or the date format arguments. As you
haven't provided any example that shows what you are doing, I can't
guess what the problem is.
Jim
On Mon, Oct 9, 2017 at 9:40 PM, Hemant Sain <hemantsain55 at gmail.com> wrote:
2017 Oct 05
0
RFM Analysis Help
Hi Hemant,
As I suspected, the code broke when I got to the line:
result <- rfm_auto(df, id="user_id", payment ="subtotal_amount",
date="created_at")
Error in rfm_auto(df, id = "user_id", payment = "subtotal_amount", date = "cr
eated_at") :
could not find function "rfm_auto"
It looks like you are using the hoxo-m/easyRFM
2017 Oct 13
0
How to define proper breaks in RFM analysis
Hemant's problem is that the indicators are not distributed uniformly.
With a uniform distribution, categorization gives a reasonably optimal
separation of cases. One approach would be to drop categorization and
calculate the overall score as the mean of the standardized indicator
scores. Whether this is an option I do not know. I did offer an
"eyeball" set of breaks in a previous
2017 Oct 13
2
How to define proper breaks in RFM analysis
> On Oct 13, 2017, at 2:51 AM, PIKAL Petr <petr.pikal at precheza.cz> wrote:
>
> Hi
>
> You expect us to solve your problem but you ignore advice already recieved.
>
> Your data are unreadable, use dput(yourdata) instead. see ?dput
>
>> test<-read.table("clipboard", heade=T)
> Error in scan(file = file, what = what, sep = sep, quote = quote,
2017 Aug 30
3
Dataframe Manipulation
Hey PIKAL,
It's not a homework neithe that is the real dataset i have signer NDA for
my company so that i can share the original data file, Actually I'm working
on a market basket analysis task but not able to convert my existing data
table to appropriate format so that i can apply Apriori algorithm using R,
and this is very important me to get it done because I'm an intern and if i
2017 Oct 04
3
RFM Analysis Help
I'm trying to perform a RFM analysis on attached dataset,
i'm able to get the results using the auto_rfm function but i want to
define my own breaks for RFM,
when i tried to define my own breaks i got the identical result i.e 111 for
every ID.
please help me with this with working R script.
Thanks
hemantsain.com
2017 Oct 13
0
How to define proper breaks in RFM analysis
Hi
You expect us to solve your problem but you ignore advice already recieved.
Your data are unreadable, use dput(yourdata) instead. see ?dput
> test<-read.table("clipboard", heade=T)
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 115 did not have 6 elements
What is ?ideal interval? can you define it? Should it be such to provide eqal
2017 Oct 09
0
Help RFM analysis in R (i want a code where i can define my own breaks instead of system defined breaks used in auto_RFM package)
I'm getting all the rows as NA in Cscore and almost most of the
observation in R and F and M are also NA.
what can be the reason for this. also suggest me the appropriate solution.
On 9 October 2017 at 15:51, Jim Lemon <drjimlemon at gmail.com> wrote:
> Hi Hemant,
> Here is an example that might answer your questions. Please don't run
> previous code as it might not work.
2017 Aug 30
0
Dataframe Manipulation
Hi
It seems to me like homework, there is no homework policy on this help list.
What do you want to do with your table 3? It seems to me futile.
Anyway, some combination of melt, merge, cast and regular expressions could be employed in such task, but it could be rather tricky.
But be aware that
Suger does not match sugar (I wonder that sugar is dairy product)
and you mix uppercase and
2017 Oct 09
1
Help RFM analysis in R (i want a code where i can define my own breaks instead of system defined breaks used in auto_RFM package)
Hi Hemant,
Here is an example that might answer your questions. Please don't run
previous code as it might not work.
I define the break values as arguments to the function
(rbreaks,fbreaks,mbreaks) If you want the breaks to work, make sure that
they cover the range of the input values, otherwise you get NAs.
# expects a three (or more) column data frame where
# column 1 is customer ID,
2017 Oct 13
2
How to define proper breaks in RFM analysis
Hey,
i want to define 3 ideal breaks (bin) for each variable one of those
variables is attached in the previous email,
i don't want to consider quartile method because quartile is not working
ideally for that data set because data distribution is non normal.
so i want you to suggest another method so that i can define 3 breaks with
the ideal interval for Recency, frequency and monetary to
2018 Jan 28
1
Newbie wants to compare 2 huge RDSs row by row.
Thanks, I think I've found the most succinct expression of differences in two data.frames...
length(which( rowSums( x1 != x2 ) > 0))
gives a count of the # of records in two data.frames that do not match.
//
________________________________________
From: Henrik Bengtsson [henrik.bengtsson at gmail.com]
Sent: Sunday, January 28, 2018 11:12 AM
To: Ulrik Stervbo
Cc: Marsh Hardy ARA/RISK;
2018 Jan 28
0
Newbie wants to compare 2 huge RDSs row by row.
The diffobj package (https://cran.r-project.org/package=diffobj) is
really helpful here. It provides "diff" functions diffPrint(),
diffStr(), and diffChr() to compare two object 'x' and 'y' and provide
neat colorized summary output.
Example:
> iris2 <- iris
> iris2[122:125,4] <- iris2[122:125,4] + 0.1
> diffobj::diffPrint(iris2, iris)
< iris2
>