library(shiny)
ui <- fluidPage(
titlePanel("Linear model DARP"),
sidebarLayout(
sidebarPanel(
sliderInput(inputId = "area",
"select the service region area:",
min= 170,
max= 8000,
value=1001),
sliderInput(inputId = "crit..peak",
label="Choose Peak demand:",
min=10,
max=150,
value=39)
),
mainPanel(
tableOutput("table")
)
)
)
server <- function(input, output) {
output$table <- renderTable({
df_ln<-read.csv("F:/Project/Programme/ML/DAR Machine Learning TR Part A/train_darp_ln.csv")
Linearmodel_DARP<-lm(veh~area+crit..peak,data = df_ln)
new_demand1<-data.frame(area=input$area)
new_demand2<-data.frame(crit..peak=input$crit..peak
fleetsize<-predict(Linearmodel_DARP,newdata=c(new_demand1,new_demand2))
round(exp(fleetsize),0)
})
}
shinyApp(ui = ui, server = server)
I am getting error object crit..peak is not found when running the app
The app should take two inputs from the user through the slider and based on the multiple regression it will give a prediction of the predict command
please help as I need to do it soon for a project
structure(list(area = c(2217.7, 6537.4, 1705.5, 5634, 1260.5,
4797.7), density = c(0.13753, 0.016826, 0.18469, 0.021477, 0.25862,
0.027305), crit..CV = c(0.63954, 0.81437, 0.49909, 0.33935, 0.39148,
0.17489), crit..peak = c(49L, 26L, 41L, 20L, 39L, 18L), TW = c(21L,
47L, 54L, 48L, 17L, 41L), L = c(569L, 576L, 391L, 390L, 458L,
392L), s = c(7L, 3L, 3L, 6L, 3L, 2L), speed = c(18L, 26L, 20L,
30L, 24L, 33L), circuity = c(1.3284, 1.1494, 1.4597, 1.2725,
1.0486, 1.0792), cap = c(9L, 9L, 5L, 8L, 5L, 7L), mrt = c(1.5452,
2.3743, 1.5962, 2.6065, 2.1278, 2.6228), veh = c(4.605170186,
3.433987204, 4.718498871, 3.951243719, 4.060443011, 3.526360525
), veh.hrs = c(6.665569062, 5.523778231, 6.496186582, 5.71857256,
5.816843267, 5.256713817), veh.km = c(9.555940819, 8.781874769,
9.491918855, 9.119769942, 8.994897097, 8.753221378)), .Names = c("area",
"density", "crit..CV", "crit..peak", "TW", "L", "s", "speed",
"circuity", "cap", "mrt", "veh", "veh.hrs", "veh.km"), row.names = c(NA,
6L), class = "data.frame")
Ok, so your problem is probably due to the way you try to make your new data frame. You made two separate 1 dimensional data frames and then concatenated them, which generated a list of dataframes. To make a data frame with two or more variables, define them in your data frame definition or use cbind to join the data frames together:
new_demand <- data.frame(area = input$area,
crit..peak = input$crit..peak)
fleetsize <- predict(Linearmodel_DARP, newdata = new_demand)
This should solve your problem. In the future, when you get errors like error object ... is not found, the first thing to do is check that the objects you're generating are what you think they are. The class function would have told you that c(new_demand1, new_demand2) is a list not a data.frame
The error could be because of read.csv as it's missing header = T.
Let's try this chunk of code
server <- function(input, output) {
output$table <- renderTable({
df_ln <- read.csv("F:/Project/Programme/ML/DAR Machine Learning TR Part A/train_darp_ln.csv", header = T)
Linearmodel_DARP <- lm(veh~area+chrit..peak, data = df_ln)
new_demand1 <- data.frame(area=input$area)
new_demand2 <- data.frame(crit..peak=input$crit..peak)
fleetsize <- predict(Linearmodel_DARP, newdata=c(new_demand1, new_demand2))
round(exp(fleetsize), 0)
})
}
Related
I am having such a hard time by getting this kinda thing where I build a data set inside the server function for plotting a treemap and displaying not only the graph in the main panel but info regarding the data in the sidebar panel. Could somebody please tell me how I can make this reactive to be able to be used like I'm trying in the code below, if UI was working just fine?
I've tried making dtd1 inside reactive earlier and then calling it inside the plot as dtd1() but it keeps on not working.
############################ GLOBAL #########################################
#1. App
if("shiny" %in% rownames(installed.packages()) == FALSE){ install.packages("shiny") }
library(shiny)
#2. Easier data handling
if("dplyr" %in% rownames(installed.packages()) == FALSE){ install.packages("dplyr") }
library(dplyr)
#3. Interactive graphs
if("plotly" %in% rownames(installed.packages()) == FALSE){ install.packages("plotly") }
library(plotly)
############################ UI #########################################
ui <- fluidPage(
# Set bullet size
tags$style(type='text/css', "#select {font-size: 16px !important} "),
# 32px - h1() size || 24px - h2() size || 18.72px - h3() size || 16px - h4() size || 13.28px - h5() size
navbarPage("Analysis",
tabPanel("Home",
sidebarPanel(
h5(tags$li( tags$head(tags$style("
#container * { display: inline; }")),
div(id="container", textOutput("patent_scape_tag1")))
)
),
mainPanel(
plotlyOutput("treemap")
)
)
))
############################ SERVER #########################################
server <- function(input, output, session) {
dtd1 <- NULL
output$treemap <- renderPlotly({
dtd1 <<- structure(list(V1 = structure(c(9L, 8L, 4L, 7L, 2L, 6L, 1L, 3L,
5L, 10L, 13L, 11L, 12L), .Label = c("Apple", "Avocado", "Banana",
"Carrot", "Mango", "Mushroom", "Onion", "Orange", "Pineapple",
"Strawberry", "Sweet-lemon", "Watermelon", "Wildberry"), class = "factor"),
V2 = structure(c(4L, 3L, 9L, 11L, 12L, 2L, 1L, 6L, 10L, 5L,
7L, 8L, 1L), .Label = c("23", "24", "36", "42", "43", "46",
"48", "52", "56", "61", "82", "94"), class = "factor")), class = "data.frame", row.names = c(NA,
-13L))
p <- plot_ly(
dtd1,
labels = ~ V1,
parents = NA,
values = ~ V2,
type = 'treemap',
hovertemplate = "Ingredient: %{label}<br>Count: %{value}<extra></extra>"
)
p
})
output$patent_scape_tag1 <- renderText({
paste0("Topic ",
as.character(dtd1$V1[which.max(dtd1$V2)]),
" reached the highest number!")
})
}
shinyApp(ui, server)
I just started learning R and I am creating an interactive line chart using ggplot2 and plotly.
Is there a way to bold/highlight the corresponding line in a multiple line graph when the mouse hovers over?
The line chart that I have is plotted according to the inputs and multiple lines will be plotted in a single line chart if there are multiple inputs.
This is the code I have in R Shiny.
data_sales <- structure(list(town = c("ANG MO KIO", "ANG MO KIO", "ANG MO KIO",
"BEDOK", "BEDOK", "BEDOK"), Date = structure(c(17167, 17198,
17226, 17167, 17198, 17226), class = "Date"), median_sales = c(336500,
355000, 375000, 359000, 361500, 360000), percentage_change_sales = c(NA,
5.49777117384844, 5.6338028169014, NA, 0.696378830083555, -0.414937759336098
), transaction_vol = c(56L, 41L, 89L, 70L, 70L, 101L), percentage_change_vol = c(NA,
-26.7857142857143, 117.073170731707, NA, 0, 44.2857142857143)), row.names = c(1L,
2L, 3L, 32L, 33L, 34L), class = "data.frame")
ui <- fluidPage(
titlePanel("Change in Sales by Town"),
verticalLayout(
pickerInput(inputId = "town",
label = "Town",
choices = c("Ang Mo Kio" = "ANG MO KIO",
"Bedok" = "BEDOK"),
options = list('actions-box' = TRUE),multiple = T,
selected = "ANG MO KIO"),
mainPanel("Trend in sales",
fluidRow( plotlyOutput("sales_percentage_plot")
)
)
)
)
server <- function(input, output){
#For Resale Price
output$sales_percentage_plot <-renderPlotly({
data<-data_sales[data_sales$town %in% input$town, ]
p<-ggplot(data, (aes(Date,percentage_change_sales,colour = town))) +
geom_line() +
geom_point()
p<-ggplotly(p)
p
})
}
shinyApp (ui=ui, server=server)
Thanks in advance for the help given!
A little bit dirty but simple solution is:
library(shiny)
library(shinyWidgets)
library(plotly)
data_sales <-
structure(
list(
town = c("ANG MO KIO", "ANG MO KIO", "ANG MO KIO",
"BEDOK", "BEDOK", "BEDOK"),
Date = structure(c(17167, 17198,
17226, 17167, 17198, 17226), class = "Date"),
median_sales = c(336500,
355000, 375000, 359000, 361500, 360000),
percentage_change_sales = c(
NA,
5.49777117384844,
5.6338028169014,
NA,
0.696378830083555,
-0.414937759336098
),
transaction_vol = c(56L, 41L, 89L, 70L, 70L, 101L),
percentage_change_vol = c(
NA,
-26.7857142857143,
117.073170731707,
NA,
0,
44.2857142857143
)
),
row.names = c(1L,
2L, 3L, 32L, 33L, 34L),
class = "data.frame"
)
normal_size <- 0.5
bold_size <- 1.0
ui <- fluidPage(titlePanel("Change in Sales by Town"),
verticalLayout(
pickerInput(
inputId = "town",
label = "Town",
choices = c("Ang Mo Kio" = "ANG MO KIO",
"Bedok" = "BEDOK"),
options = list('actions-box' = TRUE),
multiple = T,
selected = "ANG MO KIO"
),
mainPanel("Trend in sales",
fluidRow(plotlyOutput(
"sales_percentage_plot"
)))
))
server <- function(input, output) {
#For Resale Price
output$sales_percentage_plot <- renderPlotly({
data <- data_sales[data_sales$town %in% input$town,]
# default size vector
sizes <- rep(normal_size, length(unique(data$town)))
# capture plotly event
eventdata <- event_data("plotly_hover")
p <-
ggplot(data, (
aes(
Date,
percentage_change_sales,
colour = town,
size = town
)
)) +
geom_line() +
geom_point()
if (!is.null(eventdata)) {
# search selected row in data
x <- data %>%
filter(Date == eventdata$x &
percentage_change_sales == eventdata$y)
# change size vector
sizes[which(unique(data$town) == x$town)] <- bold_size
}
# change line and point size manually
p <- p +
scale_size_manual(values = sizes)
# without tooltip settings, "town" appears twice...
p <- ggplotly(p, tooltip = c("x", "y", "colour"))
p
})
}
shinyApp (ui = ui, server = server)
I don't know why sometimes hover event occurs twice in a row.
I'm trying to reorder the x axis by the values in the y axis. The x axis is a name, the y axis is an integer. Both are reactive, user defined inputs. I have created a datatable that renders in the correct order, but ggplot does not take that order. Instead it does an alphabetical order.
My current code is:
Packages
library(shiny)
library(readxl) # to load the data into R
library(tidyverse)
library(stringr)
library(DT)
library(tools)
library(magrittr)
Data
lpop <-read.csv("londonpopchange.csv", header=TRUE)
UI
# Define UI for application that plots features of movies
ui <- fluidPage(
# Sidebar layout with a input and output definitions
sidebarLayout(
# Inputs
sidebarPanel(
# Select variable for y-axis
selectInput(inputId = "y",
label = "Y-axis:",
choices = c("Mid Year 2016" = "MYE2016",
"Births" = "Births",
"Deaths" = "Deaths",
"Births minus Deaths" = "BirthsminusDeaths",
"Internal Migration Inflow" = "InternalMigrationInflow",
"Internal Migration Outflow" = "InternalMigrationOutflow",
"Internal Migration Net" = "InternalMigrationNet",
"International Migration Inflow" = "InternationalMigrationInflow",
"International Migration Outflow" = "InternationalMigrationOutflow",
"International Migration Net" = "InternationalMigrationNet"),
selected = "MYE2016"),
# Select variable for x-axis
selectInput(inputId = "x",
label = "X-axis:",
choices = c("Borough" = "Name"),
selected = "Name")
),
# Output
mainPanel(
h1(textOutput("MainTitle")),
br(),
plotOutput(outputId = "geom_bar"),
DT::dataTableOutput("mytable")
)
)
)
Server
# Define server function required to create the scatterplot
server <- function(input, output) {
#this creates the title
output$MainTitle <- renderText({
paste(input$y, "for London Boroughs")
})
#creates a data table that reacts to the user variable input and arranges
#by the y variable
df <- reactive({
lpop %>%
select(input$x, input$y, "WF") %>%
arrange_(.dots = input$y) #%>%
# setNames(1:2, c("x", "y"))
})
#outputs the user defined data frame
output$mytable = ({DT::renderDataTable({df()})})
# Create the bar plot object the plotOutput function is expecting
output$geom_bar <- renderPlot({
ggplot(data = df(), aes_string(x = input$x, y = input$y, fill = "WF")) +
geom_bar(stat = "identity") +
scale_fill_manual(values=c("#000000", "#00D253")) +
theme(axis.text.x = element_text(angle = 90)) +
xlab(input$x)
})
}
# Create a Shiny app object
shinyApp(ui = ui, server = server)
It renders as so: https://jwest.shinyapps.io/ShinyPopulation/
If I use the reorder function in ggplot, it amalgamates all "Names" into one bar, see below.
# Create the bar plot object the plotOutput function is expecting
output$geom_bar <- renderPlot({
ggplot(data = df(), aes_string(x = reorder(input$x, input$y), y = input$y, fill = "WF")) +
geom_bar(stat = "identity") +
scale_fill_manual(values=c("#000000", "#00D253")) +
theme(axis.text.x = element_text(angle = 90)) +
xlab(input$x)
})
}
How can I render it by the Y axis? Is it something to do with scale_x_discrete(limits = ...). If it is I am confused as to how i'm meant to reference the first column of the reactive df
The csv can be downloaded here: https://drive.google.com/file/d/1QLT8CX9XFSx3WU_tADyWgyddHYd3-VSp/view?usp=sharing
DPUT
structure(list(Code = structure(c(7L, 1L, 12L, 13L, 14L), .Label = c("E09000001",
"E09000002", "E09000003", "E09000004", "E09000005", "E09000006",
"E09000007", "E09000008", "E09000009", "E09000010", "E09000011",
"E09000012", "E09000013", "E09000014", "E09000015", "E09000016",
"E09000017", "E09000018", "E09000019", "E09000020", "E09000021",
"E09000022", "E09000023", "E09000024", "E09000025", "E09000026",
"E09000027", "E09000028", "E09000029", "E09000030", "E09000031",
"E09000032", "E09000033"), class = "factor"), Name = structure(c(6L,
7L, 12L, 13L, 14L), .Label = c("Barking and Dagenham", "Barnet",
"Bexley", "Brent", "Bromley", "Camden", "City of London", "Croydon",
"Ealing", "Enfield", "Greenwich", "Hackney", "Hammersmith and Fulham",
"Haringey", "Harrow", "Havering", "Hillingdon", "Hounslow", "Islington",
"Kensington and Chelsea", "Kingston upon Thames", "Lambeth",
"Lewisham", "Merton", "Newham", "Redbridge", "Richmond upon Thames",
"Southwark", "Sutton", "Tower Hamlets", "Waltham Forest", "Wandsworth",
"Westminster"), class = "factor"), Geography = structure(c(1L,
1L, 1L, 1L, 1L), .Label = "London Borough", class = "factor"),
MYE2016 = c(249162L, 7246L, 273239L, 181783L, 272078L), Births = c(2671L,
68L, 4405L, 2446L, 3913L), Deaths = c(1180L, 38L, 1168L,
895L, 1140L), BirthsminusDeaths = c(1491L, 30L, 3237L, 1551L,
2773L), InternalMigrationInflow = c(22189L, 856L, 21271L,
19109L, 22469L), InternalMigrationOutflow = c(25132L, 792L,
23324L, 20488L, 29113L), InternalMigrationNet = c(-2943L,
64L, -2053L, -1379L, -6644L), InternationalMigrationInflow = c(11815L,
756L, 5054L, 5333L, 7480L), InternationalMigrationOutflow = c(6140L,
441L, 3534L, 4336L, 4460L), InternationalMigrationNet = c(5675L,
315L, 1520L, 997L, 3020L), Other = c(-24L, -1L, -14L, 46L,
-3L), Estimated.Population..mid.2017 = c(253361L, 7654L,
275929L, 182998L, 271224L), WF = structure(c(1L, 1L, 1L,
1L, 1L), .Label = c("London Borough", "Waltham Forest"), class = "factor")), .Names = c("Code",
"Name", "Geography", "MYE2016", "Births", "Deaths", "BirthsminusDeaths",
"InternalMigrationInflow", "InternalMigrationOutflow", "InternalMigrationNet",
"InternationalMigrationInflow", "InternationalMigrationOutflow",
"InternationalMigrationNet", "Other", "Estimated.Population..mid.2017",
"WF"), row.names = c(NA, 5L), class = "data.frame")
From a larger dataset, I want to only plot points that are within a min and max date that is specified with a shiny slider bar containing a date range. This post builds from a related post linked here. Data are contained at the bottom using dput.
The code/app below sequentially plots points as the date is increased with the slider bar. When I move the 2nd slider bar I want points no longer in the date range to be removed, which currenlty does not happen.
How do I subset the data so that only points (and paths) >= the min date and <= the max date are shown? It is not clear to me how to reference the two dates on the slider bar.
Thanks in advance.
library(ggplot2)
library(shiny)
ui <- fluidPage(
titlePanel("GPS Data Summary"),
sliderInput(inputId = "Order",
label = "Sequance of Observations",
min = as.Date(min(dat$PosiGMT)), max = as.Date(max(dat$PosiGMT)),
value = c(as.Date(min(dat$PosiGMT)), as.Date(min(dat$PosiGMT)))),
plotOutput("PointPlot")
)
server <- function(input, output) {
output$PointPlot <- renderPlot({
p <- ggplot(dat[as.Date(dat$PosiGMT) <= input$Order ,], (aes(x = GPSUTMEasting , y = GPSUTMNorthing ))) +
geom_point() + geom_path() +
xlim( min(dat$GPSUTMEasting), max(dat$GPSUTMEasting))+
ylim( min(dat$GPSUTMNorthing), max(dat$GPSUTMNorthing))
print(p)
})
}
shinyApp(ui = ui, server = server)
Data below
dat <- structure(list(GPSUTMNorthing =
c(4947787L, 4947945L, 4947957L,
4947954L, 4947797L, 4947835L, 4947825L, 4947784L, 4947842L, 4947839L,
4947789L, 4947807L, 4947839L, 4947845L, 4947779L, 4947824L, 4947824L,
4947772L, 4947824L, 4947821L, 4947816L, 4947809L, 4947840L, 4947829L,
4947820L),
GPSUTMEasting = c(600201L, 600910L, 600911L, 600907L,
601052L, 601038L, 601031L, 601066L, 600998L, 600995L, 601058L,
601038L, 600987L, 601071L, 601016L, 601002L, 601003L, 601003L,
600917L, 600916L, 600918L, 600923L, 600985L, 600980L, 600914L),
PosiGMT = structure(c(1360393200, 1360414800, 1360479600,
1360501200, 1360544400, 1360566000, 1360587600, 1360630800, 1360652400,
1360674000, 1360695600, 1360717200, 1360738800, 1360803600, 1360825200,
1360846800, 1360868400, 1360890000, 1360911600, 1360933200, 1360954800,
1360976400, 1360998000, 1361019600, 1361041200),
class = c("POSIXct", "POSIXt"), tzone = "") ),
.Names = c("GPSUTMNorthing", "GPSUTMEasting", "PosiGMT"),
row.names = c(1L, 2L, 5L, 6L, 8L, 9L, 10L, 12L, 13L, 14L, 15L,
16L, 17L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L),
class = "data.frame")
Hi input$Order is a vector of length 2, so input$Order[1] is the min and input$Order[2] the max, you can do something like this :
library(ggplot2)
library(shiny)
ui <- fluidPage(
titlePanel("GPS Data Summary"),
sliderInput(inputId = "Order",
label = "Sequance of Observations",
min = as.Date(min(dat$PosiGMT)), max = as.Date(max(dat$PosiGMT)),
value = c(as.Date(min(dat$PosiGMT)), as.Date(min(dat$PosiGMT)))),
plotOutput("PointPlot")
)
server <- function(input, output) {
output$PointPlot <- renderPlot({
### Filter by date
dat <- dat[as.Date(dat$PosiGMT) >= input$Order[1] & as.Date(dat$PosiGMT) <= input$Order[2] ,]
###
p <- ggplot(dat, (aes(x = GPSUTMEasting , y = GPSUTMNorthing ))) +
geom_point() + geom_path() +
xlim( min(dat$GPSUTMEasting), max(dat$GPSUTMEasting))+
ylim( min(dat$GPSUTMNorthing), max(dat$GPSUTMNorthing))
print(p)
})
}
shinyApp(ui = ui, server = server)
I am afraid I am stuck.
I have a simple Shiny script with the intention of subsetting a dataframe based on user input and plot two variables in a scatterplot. When running the script I always get the error "Error in data.frame(x = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, : arguments imply differing number of rows: 1786, 2731". All I know is this error occurs when data is n_col!=n_row in a dataframe. However, I do not see how this can be the issue here. What buffles me is, if I execute the snippet below , the plot is drawn without problems:
#test4 <- subset(test2, grepl("PLANT1", test2$PLANTS))
#ggplot(test4, aes(x=test4$HOUR, y=test4$PRICE_NO)) +
geom_point(shape=1)
All I am doing is substituting the string with input$plant from ui.r.
Here is my Main window code:
###################################
# Launch App
###################################
#install.packages("shiny")
#install.packages("ggplot2")
library(shiny)
library(ggplot2)
#load data
#data <- read.csv2(file="C:/data.csv",head=FALSE)
#test4 <- subset(test2, grepl("PLANT1", test2$PLANTS))
#ggplot(test4, aes(x=test4$HOUR, y=test4$PRICE_NO)) +
geom_point(shape=1)
runApp("C:/PATH/")
My server.r
library(shiny)
library(ggplot2)
# Define Input to Plot
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
# Draw Plot
test4 <- subset(test2, grepl(input$plant, test2$PLANTS))
ggplot(test4, aes(x=test4$HOUR, y=test4$PRICE_NO)) +
geom_point(shape=1)
})
})
My ui.r
library(shiny)
# Title
shinyUI(fluidPage(
titlePanel("TITLE"),
#Sidebar Layout
sidebarLayout(
sidebarPanel(
textInput("plant",
label = h3("Plant:"),
value = "PLANT1")
),
#
mainPanel(
plotOutput("distPlot")
)
)
))
Sample data as requested:
test2
plants HOUR PRICE
plant1 1 12,45
plant1 2 15,52
plant1 3 15,45
plant1 4 78,12
plant1 5 72,12
plant2 1 78,72
plant2 2 72,52
plant2 3 75,52
plant2 4 78,11
Conditional on what I mentioned in the comment regarding the use of subset, you can proceed as follows (you don't need to use grepl here)
test4 <- subset(test2, test2$plants==input$plant)
ggplot(test4, aes(x=HOUR, y=PRICE)) +
geom_point(shape=1)
ui. R
library(shiny)
# Title
shinyUI(fluidPage(
titlePanel("TITLE"),
#Sidebar Layout
sidebarLayout(
sidebarPanel(
selectInput("plant",
label = h3("Plant:"),
choices = c("plant1","plant2"),
selected="plant1")
),
#
mainPanel(
plotOutput("distPlot")
)
)
))
server.R
library(shiny)
library(ggplot2)
test2<-readRDS("data\\test2.rds")
# Define Input to Plot
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
# Draw Plot
test4 <- subset(test2, test2$plants==input$plant)
ggplot(test4, aes(x=HOUR, y=PRICE)) +
geom_point(shape=1)
})
})
Your sample data which is in data folder inside the app:
test2<-structure(list(plants = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L), .Label = c("plant1", "plant2"), class = "factor"), HOUR = c(1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L), PRICE = structure(c(1L, 3L,
2L, 8L, 4L, 9L, 5L, 6L, 7L), .Label = c("12,45", "15,45", "15,52",
"72,12", "72,52", "75,52", "78,11", "78,12", "78,72"), class = "factor")), .Names = c("plants",
"HOUR", "PRICE"), class = "data.frame", row.names = c(NA, -9L
))