Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.
Running Code
When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
## Now we are trying the qunantiles with out the regression## Read the CSV datasetwd("C:/Users/anune/Downloads")data <-read.csv("PIC_65_FIRE.AN.csv")# List of specific ID valuesspecific_ids <-c("97257312", "96954301", "97916940", "97178088", "96587426", "96587437", "97178318", "96804950", "97257832")# Subsetting the data based on specific IDsid_data <- data[data$ID %in% specific_ids, ]# Specify the quantiles you're interested in (e.g., 0.25, 0.5, 0.75)quantiles <-c(0.25, 0.5, 0.75)# Calculate quantiles for the FEED_INTK columnquantile_values <-quantile(id_data$FEED_INTK, probs = quantiles)# Create a data frame to store the quantilesquantiles_df <-data.frame(Quantile =names(quantile_values), Value = quantile_values)# Print the quantilesprint(quantiles_df)
##Now i am including the STAY_IN at the X axis### Read the CSV datadata <-read.csv("PIC_65_FIRE.AN.csv")# List of specific ID valuesspecific_ids <-c("97257312", "96954301", "97916940", "97178088", "96587426", "96587437", "97178318", "96804950", "97257832")# Subsetting the data based on specific IDs#id_data <- as.tibble(subset(data, ID %in% specific_ids))#id_data <- group_by(id_data, ID)id_data <- data[data$ID %in% specific_ids, ]# Specify the quantiles you're interested in (e.g., 0.25, 0.5, 0.75)quantiles <-c(0.25, 0.5, 0.75)# Calculate quantiles for the TIME (STAY-IN) columnquantile_values <-quantile(id_data$STAY_IN, probs = quantiles)# Create a data frame to store the quantilesquantiles_df <-data.frame(Quantile =names(quantile_values), Value = quantile_values)# Print the quantilesprint(quantiles_df)
# Load the necessary libraries (ggplot2 for plotting)library(ggplot2)
Warning: package 'ggplot2' was built under R version 4.1.3
# Create a bar plot of the quantilesggplot(quantiles_df, aes(x = Quantile, y = Value)) +geom_bar(stat ="identity", fill ="blue", alpha =0.7) +labs(title ="Quantiles of STAY_IN",x ="Quantile",y ="STAY_IN") +theme_minimal()
##trying a plot for each ID### Load the necessary librarieslibrary(ggplot2)library(gridExtra)
Warning: package 'gridExtra' was built under R version 4.1.3
# List of specific ID valuesspecific_ids <-c("97257312", "96954301", "97916940", "97178088", "96587426", "96587437", "97178318", "96804950", "97257832")# Split the data by IDdata_by_id <-split(data, data$ID)# Create a list to store the individual QQ plotsqq_plots <-list()# Create QQ plots for each ID and store them in the listfor (id in specific_ids) { id_data <- data_by_id[[id]]# Create a QQ plot against a theoretical normal distribution qq_plot <-ggplot(id_data, aes(sample = FEED_INTK)) +geom_qq() +geom_qq_line() +labs(title =paste("QQ Plot for ID:", id)) +theme_minimal() qq_plots[[id]] <- qq_plot}# Arrange the QQ plots in a gridgrid.arrange(grobs = qq_plots, ncol =3)
You can add options to executable code like this
[1] 4
The echo: false option disables the printing of code (only output is displayed).