-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exercise 1
56 lines (34 loc) · 1.22 KB
/
Exercise 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#Hands On Exercise 1
#Start
#Installing the required packages
install.packages("data.table")
install.packages("datasets")
library("datasets")
setwd("G:\\THE MICA EPISODE\\2nd YEAR\AMMA\\Hands on Exercises")
#Storing the women data in sample_women data frame
sample_women<-data.frame(women)
#Finding the average weight and height of the women in the data frame
mean.height=mean(women$height)
mean.weight=mean(women$weight)
#Finding the number of women whose height is greater than average and whose weight is less than the average and storing it in a new data frame
women_df<-subset(women,height>mean.height & weight<mean.weight)
#There are no such women
#End
#Creating a date frame of 15 Indian cities and their population size
# Start
#Installing required packages
install.packages("rvest")
library("rvest")
install.packages("xml2")
library("xml2")
#Getting data from the web
city_link="http://www.worldatlas.com/articles/the-biggest-cities-in-india.html"
city_file= read_html(city_link)
city_table=html_nodes(city_file,"table")
#Creating the data frame
city_table_final<-html_table(city_table,fill=TRUE)
View(city_table_final)
city_data=as.data.frame(city_table_final)
view(city_data)
#End
#End of Hands on Exercise 1