Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Not a promise' error #314

Closed
davidlockhart opened this issue Mar 11, 2014 · 12 comments
Closed

'Not a promise' error #314

davidlockhart opened this issue Mar 11, 2014 · 12 comments
Assignees
Milestone

Comments

@davidlockhart
Copy link

@davidlockhart davidlockhart commented Mar 11, 2014

I have a panel dataset for which I have created lagged variables using the lag() function. When I try to calculate the delta for each timepoint, using the mutate command below, I get the error message "Error: not a promise".

> kw.lags[,c("imps", "lag1_imps", "lag2_imps")]
Source: local data frame [157,737 x 3]
Groups: 

   imps lag1_imps lag2_imps
1    65        NA        NA
2    79        65        NA
3    62        79        65
4    69        62        79
5     1        NA        NA
6     2        NA        NA
7     2         2        NA
8     1         2         2
9     2         1         2
10    5        NA        NA
..  ...       ...       ...

> kw.deltas <- mutate(kw.lags, 
+   d1_imps = imps - lag1_imps,
+   d2_imps = imps - lag2_imps
)
Error: not a promise  
@hadley
Copy link
Member

@hadley hadley commented Mar 11, 2014

Could you please send a reproducible example? i.e. by including some code to reproduce kw.lags or a tbl that illustrates the same problem.

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Mar 14, 2014

... @davidlockhart do you have a reproducible example. We can't fix this otherwise as we can't reproduce the problem.

@davidlockhart
Copy link
Author

@davidlockhart davidlockhart commented Mar 14, 2014

After reporting the issue, I implemented workarounds and was subsequently unable to repro myself. I believe I must have accidentally done something unexpected to the kw.lags object. I loaded a saved data object from the morning the error occurred, but it is working fine as well.

Sorry for the false alarm, if this or something similar happens again, I will let you know.

@hadley hadley closed this Mar 14, 2014
@davidlockhart
Copy link
Author

@davidlockhart davidlockhart commented Mar 20, 2014

I now have a reproducible example of very similar behavior to issue #314.
Attached is an RData file with an object called profile_summs that
generates the same error ("Not a promise") when I run the following:

summarise(group_by(profile_summs, impression.chg,add=FALSE),
num_keywords = sum(n),
orders = round(mean(orders,na.rm = TRUE)/n,1),
gbv = round(mean(gbv,na.rm = TRUE)/n,1),
profit = round(mean(profit,na.rm= TRUE)/n,1),
cpc = round(mean(cpc,na.rm = TRUE),2)
)

(I have added a large amount of noise to the substantive data to maintain
confidentiality of the source data, but I confirmed that the error persists
with this data object.)

Here is the code that creates
profile_grouped <- group_by(week20.dt, profilemain,add=FALSE)
profile_summs <- summarise(profile_grouped,
impression.chg = mean(pctimp),
ctr.chg = mean(pctctr),
cvr.chg = mean(pctcompcvr2),
position.chg = mean(pctposn),
n = n(),
orders = round(sum(ordersmain,na.rm = TRUE)/n,1),
gbv = round(sum(gbv,na.rm = TRUE)/n,1),
profit = round(sum(gp_tracked_usd,na.rm=
TRUE)/n,1),
cpc = round(sum(cost)/sum(clicks),2)
)

profile_summs$impression.chg <- factor(profile_summs$impression.chg,levels
= c(0,1,2), labels = c("down","stable", "up"))
profile_summs$ctr.chg <- factor(profile_summs$ctr.chg,levels = c(0,1,2),
labels = c("down","stable", "up"))
profile_summs$cvr.chg <- factor(profile_summs$cvr.chg,levels = c(0,1,2),
labels = c("down","stable", "up"))
profile_summs$position.chg <- factor(profile_summs$position.chg,levels =
c(0,1,2), labels = c("down","stable", "up"))

Let me know if I can provide further assistance.

On Fri, Mar 14, 2014 at 11:04 AM, Hadley Wickham
notifications@github.comwrote:

Closed #314 #314.

Reply to this email directly or view it on GitHubhttps://github.com//issues/314
.

@hadley hadley reopened this Mar 20, 2014
@dotcomken
Copy link

@dotcomken dotcomken commented Mar 24, 2014

I received this error today in a similar way using summarise() with v0.1.3

It was a silly mistake on my part by having an extra comma like this:

summarise(x, a=min(aa), b=min(bb),)

Removed the extra comma and it worked fine.

@davidlockhart
Copy link
Author

@davidlockhart davidlockhart commented Mar 24, 2014

Thanks, Ken. I just verified that there was such an extraneous comma in
both of the instances I've found so far, and removing it does indeed fix
the problem.

On Mon, Mar 24, 2014 at 11:28 AM, Ken Pendergast
notifications@github.comwrote:

I received this error today in a similar way using summarise()

It was a silly mistake on my part by having an extra comma like this:

summarise(x, a=min(aa), b=min(bb),)

Removed the extra comma and it worked fine.

Reply to this email directly or view it on GitHubhttps://github.com//issues/314#issuecomment-38482387
.

@romainfrancois romainfrancois self-assigned this Apr 2, 2014
@romainfrancois romainfrancois added this to the v0.2 milestone Apr 2, 2014
@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Apr 2, 2014

I fixed the issue reported by @dotcomken.
@davidlockhart I don't get the attachment, can you come up with code to reproduce this, or email it to me.

@hadley
Copy link
Member

@hadley hadley commented Apr 7, 2014

Could we just silently ignore missing arguments?

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Apr 7, 2014

Sure. I'll do that instead of throwing an error. Still no luck with reproducing @davidlockhart issue. Did you get the attachment data by any chance ?

@hadley
Copy link
Member

@hadley hadley commented Apr 7, 2014

@romainfrancois I'd say it was probably just a trailing comma that he later removed.

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Apr 7, 2014

Ok. I'll close the issue once I ignore instead of error then.

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Apr 10, 2014

Alright, slightly less trivial than I thought. What I'll do is skip the named_dots call entirely and put some more logic into DataDots: the class that handles promises and environments from ...

romainfrancois added a commit that referenced this issue Apr 15, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants