Module # 2 – Functions

assignment2 <- c(16,18,14,22,27,17,19,17,17,22,20,22)

myMean <- function(assignment2) {
return(sum(assignment)/length(someData))
}

Result:
> myMean(assignment2)
Error in myMean(assignment2) : object ‘assignment’ not found
>

This code shows error because the object ‘assignment’ does not exist. The object ‘someData’ does not exist either.
After specifying the object ‘assignment2’ – I re-wrote the function in order to call the mean.
In order for this function to work and produce the mean, the arguments must be specified.

Function updated –

assignment2 <- c(16,18,14,22,27,17,19,17,17,22,20,22)

myMean <- function(assignment2) {
return(sum(assignment2)/length(assignment2))
}

Result:
> myMean(assignment2)
[1] 19.25

assignment2 <- c(16,18,14,22,27,17,19,17,17,22,20,22)
> assignment3 <- c(5, 8, 4, 45, 56, 75, 43)
> assignment4 <- c(45, 32, 56, 56, 12, 56, 87)

I was able to re-write the function using x.

myMean <- function(x) 

{ + return(sum(x)/length(x))
+ }

 

> myMean(assignment2) [1] 19.25
> myMean(assignment3) [1] 33.71429
> myMean(assignment4) [1] 49.14286 >

 

Module # 4 JavaScript If … Else Switch Operators Functions and Web Design

In this module I started with the code provided, “if (time<20){ document.get.ElementByld(“demo”).innerHTML = “Good day”; }

I added if else and this was final output

function myFunction() {
var time = new Date().getHours();
if (time < 20) {
document.getElementById(“demo”).innerHTML = “Good day”;
}else{
greeting = “Good Evening”;
}
document.getElementByld(“demo”).innerHTML=greeting;
}

-The code seemed to work fine once it uploaded to my website.

-I had a hard time working with PHP as the code did not work at in the Tryit editor.

The code I used –
<!DOCTYPE html>
<html>
<body>
<?php

$d=date(“D”);
if ($d==”Fri”)
echo “Have a nice weekend!”;
elseif ($d==”Sun”)
echo “Have a nice Sunday!”;
else
echo “Have a nice day!”;

?>

</body>
</html>

 

To me, PHP and JAvaScript are different and PHP seems to be more complex. I am excited to learn more in depth. I will be revisiting the lectures and powerpoint for my final project.

For my final project I will be creating a website with a charity in the Tampa bay area.

Module #3

Module #3 was very interesting and fun to learn. I enjoyed adding images to my website and learning the different types of formats (PNG, GIF, and JPG).

I noticed at the time of saving the images in photoshop with the different formats, PNG took the longest to download. I noticed as I tried to download the image for a second time, the application will give me an error message because the image was still “saving as” PNG. After uploading the images to my website I noticed the best quality is PNG. I noticed the JPG format loads faster than GIF and PNG. It seemed that PNG had the best transparency when zooming in.

 

<html>
<head> <title> My Page </title>
<body>
<h1> Wagner Perez. This is my first JavaScript </h1>
<h2> Module #3</h2>
<h3>PNG Image</h3>
<img src=”book1.png” alt= “Book” width=”620″ height=”550″ >
<h4>GIF Image</h4>
<img src=”book2.gif” alt= “Book” width=”620″ height=”550″ >
<h5>JPG Image</h5>
<img src=”book3.jpg” alt= “Book” width=”620″ height=”550″ >
<p id = “demo”> </p>
var price1 = 5;
var price2= 6;
var total = price1 + price2;
document.get.ElemenetByld(“demo”).innerHTML =
“The total is: “total;
</body>
</html>

Module #2

  • During this module I encountered a couple difficulties. During the first week of the class I was not able to create a profile with 0fees website. After trying multiple times this second week I was able to figure out the issue and create a profile. It is now easier to follow the lectures with the same website.
  • Another issue I had during this assignment was connecting ForkLift to the server. This was an easy fix as I did not notice the default setting had to be changed from SFTP to FTP.
  • I also had difficulties when trying to load my file into the online file manager, as I was following the video.
  • TextWrangler worked the best for me and it was easy to download.
  • I think JavaScript is challenging but will be easier as I practice.

 

Module #1 Summer 2019

I am very excited about this course and learning how to create a website. I have taken a couple courses at USF where I was required to use R and I also took Web Design in high school as an elective. Even though I have taken Web Design before this course will be something new for me because it has been a while since I graduated and I don’t remember much.

I used 000website as my webhosting. My address is https://www.000webhost.com/members/website/list

 

Final Project Spring 2019

In order to demonstrate what I have learned in this course, I will be using different types of visualization methods on a set of data gathered from www.data.gov. The data I chose reflects the number Asthma hospitalizations in Chicago from 2000-2011. I will be focusing on the data captured in the year 2011.Screen Shot 2019-04-27 at 1.11.09 PM

I first used two variables to create a bar graph in Plot.ly. I used the number of hospitalizations and the crude rate of the year 2011.

Screen Shot 2019-04-27 at 1.09.45 PM

By visualizing this data I was able to see how the crude rate associates with the number of hospitalizations in 2011. I was surprised with the number of fatalities reported even after the patients were hospitalized.

Out of the data collected by I found that a lot of the information could not be used in a bar graph. Data such as the name of the hospital and the census tracker would not be appropriate for a bar graph.

Screen Shot 2019-04-27 at 9.20.14 PM

I was also able to use plot.ly to illustrate difference in the crude rate when it comes to ages.

By the graph chart we are able to see that the older the person is, it cause more causes that may end in death.

With the two graphs we were able to see how the crude rate changes. The more people that are hospitalized the higher the crude rate is.

We the data collected we are able to conclude that the older the person is the more likely they will have Asthma.

Module # 12 Social Network assignment

The information provided on social networking was very interesting. For me it was challenging to create the visual NodeXL so I tried the code provided in R.

I tried the code provided but I kept getting an error message.

This was the code I was using.

net = rgraph(10, mode = “graph”, tprob = 0.5) net = network(net, directed = FALSE)
Error: unexpected symbol in “net = rgraph(10, mode = “graph”, tprob = 0.5) net”
> network.vertex.names(net) = letters[1:10]
Error in network.vertex.names(net) = letters[1:10] :
object ‘net’ not found
> ggnet2(net)
Error in ggnet2(net) : object ‘net’ not found
> ggnet2(net, node.size = 6, node.color = “black”, edge.size = 1, edge.color = “grey”)
Error in ggnet2(net, node.size = 6, node.color = “black”, edge.size = 1, :
object ‘net’ not found

I could not figure out the issue with code.

Screen Shot 2019-03-31 at 10.29.52 PM

The success I had was using the code with ggplot2. I think the website provide gave really good information and provided all of the right steps to get the visual.

Social network visualization can be challenging and I think one of the things that is really helpful is the labeling.

Screen Shot 2019-03-31 at 10.47.40 PM.png