business-science / free_r_tips Goto Github PK
View Code? Open in Web Editor NEWFree R-Tips is a FREE Newsletter provided by Business Science. It comes with bite-sized code tutorials every week.
Free R-Tips is a FREE Newsletter provided by Business Science. It comes with bite-sized code tutorials every week.
mpg dataset does not exist.
You probably intended to do data("mtcars"). Similarly down below in the ui & server section.
The R code does not work. The function is not available in the library.
dplyr::across does not take a vector of c(mean, median) as a value to the .fns argument. Instead a list list(mean, median) is required.
Found this by coincidence, so other skripts might need some adaption as well.
Greetings
Felix
It seems the parametrization for model_prophet has changed to:
model_prophet <- prophet_reg() %>%
set_engine("prophet",yearly.seasonality=TRUE) %>%
fit(cnt ~ dteday, training(splits))
FROM:
model_prophet <- prophet_reg(
seasonality_yearly = TRUE
) %>%
set_engine("prophet") %>%
fit(cnt ~ dteday, training(splits))
vehicle_summary_tbl <- mpg %>%
select(class, where(is_numeric), -year) %>%
group_by(class) %>%
summarise(
across(displ:hwy, .fns = median)
) %>%
ungroup() %>%
rename(group = class) %>%
mutate_at(vars(-group), rescale)
Error in is_fun_list(.funs) : object 'rescale' not found
In addition: There were 11 warnings (use warnings() to see them)
warnings()
Warning messages:
1: Deprecated
2: Deprecated
3: Deprecated
4: Deprecated
5: Deprecated
6: Deprecated
7: Deprecated
8: Deprecated
9: Deprecated
10: Deprecated
11: Deprecated
There's an error when i run the script...
> # ggplot (2D visualization) - DS4B 101-R, Week 4
> g1 <- mtcars %>%
+ ggplot(aes(disp, mpg, color = cyl)) +
+ geom_point(size=2) +
+ scale_color_continuous(limits=c(0,8)) +
+ ggtitle("mtcars: Displacement vs mpg vs # of cylinders") +
+ theme(title = element_text(size=8),
+ text = element_text(size=12))
> # rayshader
> g1 %>%
+ plot_gg(
+ height = 3,
+ width = 3.5,
+ multicore = TRUE,
+ pointcontract = 0.7,
+ soliddepth = -200
+ )
Error in hillshade[, , 1] * scales::rescale(shadowmap, c(max_darken, 1)) :
non-conformable arrays
> g1 %>%
+ plot_gg(
+ height = 3,
+ width = 3.5,
+ multicore = TRUE,
+ pointcontract = 0.7,
+ soliddepth = -200
+ )
Error in hillshade[, , 1] * scales::rescale(shadowmap, c(max_darken, 1)) :
non-conformable arrays
> # 3D ELEVATION MATRIX ----
> volcano
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 100 100 101 101 101 101 101 100
[2,] 101 101 102 102 102 102 102 101
[...]
> volcano %>% class()
[1] "matrix" "array"
> # dplyr (data wrangling) - DS4B 101-R, Weeks 2&3
> volcano_tbl <- volcano %>%
+ as_tibble(.name_repair = "minimal") %>%
+ set_names(str_c("V", seq_along(names(.)))) %>%
+ rowid_to_column(var = "x") %>%
+ pivot_longer(
+ cols = contains("V"),
+ names_to = "y",
+ values_to = "value"
+ ) %>%
+ mutate(y = str_remove(y, "^V") %>% as.numeric())
> # ggplot (visualization) - DS4B 101-R, Week 4
> g2 <- volcano_tbl %>%
+ ggplot(aes(x = x, y = y, fill = value)) +
+ geom_tile() +
+ geom_contour(aes(z = value), color = "black") +
+ scale_x_continuous("X", expand = c(0,0)) +
+ scale_y_continuous("Y",expand = c(0,0)) +
+ scale_fill_gradientn("Z", colours = terrain.colors(10)) +
+ coord_fixed()
> g2 %>%
+ plot_gg(
+ multicore = TRUE,
+ raytrace = TRUE,
+ width = 7,
+ height = 4,
+ scale = 300,
+ windowsize = c(1400, 866),
+ zoom = 0.6,
+ phi = 30,
+ theta = 30
+ )
Error in hillshade[, , 1] * scales::rescale(shadowmap, c(max_darken, 1)) :
non-conformable arrays
In addition: Warning messages:
1: The following aesthetics were dropped during
statistical transformation: fill
ℹ This can happen when ggplot fails to infer the
correct grouping structure in the data.
ℹ Did you forget to specify a `group` aesthetic
or to convert a numerical variable into a
factor?
2: The following aesthetics were dropped during
statistical transformation: fill
ℹ This can happen when ggplot fails to infer the
correct grouping structure in the data.
ℹ Did you forget to specify a `group` aesthetic
or to convert a numerical variable into a
factor?
3: Removed 1861 rows containing missing values
(`geom_contour()`).
I don't know where to start to look for. Thanks for the help
Prepare the repo for poetry package-like structure.
Set up poetry and organize doc structure.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.