Posts

PART B

 9) --- title: "prg9" author: "Kiran T L" format: docx editor: visual --- Objectives Create multiple histograms using ggplot2::facet_wrap() to visualize how a variable (e.g., Sepal.Length ) is distrubuted across different groups (e.g., Species ) in a built-in R dataset. {r} #Load the ggplot2 pckage library(ggplot2) Step 1: Load and Explore the Dateset {r} # Load the iris databset data("iris") # View the first few row of the datset head(iris) Step 2: Create grouped histograms using Facet_wrap {r} #Create histogram using Facet_wrap for grouped data ggplot(iris, aes(x = Sepal.Length))+ geom_histogram(binwidth = 0.3,fill = "skyblue", color = "black")+ facet_wrap(~ Species)+ labs(title = "Distribution of sepal length by species", x = "Sepal Length (cm)", y = "Frequency")+ theme_minimal() 10) # Install package (only first time) install.packages("ggplot2") # Load library library...

PART A

1) Develop an r program to quickly explore a given dataset , including categorical analysis using the graph_by() command, and visualize the findings using ggplot2 . what we will do In this program, we will: Load the required libraries and dataset. Explore the structure of the dataset. Convert a numerical variable into a categorical variable. Perform categorical analysis using group_by() and summarize() . Visual the result using ggplot2 . step1 : Load required libraries and dataset tidyverse is a collection of packages for data science. dplyr is used for grouping and summarizing data. {r} library(tidyverse)  library(dplyr)   data <- mtcars Step 2: Explore the dataset Before performing any analysis, we should understand the dataset. we will check: Number of rows and columns Columns name Data types Summary statistics First few rows {r} # Dimension (rows and columns) dim(data) # Column names names(data) # structure of dataset str(data) # Summary statistics summary(d...

..

  2. Simple shell script for basic arithmetic and logical calculations. #!/bin/sh a=2 b=4 c=3 val=`expr $a + $b` echo "Sum = $val" val=`expr $a - $b` echo "Difference= $val" val=`expr $a \* $b` echo "Product = $val" val=`expr $b / $a` echo "quotient = $val" val=`expr $a % $b` echo "Modulus = $val" if [ $a == $b ] then echo “a is equal to b” else echo “a is not equal to b” fi if [ $a != $b ] then echo “a is equal to b” else echo “a is not equal to b” fi if [ $a -lt 10 -o $b -gt 20 ] then echo “true” else echo “false” fi if [ $a -lt 10 -a $b -gt 20 ] then echo “True” else echo “False” fi [LabExam@ISELAB1 ~]$chmod a+x pr2.sh /*To execute your shell program, use chmod a+x program name(For changing mode), a+x means giving execute permission to all three category of people(user,group,others).*/ [LabExam@ISELAB1 ~]$sh pr2.sh /*To run the program use any of the methods: sh program name or ./ program name*/ Sum = 8 Difference = -2 Product =8 Quo...