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(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v tibble  3.0.4     v purrr   0.3.4
## v tidyr   1.1.2     v stringr 1.4.0
## v readr   1.4.0     v forcats 0.5.0
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(readr)
Banco_Moma <- read_delim("https://raw.githubusercontent.com/DATAUNIRIO/Base_de_dados/master/arte_MOMA.csv", delim = ";")
## 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

Número de pinturas no Moma:

Banco_Moma %>%
  nrow()
## [1] 2253

Número de variáveis

Banco_Moma %>%
  ncol()
## [1] 24

As variáveis

cat(names(Banco_Moma))
## X1 title artist artist_bio artist_birth_year artist_death_year num_artists n_female_artists n_male_artists artist_gender year_acquired year_created circumference_cm depth_cm diameter_cm height_cm length_cm width_cm seat_height_cm purchase gift exchange classification department

Atividade 2

Ano da obtenção mais antiga do museu

Banco_Moma %>% 
  filter(year_acquired == min(year_acquired, na.rm = T)) %>% 
  filter(row_number() == 1) %>% 
  pull(year_acquired)
## [1] 1930

Quantidade de quadros obtidos naquele ano

Banco_Moma %>% 
  filter(year_acquired == min(year_acquired, na.rm = T)) %>% 
  nrow() 
## [1] 2

Nome da obra

Banco_Moma %>% 
  filter(year_acquired == min(year_acquired, na.rm = T)) %>% 
  pull(title) %>% 
  first()
## [1] "House by the Railroad"

e

Banco_Moma %>% 
  filter(year_acquired == min(year_acquired, na.rm = T)) %>% 
  pull(title) %>% 
  last()
## [1] "Seated Nude"

Pertencem respectivamente a

Banco_Moma %>% 
  filter(year_acquired == min(year_acquired, na.rm = T)) %>% 
  pull(artist) %>% 
  first()
## [1] "Edward Hopper"

e

Banco_Moma %>% 
  filter(year_acquired == min(year_acquired, na.rm = T)) %>% 
  pull(artist) %>% 
  last()
## [1] "Bernard Karfiol"

Atividade 3

Quadro mais antigo

Banco_Moma %>% 
  filter(year_created == min(year_created, na.rm = T)) %>% 
  pull(title)
## [1] "Landscape at Daybreak"

Nome do Artista

Banco_Moma %>% 
  filter(year_created == min(year_created, na.rm = T)) %>% 
  pull(artist)
## [1] "Odilon Redon"

Ano do quadro

cat(Banco_Moma$year_created, na.rm = T) %>%
  last()
## 1935 1929 1927 1919 1925 1919 1970 1929 1885 1930 1942 1953 1959 1962 1950 1926 1936 1932 1944 1937 1934 1950 1950 1914 1947 1889 1957 1961 1962 1964 1968 1994 1925 1926 1933 1940 1914 1959 1964 1965 1963 1929 1933 1934 1943 1914 1958 1958 1926 1953 1952 1953 1964 1961 1968 1960 1934 1929 1932 1941 1943 1948 1906 1957 1942 1957 1946 1968 1941 1899 1950 1910 1954 1962 1964 1950 1911 1933 1955 1957 1952 1964 1951 1951 1955 1955 1958 1959 1955 1938 1942 1954 1910 1957 1956 1934 1922 1953 1914 1922 1938 1941 1943 1947 1908 1918 1945 1958 1919 1939 1922 1959 1994 1932 1914 1951 1956 1917 1956 1995 1950 1947 1956 1897 1948 1950 1952 1914 1956 1909 1943 1953 1958 1902 1911 1921 1925 1938 1938 1917 1950 1915 1919 1948 1922 1958 1895 1936 1951 1957 1959 1931 1956 1933 1921 1928 1953 1954 1920 1913 1953 1956 1958 1958 1985 1984 1935 1946 1956 1985 1972 1970 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1940 1947 1935 1930 1938 1946 1925 1941 1950 1956 1986 1918 1953 1960 1951 1953 1956 1912 1941 1916 1936 1949 1913 1959 1970 1912 1970 1950 1928 1929 1950 1969 1929 1969 1974 1966 1981 1963 1994 1963 1966 1888 1963 1927 1924 1893 1948 1963 1947 1962 1947 1921 NA 1981 1966 1949 1980 1957 1978 1907 1979 1928 1960 1979 1976 1959 1979 1911 1988 1928 1944 1958 1911 1944 1919 1927 1942 1942 1911 1979 1976 1936 1894 1942 1942 1906 1879 1989 1962 1927 1960 1962 1960 1942 1949 1962 1962 1959 1927 1959 1978 1964 1946 1953 1959 1936 1915 1989 1985 1948 1962 1927 1946 1907 1962 1941 1948 1912 1961 1955 1905 1943 1905 1959 1909 1943 1946 1930 1957 1952 1917 1912 1942 1988 1928 1949 1957 1942 1890 1918 1913 1917 1912 1968 1947 1949 1957 1929 1932 1960 1923 1914 1923 1924 1965 1944 1957 1966 1923 1966 1929 1975 1949 1930 1932 1975 1911 1981 1949 1905 1961 1960 1957 1949 1925 1889 1975 1944 1949 1936 1908 1913 1944 1973 1943 1964 1965 1964 1981 1967 1961 1920 1964 1954 1931 1963 1965 1959 1981 1989 1935 1945 1964 1972 1981 1915 1957 1964 1972 1936 1950 1960 1960 1959 1989 1926 1973 1914 1963 1965 1968 1974 1919 1959 1960 1887 1963 1965 1972 1974 1918 1956 1947 1958 1961 1964 1959 1925 1965 1972 1914 1959 1960 1967 1975 1956 1963 1966 1968 1913 1945 1956 1918 1963 1938 1948 1961 1967 1930 1956 1960 1961 1998 1949 1949 1952 1909 1960 1916 1957 1888 1985 1992 1930 1900 1957 1973 1982 1961 1944 1944 1946 1932 1939 1958 1959 1984 1912 1969 1913 1921 1945 1957 1973 1929 1941 1955 1967 1985 1949 1957 1984 1918 1961 1941 1915 1979 1946 1956 1975 1940 1941 1951 1958 1893 1945 1911 1946 1927 1942 1907 1963 1929 1947 1976 1932 1941 1911 1926 1909 1919 1911 1913 1953 1940 1972 1997 1954 1971 1929 1921 1985 1925 1965 1985 1912 1914 1927 1961 1960 1912 1953 1931 1938 1950 1991 1941 1928 1950 1981 1925 1950 1941 1992 1930 1941 1922 1989 1943 1918 1920 1933 1966 1912 1939 1962 1911 1946 1962 1911 1913 1925 1926 1991 1956 1990 1980 1948 1947 1945 1986 1952 1955 1955 1962 1921 1915 1955 1955 1928 1971 1945 1888 1987 1992 1950 1915 1972 1977 1908 1954 1946 1928 1906 1986 1889 1971 1955 1952 1969 1954 1956 1961 1981 1972 1912 1988 1947 1965 1977 1992 1909 1965 1969 1965 1988 1928 1928 1981 1982 1960 1998 1957 1981 1950 1936 1968 1929 1950 1975 1970 1981 1984 1936 1959 1966 1982 1927 1922 1981 1958 1997 1963 1974 1875 1924 1875 1905 1900 1927 1883 1875 1913 1912 1936 1968 1907 1937 1952 1905 1918 1962 1967 1912 1912 1910 1928 1962 1934 1912 1933 1947 1946 1961 1975 1872 1929 1984 1900 1969 1973 1875 1971 1895 1962 1986 1875 1955 1962 1947 1963 1875 1910 1959 1990 1883 1946 1956 1954 1900 1928 1951 1900 1948 1910 1968 1907 1950 1951 1984 1913 1920 1968 1902 1955 1968 1968 1942 1957 1954 1927 1948 1915 1928 1953 1940 1952 1938 1910 1911 1947 1931 1953 1914 1953 1965 1923 1957 1963 1974 1924 1930 1966 1949 1962 1938 1920 1956 1910 1949 1950 1920 1940 1926 1964 1920 1921 1971 1936 1944 1934 1962 1925 1908 1948 1960 1944 1923 1983 1981 1886 1982 1929 1961 1948 1982 1892 1956 1926 1926 1912 1962 1981 1913 1981 1913 1961 1984 1973 1913 1944 1956 1963 1915 1929 1956 1956 1912 1948 1961 1987 1915 1951 1961 1937 1907 1907 1994 1918 1959 1908 1993 1945 1949 1906 1948 1931 1957 1982 1952 1953 1977 1961 1964 1956 1926 1964 1982 1994 1932 1885 1985 1916 1955 1973 1948 1961 1975 1979 1915 1912 1954 1955 1938 1949 1956 1947 1955 1927 1959 1956 1976 1972 1952 1964 1927 1961 1964 1910 1895 1981 1981 1935 1928 1914 1914 1985 1961 1928 1912 1926 1969 1952 1905 1956 1989 1946 1966 1962 1952 1944 1963 1941 1987 1932 1953 1954 1962 1925 1928 1912 1939 1942 1955 1962 1945 1942 1910 1912 1928 1945 1954 1941 1940 1935 1971 1946 1917 1938 1913 1940 NA 1950 1915 1985 1990 1982 1964 1982 1986 1995 1960 1915 1960 1965 1979 1972 1979 1986 1997 1960 1979 1958 1974 1978 1989 1969 1905 1979 1990 1961 1977 1940 1959 1882 1964 1907 1907 1985 1961 1989 1961 1943 1900 1952 1961 1964 1974 1983 1962 1965 1968 1968 1968 1968 1968 1968 1968 1971 1969 1968 1957 1983 1915 1960 1969 1960 1987 1934 1958 1986 1988 1942 1914 1948 1939 1986 1930 1960 1980 1931 1976 1899 1969 1916 1963 1939 1959 1937 1934 1962 1928 1915 1934 1912 1914 1916 1969 1952 1959 1955 1932 1910 1944 1954 1914 1960 1962 1960 1981 1982 1981 1950 1952 1958 1912 1978 1911 1961 1905 1953 1948 1981 1948 1964 1938 1979 1964 1938 1979 1958 1953 1934 1975 1941 1952 1983 1942 1949 1961 1945 1944 1981 1966 1981 1964 1958 1972 1921 1924 1994 1964 1953 1961 1976 1964 1980 1977 1968 1966 1938 1909 1946 1968 1971 1908 1976 1940 1987 1935 1962 1962 1997 1967 1926 1924 1999 1954 1979 1938 1984 1959 1940 1940 1950 1940 1917 1938 1921 1952 1962 1994 1907 1941 1962 1984 1962 1910 1956 1967 1915 1949 1953 1939 1977 1961 1931 1935 1907 1952 1946 1957 1931 1928 1978 1940 1889 1990 1964 1965 1996 1962 1950 1909 1941 1952 1950 1929 1939 1939 1927 1954 1943 1959 1964 1957 1937 1984 1954 1970 1979 1949 1968 1949 1911 1953 1963 1951 1932 1916 1939 1933 1964 1961 1962 1979 1888 1912 1964 1956 1976 1914 1985 1910 1914 1964 1964 1974 1915 1950 1960 1964 1982 1980 1922 1939 1985 1949 1925 1962 1974 1966 1964 1997 1952 1927 1963 1987 1977 1977 1966 1976 1965 1987 1942 1989 1966 1949 1914 NA 1966 1987 1946 1961 1949 1927 1928 1967 1951 1955 1944 1925 1939 1914 1953 1931 1949 1928 1952 1917 1916 1922 1954 1954 1926 1910 1910 1925 1911 1908 1939 1962 1942 1935 1960 1937 1963 1939 1970 1939 1934 1935 1939 1942 1905 1930 1908 1932 1964 1940 1937 1963 1956 1964 1892 1913 1922 1939 1889 1963 1943 1904 1939 1929 1891 1912 1898 1901 1963 1929 1963 1935 1944 1976 1947 1975 1950 1974 1942 1930 1951 1966 1976 1974 1932 1914 1914 1973 1964 1894 1966 1962 1964 1934 1950 1955 1937 1939 1980 1959 1963 1941 1942 1970 1932 1940 1946 1993 1959 1964 1962 1993 1961 1970 1930 1959 1932 1924 1951 1943 1957 1930 1964 1959 1961 1909 1976 1961 1975 1906 1942 1942 1960 1944 1966 1908 1944 1982 1942 1961 1946 1917 1954 1912 1928 1964 1971 1936 1964 1944 1937 1942 1914 1925 1967 1922 1933 1956 1930 1937 1937 1939 1913 1941 1928 1976 1930 1937 1946 1924 1897 1962 1983 1959 1961 1964 1943 1997 1939 1958 1940 1926 1964 1938 1909 1949 1958 1959 1958 1953 1944 1911 1938 1956 1947 1965 1933 1930 1948 1933 1966 1934 1967 1969 1961 1914 1967 1961 1958 1959 1958 1957 1960 1910 1907 1907 1910 1960 1961 1961 1907 1963 1960 1922 1938 1969 1962 1912 1948 1932 1966 1961 1935 1950 1988 1969 1983 1968 1961 1954 1968 1942 1912 1993 1977 1938 1908 1961 1905 1914 1993 1879 1992 1959 1958 1950 1959 1896 1933 1959 1920 1966 1957 1952 1967 1998 1936 1942 1927 1918 1943 1941 1964 1961 1942 1995 1986 1917 1943 1911 1890 1908 1940 1905 1968 1962 1909 1936 1939 1914 1912 1932 1915 1918 1916 1919 1917 1908 1906 1909 1941 1996 1921 1924 1932 1970 1912 1944 1983 1960 1978 1914 1967 1978 1979 1914 1917 1923 1944 1910 1935 1916 1913 1920 1978 1977 1977 1977 1977 1977 1977 1977 1977 1954 1977 1919 1977 1977 1977 1924 1977 1920 1979 1977 1977 1955 1923 1927 1968 1926 1937 1944 1929 1969 1926 1922 1911 1964 1950 1963 1933 1969 1930 1952 1913 1969 1969 1965 1965 1935 1973 1978 1941 1918 1965 1944 1944 1966 1931 1932 1916 1913 1927 1922 1950 1913 1972 1918 1960 1920 1951 1963 1921 1923 1935 1940 1949 1964 1963 1959 1914 1973 1913 1969 1951 1960 1970 1938 1924 1928 1969 1932 1930 1914 1917 1921 1939 1969 1969 1926 1927 1967 1959 1964 1955 1973 1956 1949 1928 1937 1968 1940 1943 1947 1949 1949 1948 1948 1950 1938 1946 1929 1937 1926 1962 1950 1972 1967 2001 2001 1953 1956 1933 1930 1931 1940 1928 1914 1914 1914 1915 1916 1938 1955 1977 1974 1937 1930 1945 1948 1964 1908 1942 1929 1937 1949 1948 1921 1923 1977 1958 1935 NA 1928 1969 1931 1989 1968 1940 1965 1970 1939 1942 1999 1962 1967 1960 1965 1945 1964 1942 1983 1923 1973 1893 1974 1973 1943 1932 1914 1914 1912 1912 1908 1950 1944 1944 1968 1936 1944 1967 1963 1963 1940 1931 1887 1929 1940 1940 1939 1965 1917 1937 1966 1966 1962 1965 1965 1965 1964 1964 1965 1967 1967 1909 1917 1950 1967 1966 1963 1955 1962 1912 1950 2000 1963 2001 2001 1962 1974 1968 2000 1962 1988 1992 1981 1991 1982 1975 1978 1976 1983 1986 1963 1988 1991 1973 1991 1986 1996 2001 1988 2002 1989 1903 1991 1976 2003 1996 1962 1914 2002 1963 1987 1987 1987 1987 1987 1987 1987 1987 1987 1987 1987 1987 1930 2004 1997 1960 1939 1938 1963 2003 1965 1991 2001 1996 1983 2003 1969 1961 1914 1943 1927 1964 1988 1976 2000 1964 2004 2005 1983 2005 2005 1963 1965 2004 2004 1955 2005 1963 2000 1963 1974 1997 1975 1981 1979 1971 1985 1959 1957 1957 1964 1966 2000 1984 1940 1965 1969 1975 1975 1976 1976 1976 1979 1968 1973 1970 1971 1983 1985 1986 1997 1992 1974 1976 1978 1984 2002 1976 1979 1976 2001 1999 2004 1952 2005 1994 1977 1978 2005 2005 2005 1963 1910 2005 2005 2005 2005 2005 2005 2005 2005 2005 1972 1972 2003 2003 1968 1968 1960 1967 1972 1981 1961 2006 2006 1987 1966 2006 1961 2002 2002 1968 1957 1965 1927 1953 2006 1911 1987 1957 2008 2008 1925 1925 1924 1925 1928 1927 1927 1928 1925 1927 1927 1926 1924 1926 1928 1926 1926 1924 1925 1927 1928 1928 1925 1925 1959 1996 1925 1975 2008 2008 2008 1958 2000 2005 1981 1967 1925 2008 1960 1962 2000 1952 2008 2001 1970 1997 2008 1992 2008 2008 2009 2004 2008 2008 2008 2008 1974 1984 1984 1984 1984 1984 1984 1984 NA 1984 1984 1984 1984 1984 1984 1984 1971 1966 1995 2008 2008 1995 1964 1984 1961 1974 1974 1966 1984 1984 2007 1948 2008 1963 2009 1974 2009 1967 1963 1965 1966 1949 1984 1955 2010 1974 2008 1974 2008 2008 2002 2006 1951 1966 1968 1970 1966 1970 1967 1972 1968 1966 1968 1968 1971 1923 1912 1925 2011 1983 1989 1984 2009 2010 1993 2010 1954 2011 2009 1926 2011 1959 2011 2011 1975 1957 2011 2011 2011 2011 1992 2000 2012 1994 1959 1974 2012 1988 2007 1976 1991 1980 1980 1980 2011 2012 1966 1960 1975 1969 2013 2013 2008 1963 2013 2013 2013 1967 1969 2012 2013 1975 2013 2014 2009 2005 2000 1998 1980 2013 1976 1991 2013 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 1974 2014 2002 2013 2008 2013 2013 2014 1968 1977 1981 1979 2013 1940 1965 1973 1974 2007 1965 2014 2014 2011 1977 1987 1974 1976 1979 2015 2012 2015 2015 1967 2007 1941 1979 2015 2014 1965 1952 1949 1961 1963 1972 1955 1954 1955 1953 1962 1960 1965 1961 1964 2014 1970 1907 2006 2000 1987 1977 1969 2015 1966 2017 1972 1976 2016 1978 2010 2015 2016 2017 TRUE
## NULL

Atividade 4

Número de artistas

Banco_Moma %>% 
  count(artist) %>% 
  count() %>% 
  pull(n)
## [1] 989

Atividade 5

Artista com mais quadros

Banco_Moma %>% 
        count(artist) %>% 
        arrange(-n) %>% 
        pull(artist) %>% 
        first()
## [1] "Pablo Picasso"

Atividade 6

Quantidade de quadros desse artista

Banco_Moma %>% 
  count(artist) %>% 
  arrange(-n) %>% 
  pull(n) %>% 
  first()
## [1] 55

Atividade 7

Quantitativo obras por gênero

Banco_Moma %>%
  count(artist_gender) %>%
  mutate(n = as.character(paste(n, "pinturas")))
## # A tibble: 3 x 2
##   artist_gender n            
##   <chr>         <chr>        
## 1 Female        252 pinturas 
## 2 Male          1991 pinturas
## 3 <NA>          10 pinturas

Atividade 8

Quantitativo pinturas por gênero

Banco_Moma %>%
  count(artist_gender, artist) %>% 
  count(artist_gender) %>% 
  mutate(n = as.character(paste(n, "artistas")))
## # A tibble: 3 x 2
##   artist_gender n           
##   <chr>         <chr>       
## 1 Female        143 artistas
## 2 Male          837 artistas
## 3 <NA>          9 artistas

Atividade 9

Número de Pinturas

Banco_Moma %>% 
  count(year_acquired) %>% 
  arrange(-n) %>% 
  pull(n) %>% 
  first()
## [1] 86

Ano de compra

Banco_Moma %>% 
count(year_acquired) %>% 
  arrange(-n) %>% 
  pull(year_acquired) %>% 
  first()
## [1] 1985

Atividade 10

Quantidade de obras criadas no ano de maior incidência

Banco_Moma %>% 
  count(year_created) %>% 
  arrange(-n) %>% 
  pull(n) %>% 
  first()
## [1] 57

Ano de maior incidência

Banco_Moma %>% 
  count(year_created) %>% 
  arrange(-n) %>% 
  pull(year_created) %>% 
  first()
## [1] 1977

Atividade 11

Ano da primeira obra feminina adquirida

Banco_Moma %>% 
  filter(artist_gender == "Female") %>% 
  arrange(year_acquired) %>% 
  pull(year_acquired) %>% 
  first()
## [1] 1937

O seu título

Banco_Moma %>% 
  filter(artist_gender == "Female") %>% 
  arrange(year_acquired) %>% 
  pull(title) %>% 
  first()
## [1] "Landscape, 47"

Feita por

Banco_Moma %>% 
  filter(artist_gender == "Female") %>% 
  arrange(year_acquired) %>% 
  pull(artist) %>% 
  first()
## [1] "Natalia Goncharova"

No ano de

Banco_Moma %>% 
  filter(artist_gender == "Female") %>% 
  arrange(year_acquired) %>% 
  pull(year_created) %>% 
  first()
## [1] 1912

Atividade 12

Artista que mais viveu

Banco_Moma %>% 
  mutate(idade = artist_death_year - artist_birth_year) %>% 
  arrange(-idade) %>% 
  pull(artist) %>% 
  first()
## [1] "Dorothea Tanning"

Idade

Banco_Moma %>% 
  mutate(idade = artist_death_year - artist_birth_year) %>% 
  arrange(-idade) %>% 
  pull(idade) %>% 
  first()
## [1] 102

Atividade 13

Média de idade

Banco_Moma %>% 
  mutate(i = artist_death_year - artist_birth_year) %>% 
  summarise(m = mean(i, na.rm = T)) %>% 
  pull(m) %>% 
  format(., digits = 1)
## [1] "75"

Atividade 14

Banco_Moma %>%
  mutate(i = artist_death_year - artist_birth_year) %>%
  group_by(artist_gender) %>%
  summarise(m = mean(i, na.rm = T)) %>% 
  mutate(m = format(m, digits = 2))
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 3 x 2
##   artist_gender m    
##   <chr>         <chr>
## 1 Female        74   
## 2 Male          75   
## 3 <NA>          72