- Author: Genoa Starrs
R and Python together at last, the AI takeover, and Quarto ups its game.
Posit::Conf, Posit's annual conference, was held last week in Seattle, WA. While the name might be unfamiliar, many of you might recognize Posit's previous iteration, RStudio. Posit has produced many products R users know and love, including RStudio, Shiny and the Tidyverse. After a whirlwind three days, here are some takeaways from the conference!
A New All-in-One IDE
Togetherness was a key theme, with Posit rolling out the beta version of Positron, an IDE that combines elements of RStudio, VS Code, and introduces its own unique features. While switching IDEs is generally not at the top of any coder's to-do list, Positron is multilingual, enabling users to code in R, Python, and Julia within a single project. It also introduces new ways to interact with your data, such as readily available summary statistics, the ability to filter or sort data by multiple fields while retaining the active query in the window at all times, and the option to resize graphs and figures in the plots pane through a simple user interface. Positron also leverages many new and existing VS Code extensions, offering a wealth of customization and additional capabilities. Rstudio is by no means leaving the picture– Positron is still in beta, and Rstudio will continue to be supported for a good, long time. However, if you (like me) crave a unified interface for your R and Python coding, Positron may be worth trying out.
Helping R Users Learn Python
For Py-curious R coders, a session on “Python Rgonomics” suggested some packages to make the transition easier for those of us spoiled by the tidyverse.
-
Polars for exceptionally fast data wrangling and dplyr-like syntax
-
Plotnine and seaborn for ggplot-like syntax when making graphs and figures
-
Great tables for producing functional, readable tables (also available in R as the gt package).
-
Pyenv for environment management.
-
Pins (for R and Python!) publishes objects to “boards” that allows users (or multiple users) to access them across projects. Boards can include shared/networked folders, like DropBox or Google Drive.
AI for All
Melissa Van Bussel provided practical tips for using generative AI. She highlighted some new capabilities of ChatGPT 4o, including the ability to transcribe handwritten notes and tables, preserving colors and formatting. GPT can even convert these into HTML or Quarto formats.
She shared insights on prompt engineering (i.e., how you ask questions to AI engines), noting, “Writing effective prompts goes hand in hand with your existing expertise.” Achieving correct and effective output requires providing specific prompts and making corrections when errors occur. She recommended structuring prompts in a way that mirrors coding practices. For example, to generate a graph, start by specifying the data, then define how to map each axis and assign colors. Next, specify the graph or chart type and indicate any grouping by other variables. Finish with aesthetic (eg palette, theme, title, legend) preferences.
While presenters were enthusiastic about the possibilities of generative AI, a recurring theme was the necessity for users to provide clear direction and verify the results. One presenter compared AI to hiring a new human assistant—AI can assist with tasks effectively when given proper guidance but will make mistakes and requires careful supervision. Generative AI performs best when used to quickly accomplish tasks that users already have the knowledge and skills to handle themselves.
One of the most prevalent use cases for generative AI was in combination with Shiny. Joe Cheng's presentation demonstrated integrating AI into Shiny apps, specifically into Shiny dashboards. Users could request modifications to the data displayed on the dashboard using plain language, which the AI translated into SQL queries to adjust the output based on the request. This is particularly noteworthy as the AI accessed only the schema, not the actual data, to apply the filters.
Winston Chang developed an AI assistant to help people build Shiny apps and did a live demonstration. Although still experimental, Shiny for R is widely used, and the assistant showed promising outputs.
Quarto Expands its Horizons
Quarto is a relatively new version of R Markdown (a publishing tool) that allows users to knit together code into documents, dashboards, web pages, PDFs, and even eBooks. An added advantage of Quarto is its multilingual capability– it, like Positron, supports both R and Python. Some new capabilities were highlighted at the conference:
-
Dashboards: Easily build dashboards using the Quarto extension in RStudio or Positron. Each visualization (graphs, maps, tables, and even just text boxes) can be arranged like tiles or cards. Dashboards can also include sidebars and toolbars, and can support interactivity, including cards that use jupyter widgets, leaflet, and shiny.
-
PDFs: Quarto now uses typst instead of LaTeX, enabling users to create customized PDF outputs with a more intuitive language.
-
HTML (Websites): Quarto (like R Markdown) can produce HTML outputs. However, now it also supports more flexible HTML code chunks, and allows for HTML/CSS/JavaScript integration.
-
Quarto live: A quarto extension that allows users to embed code blocks and exercises for R and Python into Quarto documents. This has lots of teaching applications, and can be used to generate exercises similar to those you find in DataCamp and other online coding courses.
-
Closeread: A scrollytelling extension for quarto that enables interactive storytelling similar to that seen in fancy New York Times articles or Esri Storymaps. The gallery has some example outputs, while the guide can walk you through the process of creating your own scrollytelling page.
Finally, one of my favorite quality-of-life take homes was simply that it is possible to include emoji in your R or Python code, either using unicode or simply pasting them in. While the demonstrated use case was to make specific messages stand out in your log or printed statements, sometimes a picture can convey what 1000 characters cannot and help you enjoy coding just a little bit more.
If you love (or begrudgingly engage in) data science, I encourage you to check it out next year– virtual registration for educators and academics in 2024 was free, and hopefully will be next year too!
/h3>/h3>/h3>/h3>
- Author: Pamela S Kan-Rice
The CLEAR Center is sponsoring the first-ever Salute to Ag UC Davis football game on Saturday, Sept. 7, at UC Davis. Tailgate starts at 5 p.m. and the game kicks off at 7 p.m.
Joe Proudman,associate director for communications at the CLEAR Center, invites UC ANR members to join them. He says they have discounted tickets for the game.
If you are interested, go to goagspromo.com and enter promo code CLEAR, three different discounted ticketing options should be available:
$7 General Admission (normally $15)
$10 East Side (normally $20)
$18 West Side (normally $35)
- Author: Kendra T Rose
Dear Colleagues,
The California Cherry Board (CCB) is soliciting proposals for research found to be of highest priority by the industry and which will significantly benefit the production and post-harvest handling practices of sweet cherry in California.
Production Research Priorities:
- Pest Management with emphasis on management of spotted wing drosophila (SWD)
- New chemistry
- Timing of application
- Tree Health with emphasis on pre- and postharvest disease biology and management, soilborne and canker diseases, and orchard replant diseases with emphasis on nematode management and alternatives to fumigations.
- Variety Development
- Pruning and Tree Architecture (including mechanical pruning)
- Dormancy/Firmness
- New chemistry
- Heat Stress on Fruit Quality
Post Harvest Research Priorities:
- Marketing/Sales
- Implications of grocery store purchases on applications (i.e. pick-up) instead of in-store
- Consumer Preferences and quality including minimizing Defects, fruit quality attributes such as Brix, Acid content.
- Minimum Maturity and Grade Standards
- Crop management to match market demands
- Stem retention
- Nutrition
Applications Due: September 30, 2024
Please see the RFA for specific details: https://ucanr.edu/sites/anrstaff/files/401773.pdf
Proposal Template: https://ucanr.edu/sites/anrstaff/files/401774.docx
Thank you.
ANR Office of Contracts & Grants (OCG)
- Author: JD Trebec
Before moving to California about a decade ago, I lived in Tucson, Arizona. Although my new home in Woodland is rightfully known as the Food Front, thanks to the fertile farmland that surrounds it, Tucson also has a highly regarded relationship with food. Tucson is one of two cities in the United States recognized by the United Nations Educational, Scientific, and Cultural Organization (UNESCO) as a City of Gastronomy in recognition of its Sonoran food culture. The city is a center of regional foods that arose in northern Mexico and the Southwestern US. These run the gamut from Sonoran-style hot dogs to wild foods like cactus fruit to local varieties of squash and beans developed by the indigenous people of the border region.
One Tucson crop that I brought with me to try in the fertile soils of the Sacramento Valley is my favorite bean, the tepary. Tepary beans were domesticated by the Tohono O'odham nation of the Sonoran Desert. Tepary beans are a cultivar of Phaseolus acutifolius, a bean species well adapted to life in the desert. The bean plants have narrow teardrop-shaped leaves that turn their surface parallel to the sun's rays to reduce water loss when the sun is too intense.
Traditionally, tepary beans are planted in areas of stormwater runoff from the late summer monsoons in the Southwestern US. They need wet soils to germinate but then are extremely drought tolerant and can survive the vagaries of desert rain and the dry autumn that follows the monsoon. Too much water actually reduces the number of beans produced as more energy is put into growing foliage. The plants grow quickly and beans may be harvested in as little as two months.
The beans are small, about the size of a lentil, with a nutty taste and firm texture. Different varieties are colored brown, black, or white. They are high in protein and research has identified amino sugars specific to the species that protect the bean from heat and prevent the bean's protein from denaturing. I love the beans in my vegetarian chili, but they make a great bean dip or pot of beans as well.
I had always assumed that tepary beans were only known in the Tucson area so I was surprised when I spotted them as an ingredient in snack foods from India. While trying to discover when they were introduced to India, I found that they were once grown in California as well. A USDA pamphlet states that in 1918, California had 17,000 acres planted in tepary bean, but market forces and public preferences caused the tepary bean to fall from favor in the 1920's.
There has been some recent interest in harnessing the tepary bean's heat and drought tolerance as the world becomes warmer which has led to reduced yields in common beans that don't do as well in the heat. A 2015 NPR story describes how Colombian researchers have managed a cross of tepary and common beans that is already benefiting farmers in Central America and Africa. I'm happy to see a little respect for tepary beans, but don't understand why they aren't more widely grown as they are delicious and already adapted for a warmer future.
USDA information: https://plants.usda.gov/DocumentLibrary/plantguide/pdf/cs-pg_phac.pdf
- Author: Paula Pashby
Earlier this spring I set out to prepare my raised bed gardens to plant a variety of vegetables. I was quite pleased to find that the soil was in perfect condition for the growing season, since winter cover crops had brought valuable organic nutrients to the garden. I proceeded to plant a combination of seeds and seedlings and hoped for the best.
While kicking back to celebrate my freshly planted garden, I saw one of our kitties using the freshly prepared garden as a litter pan! What? I love seeing our cats enjoying the outdoors on occasion, but do not like the yucky notion that my veggie garden would become their digs. I shooed the cats out of the raised bed, but they'd sneak in when my back was turned.
So, my husband did some online searches for a better solution to our pet and garden protection dilemma. He found many websites on “catios”, which is a patio enclosure for cats. A catio would allow our cats the opportunity to still be outdoors but also remain safe from aggressive strays, racoons or potential predators. Plus, this would keep them from digging in my garden!
We were excited to see many differentcatio designsonline and viewed many videos by folks showing the construction of their own projects. My husband ended up building one that incorporated the features we liked from these videos. We chose a 10 x 2 feet area under the roof eaves just outside my office, so that our cats could use my window for passage into theircatio. He added an outside door for easy access to tend the area or retrieve a snoozing cat if needed. There is also removable fence panel for washing windows before it rains… it always rains when we wash the windows. All of the area is very secure.
Our cats love the new hangout area. We are very happy that they can be outdoors and remain safe, and we now have peace of mind when harvesting our garden bounty.
My next task is to do some research on plants that would be good for a catio enclosure. There are a few plants already in the space, but we would like to create a little jungle for cat play and hiding. We are especially interested in chewable attractions that are safe for consumption. Hmmm, maybe this could be a topic for my next blog.