Code
<- read.csv("_data\\birds.csv")
df
view(df)
Error in view(df): could not find function "view"
Khadijat Adeleye
March 1, 2023
##Reading in data
#Description of Datasets The second dataset has 14 columns and 30977 observations. From colnames, we get to know that the dataset gives us the values of the dietary energy intake for different countries across different years from 1961-2017. Data types of the columns, value could actually be converted into double type. There were around 11000 missing values found and removed from the data. Many countries were included in this dataset and there are 6 types of birds but only one domain of animals present.
[[1]]
[1] "Domain.Code" "Domain" "Area.Code" "Area"
[5] "Element.Code" "Element" "Item.Code" "Item"
[9] "Year.Code" "Year" "Unit" "Value"
[13] "Flag" "Flag.Description"
'data.frame': 30977 obs. of 14 variables:
$ Domain.Code : chr "QA" "QA" "QA" "QA" ...
$ Domain : chr "Live Animals" "Live Animals" "Live Animals" "Live Animals" ...
$ Area.Code : int 2 2 2 2 2 2 2 2 2 2 ...
$ Area : chr "Afghanistan" "Afghanistan" "Afghanistan" "Afghanistan" ...
$ Element.Code : int 5112 5112 5112 5112 5112 5112 5112 5112 5112 5112 ...
$ Element : chr "Stocks" "Stocks" "Stocks" "Stocks" ...
$ Item.Code : int 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 ...
$ Item : chr "Chickens" "Chickens" "Chickens" "Chickens" ...
$ Year.Code : int 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 ...
$ Year : int 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 ...
$ Unit : chr "1000 Head" "1000 Head" "1000 Head" "1000 Head" ...
$ Value : int 4700 4900 5000 5300 5500 5800 6600 6290 6300 6000 ...
$ Flag : chr "F" "F" "F" "F" ...
$ Flag.Description: chr "FAO estimate" "FAO estimate" "FAO estimate" "FAO estimate" ...
Error in select(df, Area): could not find function "select"
Error in table(area): object 'area' not found
#list of items in the dataset
Error in select(df, Item): could not find function "select"
Error in table(item): object 'item' not found
Error in select(df, Domain): could not find function "select"
Error in table(domain): object 'domain' not found
---
title: "Challenge 1 Instructions"
author: "Khadijat Adeleye"
description: "Reading in data and creating a post"
date: "03/01/2023"
format:
html:
toc: true
code-fold: true
code-copy: true
code-tools: true
categories:
- challenge_1
- KhadijatAdeleye
- Birds
- ggplot2
---
##Reading in data
```{r}
df <- read.csv("_data\\birds.csv")
view(df)
```
#Description of Datasets
The second dataset has 14 columns and 30977 observations. From colnames, we get to know that the dataset gives us the values of the dietary energy intake for different countries across different years from 1961-2017. Data types of the columns, value could actually be converted into double type. There were around 11000 missing values found and removed from the data. Many countries were included in this dataset and there are 6 types of birds but only one domain of animals present.
```{r}
dim(df)
```
```{r}
list(colnames(df))
```
```{r}
str(df)
```
```{r}
df <- transform(df,val= as.numeric(Value))
sum(is.na(df))
```
```{r}
df<-na.omit(df)
dim(df)
```
```{r}
area<-select(df,Area)
table(area)
```
#list of items in the dataset
```{r}
item<-select(df,Item)
table(item)
```
```{r}
domain<-select(df,Domain)
table(domain)
```
```{r}
plot(val~Year,df)
```
```{r}
df_Afghanistan <-df%>% filter(`Area`=='Afghanistan')
plot(val~Year,df_Afghanistan)
```