Wednesday, January 31, 2024

Program 7- Graphs in R- Line graph, Box plot , bar plot and scatter plot in R language R Programming Lab - Bsc CS DA and BSC ML And AI -Bharathiar University -

 

B.Sc Computer Science  

R Programming - Lab  

Bharathiar University 

Program 7

Graphs in R

Program 6- Write a R program to demonstrate various types of graphs

SOURCE CODE:


# Create sample data

x <- c(1, 2, 3, 4, 5)

y <- c(2, 4, 6, 8, 10)


par(mfrow = c(2, 2))


# Plot a basic line graph

pts <- c(2,3,4,6,8)

 plot(pts, type = "o", col = "blue", lwd = 2, main = "Simple Line Graph", xlab = "X-axis", ylab = "Y-axis")



# Add points to the graph

points(pts, col = "red", pch = 16)



barplot(c(3, 5, 2, 7, 4), names.arg = c("A", "B", "C", "D", "E"), col = "orange", main = "Bar Plot", xlab = "Categories", ylab = "Values")

plot(x, y, col = "green", pch = 18, main = "Scatter Plot", xlab = "X-axis", ylab = "Y-axis")


boxplot(x, col = "blue", names = "X", main = "Box Plot", xlab = "Variables", ylab = "Values")


Sample Output:



Friday, January 12, 2024

Program 2 B.Sc Computer Science with Data analytics Linux and Shell Programming - Lab Bharathiar University Program 2- Write a awk script to find the number of characters, words and lines in a file

B.Sc Computer Science  with Data analytics

Linux and Shell Programming - Lab  

Bharathiar University 

Program 2- Write a awk script to find the number of characters, words and lines in a file

Source Code


 filename="/home/basictoprotamil/Desktop/shell/sample"


# Use awk to calculate characters, words, and lines

awk '{

    # Count characters

    ccount += length;


    # Count words

    wcount += NF;


    # Count lines

    lcount += 1;

    }

END {

    printf "Number of characters: %d\n", ccount;

    printf "Number of words: %d\n", wcount;

    printf "Number of lines: %d\n", lcount;

   

}' $filename





Tuesday, January 9, 2024

Program 1 B.Sc Computer Science with Data analytics Linux and Shell Programming - Lab Bharathiar University Program 1- Write a Shell script that displays list of all the files in the current directory to which the user has read, write and execute permissions.

 

B.Sc Computer Science  with Data analytics

Linux and Shell Programming - Lab  

Bharathiar University 

Program 1

Program 1- Write a Shell script that displays list of all the files in the current directory to which the user has read, write and execute permissions.




SOURCE CODE:


echo "Files with read, write and execute permissions"
echo "===================================="


for file in *; do
if [ -r $file ] && [ -w $file ] && [ -x $file ]; then
echo $file
fi
done


Sample Output:



Program 12 BCA Madras University BCA Object Oriented Programming using C++ Practical Madras University Program 12 Implement a telephone directory using files

  BCA Object Oriented Programming using C++ Practical Madras University  Program 12  Implement a telephone directory using files SOURCE CODE...