Posts

Showing posts from March, 2023

Debugging and Defensive Programming of R(Assignment 11)

Image
 Greetings Professor, In this assignment #11, I learned how to debug the code and to find the errors by using debugging function debug(). In this assignment, by using the given code I have to debug and fix the code in order to run the program. At first in the given code, by trying to run the code the function had trouble in compiling due to an unexpected error. The error is return() is written within in the same line as the for() loop created. By moving the return() function to the next line removed this error.  Next is to start the debugging process by using debug() function. In order to accomplish this, I created a matrix 'a' and using it as an input, I ran the program line by line until the next error popped. In this the function tukey.outlier() had not been defined to preventing the tukey_multiple() from running smoothly. As this module focuses on make code run, the tukey.outlier() was excluded in the repetition and tested the code. By doing this the tukey_multiple() was a...

Building your own R Package (Assignment 10)

 Greetings Professor, In this assignment #10, I learned how to create our own R package and creating a description file in R. To create a package I used the description: 1. Package name 2. Title 3. Version 4. Authors 5. Description 6. Depends 7. License 8. LazyData I created my own package by using these information in the word and posted in my GitHub Repository. The information I put in for the package is as follows: Package: Bantan Type: Package Title: Simple math calculation Version: 0.1.0 Author: Jahnavi Mandhadapu Maintainer: Jahnavi Mandhadapu <jmandhadapu@usf.edu> Description: This R package contains multiple functions to implement mathematical operations and statistical functions. Depends: R(>=3.1.2) License: CC0 Encoding: UTF-8 LazyData: true At first I installed the packages roxygen2 and devtools for building my package. I created my Package as 'Bantan' and it contains functions for math functions and calculations. The version I used 0.1.0...

Visualization in R(Assignment 9)

Image
 Greetings Professor, In this assignment#9, I learned about how visualize the data in R Programming by using three different ways like Basic Graphs, Lattice and ggplot2 from RStudio.  At first we have to download the dataset(USConsumption1950) from the web or internet and import the dataset into the RStudio by using import dataset. Then for the visualization of Basic Graphs I used plot() to the dataset.  > plot(USConsump1950) >plot(USConsump1950, main="My Scatterplot") And for the aesthetic and elegant visualization of dataset I use "lattice" method.  > library(lattice) >splom(USConsump1950[,c("income","expenditure")], col="blue",main="Scatter Plot Matrix of income and expenditure") >splom(USConsump1950[,c("income","expenditure")], col="red",main="Scatter Plot Matrix of income and expenditure") And for the creation of the graphical plots visualization of dataset I used ...

Input/Output, String Manipulation and plyr package(Assignment 8)

Image
 Greetings Professor, In this assignment #8, I learnt many ways to process data and also found about the file.choose() function as it allows us to select the file and analyze the data without required location. In this assignment, I have to read and analyze the given dataset. At first I installed the required packages and libraries by using the code: > install.packages("pryr") > require(pryr) >require(ISLR) >require(boot) >install.packages("plyr") >library(data.table) >library(plyr) And now to calculate the 'mean' for the category "Sex" I used the code: And then I given the dataset into R and to view the data by using code: > Assignment.6.Dataset.1 <- read.csv("C:/Users/chara/Downloads/Assignment 6 Dataset-1.txt") > View(Assignment.6.Dataset.1) And now to calculate the 'mean' for the category "Sex" I used the code:  > x = ddply(Assignment.6.Dataset.1, "Sex", transform, Grade.A...