#Carregando a base de dados

library(readr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(ggthemes)
arte_MOMA <- read_delim("C:/Users/Usuario/Desktop/Base_de_dados-master/arte_MOMA.csv", 
                        ";", escape_double = FALSE, trim_ws = TRUE)
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   .default = col_double(),
##   title = col_character(),
##   artist = col_character(),
##   artist_bio = col_character(),
##   artist_gender = col_character(),
##   circumference_cm = col_logical(),
##   depth_cm = col_number(),
##   diameter_cm = col_logical(),
##   height_cm = col_number(),
##   length_cm = col_logical(),
##   width_cm = col_number(),
##   seat_height_cm = col_logical(),
##   purchase = col_logical(),
##   gift = col_logical(),
##   exchange = col_logical(),
##   classification = col_character(),
##   department = col_character()
## )
## i Use `spec()` for the full column specifications.

#Atividade 1

sum(complete.cases(arte_MOMA$X1))
## [1] 2253
ncol(arte_MOMA)
## [1] 24

#Atividade 2

arte_MOMA[33:33,c("year_acquired","artist","title")]
## # A tibble: 1 x 3
##   year_acquired artist        title                
##           <dbl> <chr>         <chr>                
## 1          1930 Edward Hopper House by the Railroad

#Atividade 3

arte_MOMA[697:697,c("year_created","artist","title")] 
## # A tibble: 1 x 3
##   year_created artist       title                
##          <dbl> <chr>        <chr>                
## 1         1872 Odilon Redon Landscape at Daybreak

#Atividade 4

summary(arte_MOMA$artist)
##    Length     Class      Mode 
##      2253 character character
length(unique(arte_MOMA$artist))
## [1] 989

#Atividade 5

#Atividade 6

#Atividade 7

table(arte_MOMA$artist_gender)
## 
## Female   Male 
##    252   1991

#Atividade 8

art_femin <- arte_MOMA %>% filter(artist_gender=="Female")
length(unique(art_femin$artist))
## [1] 143
art_masc <- arte_MOMA %>% filter(artist_gender=="Male")
length(unique(art_masc$artist))
## [1] 837

#Atividade 9 1985 com 86 pinturas

sort(table(arte_MOMA$year_acquired))
## 
## 1932 1930 1931 2003 1946 1972 1989 1993 1938 1988 1948 1974 1987 2001 1995 2007 
##    1    2    2    4    5    7    7    7    8    8   11   11   11   11   13   13 
## 1934 1947 1945 1984 1986 1973 1944 1977 2017 1936 1940 1957 2010 1937 1976 1952 
##   14   14   15   15   15   16   17   17   17   18   18   18   18   19   19   20 
## 1968 1980 1982 2014 1962 1978 1997 2006 2009 2015 1935 1943 1953 2013 1950 1966 
##   20   20   20   20   21   21   21   21   21   21   22   22   22   22   23   23 
## 1981 1975 1999 2002 1990 1998 1951 2004 2011 2012 1971 1949 2000 1954 1983 1992 
##   23   24   24   25   26   26   27   27   27   27   28   29   29   30   30   30 
## 1939 1963 1996 2016 1960 1955 1964 1959 1970 1965 1941 1958 1994 1956 1961 1969 
##   31   33   33   33   34   36   36   37   37   38   39   39   41   42   45   45 
## 2008 1967 1991 2005 1942 1979 1985 
##   55   65   67   67   71   71   86

#Atividade 10 1977 com 57 pinturas

sort(table(arte_MOMA$year_created))
## 
## 1872 1882 1886 1891 1896 1898 1901 1903 1904 1879 1883 1885 1887 1890 1892 1894 
##    1    1    1    1    1    1    1    1    1    2    2    2    2    2    2    2 
## 1897 1899 1902 2016 2017 1893 1895 1999 1888 1998 2007 2010 1889 1990 1995 2003 
##    2    2    2    2    2    3    3    3    4    4    4    4    5    5    5    5 
## 2012 1875 1900 1906 1993 1996 2004 2006 2009 2015 2002 2014 2001 1919 1991 1992 
##    5    6    6    6    6    6    6    6    6    6    7    7    8    9    9    9 
## 1994 1980 1997 2000 1905 1916 1920 1923 1988 2011 1909 1986 1989 1918 1921 1922 
##    9   10   10   10   11   11   11   11   11   11   12   12   12   13   13   13 
## 1931 1933 1934 1945 1971 1978 1982 1983 2013 1908 1917 1924 1907 1936 1985 1935 
##   13   13   13   13   13   13   13   13   13   14   14   14   15   15   15   16 
## 1951 1973 1970 1910 1915 1937 1943 1947 1911 1972 1975 2005 1913 1930 1932 1929 
##   16   16   17   18   18   18   18   18   19   19   19   19   21   21   21   22 
## 1946 2008 1926 1954 1979 1938 1941 1987 1925 1948 1939 1958 1967 1974 1976 1927 
##   22   22   23   23   23   24   24   24   25   25   26   26   26   26   26   27 
## 1952 1953 1981 1944 1955 1969 1942 1984 1928 1949 1957 1912 1956 1965 1966 1914 
##   27   27   27   28   28   29   31   31   32   32   32   33   34   36   36   37 
## 1950 1960 1968 1959 1963 1962 1961 1940 1964 1977 
##   37   39   40   42   44   49   50   56   56   57

#Atividade 11

#Atividade 12

#Atividade 13

#Atividade 14