1 + 1
[1] 2
My first assignment has two parts.
In this short video, the process of deploying a Shiny for Python application from Posit Workbench is explained. The narrator is using VS Code for Posit Connect. They have a Shiny for Python application named “app.py” in their directory.
To get started, they mention that you need to install some packages for this workflow. They use pip to install the Shiny package and rsconnect-python for deploying the applications. Additionally, they mention that the application depends on two popular data science packages, matplotlib and numpy, and ensure that these packages are installed.
Before deploying, they emphasize the importance of making sure the application works correctly locally. They run the Shiny application and obtain a URL, which leads to their Shiny for Python application. The application includes a simple slider that changes the number of boxes in a histogram as you slide it.
The final step is deploying the application to Posit Connect using the rsconnect package. They specify the Connect server’s name using the -n argument and provide the directory containing “app.py.” The deployment process involves capturing and saving the environment, then sending it to Connect for deployment. After the deployment is complete, they receive two URLs, with one taking them directly to Posit Connect, where they can see the application running in a Connect instance.
In summary, the video demonstrates how to deploy a Shiny for Python application using Posit Connect, from package installation to local testing and final deployment on Posit Connect.
Example in R:
data <- c(1, 2, 3, 4, 5) squared_data <- lapply(data, function(x) x^2)
Example in Python:
data = [1, 2, 3, 4, 5] squared_data = [x**2 for x in data]
Example in R:
df <- data.frame(Name = c(“Alice”, “Bob”, “Charlie”), Age = c(25, 30, 35))
Example in Python:
data = [{“Name”: “Alice”, “Age”: 25}, {“Name”: “Bob”, “Age”: 30}, {“Name”: “Charlie”, “Age”: 35}]
Example in R:
library(dplyr) filtered_data <- df %>% filter(Age > 30)
Example in Python:
import pandas as pd df = pd.DataFrame(data) filtered_data = df[df[‘Age’] > 30]