library(janitor)
library(tidyverse)
library(flextable)
library(moments)
setwd("D:/Bioinformatica")
df=read.csv("data.csv")

table(df$AnimalName)
## 
##             Birds Black-tailed deer         Buffaloes               cat 
##                37                 1               129                36 
##            cattle            Cattle           chicken           Chicken 
##                 1                21                 4                 9 
##               cow              Deer               Dog              Dogs 
##                 3                38                34                 1 
##            donkey            Donkey              duck              Duck 
##                 2                38                 1                56 
##          Elephant               Elk              Fowl               Fox 
##                59                 1                62                 7 
##              Fox               Goat             Goats           Hamster 
##                 1                26                 2                18 
##             horse             Horse           Hyaenas              Lion 
##                 5                10                 1                16 
##            mammal            Monkey              Moos         Mule deer 
##                 1                28                 1                 1 
##             mules       Other Birds               Pig              Pigs 
##                 1                 6                63                 3 
##            Rabbit          Reindeer             Sheep         Sika deer 
##                11                 1               110                 1 
##             snake             Tiger            Turtle            Wapiti 
##                 1                17                 4                 1 
## White-tailed deer            Wolves 
##                 1                 1
df %>% tabyl(symptoms1) %>%
adorn_pct_formatting() %>%
flextable() %>%
fontsize(size=14) %>%
autofit()

symptoms1

n

percent

abortion at the end of gestation

2

0.2%

Abdominal pain

2

0.2%

Abortion

2

0.2%

Abortion on late pregancy

2

0.2%

Air sacculitis

2

0.2%

Allergic Reaction

2

0.2%

Animal gets uneasy

2

0.2%

Apathy

2

0.2%

Appetite varies

2

0.2%

Attacks

2

0.2%

Bad breath

2

0.2%

Balance problem

2

0.2%

Bald patches

2

0.2%

Barren ewes

2

0.2%

Berberi

2

0.2%

Bleeding from other parts of the body

2

0.2%

Blood from mouth

2

0.2%

Blood in urine

2

0.2%

Blood stool

2

0.2%

Bloody Diarhhea

2

0.2%

Bloody Urine

2

0.2%

Bluish white opacity

1

0.1%

Bony Lesion

2

0.2%

Bubbles in the mouth

2

0.2%

Cell Damage

2

0.2%

Cessation of eructation

2

0.2%

Changes in outer layer skin

2

0.2%

Constant pacing

2

0.2%

Continuous loss of weight

2

0.2%

Convulsion

2

0.2%

Coughing 

2

0.2%

Dark or black face

2

0.2%

Decreased eyelid

2

0.2%

Decreased growth of bone

2

0.2%

Decreased milk

2

0.2%

Dejection

4

0.5%

Diarrhea with muscus

3

0.3%

Difficulty in breathing

2

0.2%

Difficulty in feeding

2

0.2%

Discharge

2

0.2%

Discharge From eyes

3

0.3%

Discomfort

3

0.3%

Dizzines

1

0.1%

Drooping ears

2

0.2%

Drooping wings

2

0.2%

Dullness

2

0.2%

Dyspnea

8

0.9%

Edema

2

0.2%

Egg production stops

2

0.2%

Emaciation

8

0.9%

Enlarged Thymus

2

0.2%

Excess salivation

2

0.2%

Excessive blood loss

2

0.2%

Excessive eye watering

2

0.2%

Excitability

2

0.2%

Exessive Urination

2

0.2%

Extreme thirst

2

0.2%

Eye redness

2

0.2%

Facial Swelling

5

0.6%

Facial edema

4

0.5%

Fatty stool

2

0.2%

Feather Loss

2

0.2%

Fetopelvic dispropotion

21

2.4%

Fever

257

29.5%

Floopy muscle

2

0.2%

Fluffed Feather

2

0.2%

Fluif Faeces on blood and muscle

2

0.2%

Formation of vesicles

2

0.2%

Forthy eye

2

0.2%

Foul Smelling

4

0.5%

Gas

2

0.2%

Gasc

2

0.2%

Gasping

2

0.2%

Gastritis

2

0.2%

General malaise

2

0.2%

Greenish-yellow nasal discharge

3

0.3%

Groosly enlarged

2

0.2%

Hair loss

3

0.3%

Head Shking

1

0.1%

Head tilt

2

0.2%

Head tossing

1

0.1%

Heavy Breathing

2

0.2%

Heavy infection

2

0.2%

Hemopytsis

2

0.2%

Hyperexcitability

2

0.2%

Immediate death

2

0.2%

Inability to digest

2

0.2%

Inability to stand

4

0.5%

Inappentence

2

0.2%

Indigestion

2

0.2%

Inflammation

1

0.1%

Isolation from flock

1

0.1%

Jaundice

8

0.9%

Labored breathing

2

0.2%

Lack of walking

2

0.2%

Legness

2

0.2%

Lepatomegaly

2

0.2%

Lesions in the nasal cavity

3

0.3%

Lession on cat skin

2

0.2%

Lethargy

4

0.5%

Limping

4

0.5%

Liquid Dropping

2

0.2%

Listless

3

0.3%

Loss od appetite

2

0.2%

Loss of activity

2

0.2%

Loss of appetite

2

0.2%

Loss of eat

4

0.5%

Mortality

2

0.2%

Most often none

2

0.2%

Nasal Bleeding

2

0.2%

Nasal discharge

2

0.2%

Nausea

2

0.2%

Neck paralysis

2

0.2%

Normal appetite

2

0.2%

Nosebleed 

2

0.2%

Oedema

2

0.2%

Overweight

2

0.2%

Pale comb

2

0.2%

Partial Paralysis

2

0.2%

Passing of undigested food

2

0.2%

Pnemonia

2

0.2%

Polyuria

2

0.2%

Poor coat apperence

2

0.2%

Poor condition

2

0.2%

Poor growth

2

0.2%

Poor immune function

2

0.2%

Poor wool

2

0.2%

Puffed_up Feather

2

0.2%

Pyrexia

2

0.2%

Radip onset

1

0.1%

Red Tinge

2

0.2%

Red on affected area

2

0.2%

Red skin

2

0.2%

Reluctant Move

2

0.2%

Respiratory distress

2

0.2%

Restlessness

4

0.5%

Rhinitis

2

0.2%

Ring shaped Lesion

2

0.2%

Ruffled Appearance

2

0.2%

Runny nose

2

0.2%

Scabs On feet

2

0.2%

Scaly patches of skin

2

0.2%

Sensitivity to bright light

2

0.2%

Severe

2

0.2%

Severe kerititis

2

0.2%

Severe swellimg

2

0.2%

Shaking head

2

0.2%

Shallow breathing

2

0.2%

Sharp Feather

2

0.2%

Sheep often bites

2

0.2%

Short term lethargy

3

0.3%

Shortness of breath.

2

0.2%

Sickness

4

0.5%

Signs in rams

2

0.2%

Sinuses

2

0.2%

Skeleten abnormalities

2

0.2%

Skin color change

1

0.1%

Skin infection

2

0.2%

Skin irritation

2

0.2%

Skin rashes

4

0.5%

SkinAllergy

2

0.2%

Small red bumps

2

0.2%

Smell

2

0.2%

Smell of ammonia

2

0.2%

Sneezing

6

0.7%

Sores on lip

2

0.2%

Spines

2

0.2%

Straining

2

0.2%

Stripped remiges

2

0.2%

Strong cough

3

0.3%

Sudden death

4

0.5%

Swaying

2

0.2%

Swelling

9

1.0%

Swelling of udder

2

0.2%

Swelling on leg

5

0.6%

Swollen

6

0.7%

Swollen Belly

2

0.2%

Swollen left abdomen

2

0.2%

Swollen lymph nodes

3

0.3%

Tail Wagging

2

0.2%

Tear production

1

0.1%

Teeth griding

2

0.2%

Tenderness

4

0.5%

Thick Crusting

2

0.2%

Thicked skin

2

0.2%

Thivk skin

1

0.1%

Tremor

2

0.2%

Tremor of head and neck

2

0.2%

Tremors

2

0.2%

Ulcers

5

0.6%

Undigested in their feces

2

0.2%

Unsteady Gait

2

0.2%

Upset stomach

6

0.7%

Vomiting

2

0.2%

Wandering

2

0.2%

Watering

2

0.2%

Watering Diarrhea

2

0.2%

Watering of eyes

2

0.2%

Watery Diarrhea dispropotion

2

0.2%

Watery Eyes

2

0.2%

Weakness

6

0.7%

Wether restless

2

0.2%

Wheezing

2

0.2%

Wool is clumped

2

0.2%

burning ache or pain

2

0.2%

changed gait

4

0.5%

cough

2

0.2%

cough 

2

0.2%

difficulty swallowing

2

0.2%

egg production decreases

2

0.2%

extending its neck

2

0.2%

eye discharges

2

0.2%

feline infections

2

0.2%

fever

14

1.6%

haemorrhage

2

0.2%

head tilt

2

0.2%

lllthrift

4

0.5%

loss in weight

2

0.2%

loss of appetite

12

1.4%

nausea

2

0.2%

outstretched neck

2

0.2%

paresis

2

0.2%

stop eating

7

0.8%

sudden death

8

0.9%

sweating

4

0.5%

swelling

2

0.2%

swollen

2

0.2%

unable to urinate

2

0.2%

undernutrition

2

0.2%

wasting

20

2.3%

weakness

2

0.2%

weight loss

4

0.5%

df %>% tabyl(AnimalName)%>%
adorn_totals("row")%>%
adorn_pct_formatting() %>%
flextable() %>%
fontsize(size=14) %>%
autofit() %>%
theme_box()

AnimalName

n

percent

Birds

37

4.2%

Black-tailed deer

1

0.1%

Buffaloes

129

14.8%

Cattle

21

2.4%

Chicken

9

1.0%

Deer

38

4.4%

Dog

34

3.9%

Dogs

1

0.1%

Donkey

38

4.4%

Duck

56

6.4%

Elephant

59

6.8%

Elk

1

0.1%

Fowl

62

7.1%

Fox

7

0.8%

Fox

1

0.1%

Goat

26

3.0%

Goats

2

0.2%

Hamster

18

2.1%

Horse

10

1.1%

Hyaenas

1

0.1%

Lion

16

1.8%

Monkey

28

3.2%

Moos

1

0.1%

Mule deer

1

0.1%

Other Birds

6

0.7%

Pig

63

7.2%

Pigs

3

0.3%

Rabbit

11

1.3%

Reindeer

1

0.1%

Sheep

110

12.6%

Sika deer

1

0.1%

Tiger

17

2.0%

Turtle

4

0.5%

Wapiti

1

0.1%

White-tailed deer

1

0.1%

Wolves

1

0.1%

cat

36

4.1%

cattle

1

0.1%

chicken

4

0.5%

cow

3

0.3%

donkey

2

0.2%

duck

1

0.1%

horse

5

0.6%

mammal

1

0.1%

mules

1

0.1%

snake

1

0.1%

Total

871

100.0%

df %>% tabyl(Dangerous) %>%
ggplot(aes(x=Dangerous,y=n,fill=Dangerous)) + 
geom_col()

df %>% tabyl(Dangerous) %>%
ggplot(aes(x=Dangerous,y=n,fill=Dangerous)) + 
geom_col() +
labs(x="En Peligro", y="Frecuencia",title="Mascotas Enfermas")

df %>% tabyl(Dangerous) %>%
ggplot(aes(x=Dangerous,y=n,fill=Dangerous)) + 
geom_col() +
labs(x="En Peligro", y="Frecuencia",title="Mascotas Enfermas") +
geom_text(aes(label=n),vjust=1.5,col="black",fontface="bold")

df %>% tabyl(Dangerous) %>%
ggplot(aes(x=Dangerous,y=n,fill=Dangerous)) + 
geom_col() +
labs(x="En Peligro", y="Frecuencia",title="Mascotas Enfermas") +
geom_text(aes(label= sprintf("%.2f%%",100*percent) ),vjust=1.5,col="black",fontface="bold")

n=10000
numeros= rnorm(n=n,mean=20,sd=1)
df1=data.frame(numeros)
df1 %>% 
ggplot(aes(x=numeros)) + geom_histogram(color="black",fill="red3") +
labs(x="Numers",y="Frecuencia",title = "Campana de gauss")

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.