I know that certain functions are possible to use only when library is loaded.
For example to use raster function from raster package I need to:
library(raster)
raster("msi1986.img") #see the summary of img.file in working directory
Or...
I can indicate the library without loading it (by using name of library::function)
raster::raster("msi1986.img")
Both ways produce the same results.
My problem is that I can not use name of library::function for dplyr package.
Part of my script looks like this:
# rescaling table via "dplyr"
library(dplyr)
my.df.R = betw_frame %>%
group_by(id) %>% # group by id
mutate(value = value - min(value), value = value - lag(value)) %>% # group min to 0, difference lag 1
na.omit %>% # remove NA caused by lag 1 differencing
arrange(id, value) %>% # order by value within each id
mutate(time = 1:length(value)) %>% # Make a time variable from 1 to 5 based on current order
select(-year) # remove year column to match final OP output
I tried this but it is not working.
my.df.R = betw_frame dplyr::%>%
group_by(id) dplyr::%>% # group by id
mutate(value = value - min(value), value = value - lag(value)) dplyr::%>% # group min to 0, difference lag 1
na.omit dplyr::%>% # remove NA caused by lag 1 differencing
arrange(id, value) dplyr::%>% # order by value within each id
mutate(time = 1:length(value)) dplyr::%>% # Make a time variable from 1 to 5 based on current order
select(-year) # remove year column to match final OP output
Is there a way how to indicate library other than dplyr::%>% ?
Reproducible example can be found in my previous question and answer by @aosmith here.