1

Here is my dataset:

   record_id voucher_number ice   sets 
       <int> <chr>          <chr> <chr>
 1         1 app1           app   app  
 2         1 00000          1     1    
 3         1 11111          1     2    
 4         1 22222          1     3    
 5         1 11111          2     4    
 6         2 app2           app   app  
 7         2 33333          1     1    
 8         2 44444          1     2    
 9         2 33333          2     3    
10         2 33333          3     4    
11         3 app3           app   app  
12         3 55555          1     1    
13         3 66666          1     2    
14         3 55555          2     3    
15         3 66666          2     4    
16         3 55555          3     5    
17         3 77777          1     6 

I am trying to create another variable column to represent different combinations of record_id and voucher_number in set. When I use the following snippet of code


 dplyr::group_by(
   record_id,
   voucher_number
 ) %>%
 dplyr::mutate(
   instrument      = row_number(),
   instrument      = replace(instrument, is.na(voucher_number), "application"),
   voucher_sets    = cur_group_id()
 )
    

I am getting the following error:

Error in cur_group_id() : could not find function "cur_group_id"

Any idea what may be going on wrong here. Also the posted dataset is not the true dataset I am working with.

wibeasley
  • 5,000
  • 3
  • 34
  • 62
  • 2
    Check your `dplyr` version! – Duck Oct 16 '20 at 00:17
  • `cur_group_id` was added in `dplyr` version 1.0. Make sure you are using at least that version. – MrFlick Oct 16 '20 at 01:08
  • Does this answer your question? [Error: could not find function ... in R](https://stackoverflow.com/questions/7027288/error-could-not-find-function-in-r) – camille Oct 16 '20 at 02:15
  • I have updated the package version so this should not be a problem any longer and like I have explained in another issue, cur_group_id is not recognizing the grouping levels. Thanks – Maleeha Shahid Oct 16 '20 at 02:18

0 Answers0