Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OSSベースでのRパッケージ開発のすすめ / rjpusers2021rpkgdev

Uryu Shinya
December 18, 2021

OSSベースでのRパッケージ開発のすすめ / rjpusers2021rpkgdev

2021年12月18日開催「2021年度 データ解析環境Rの整備と利用」 https://rjpusers.connpass.com/event/233211/

Uryu Shinya

December 18, 2021
Tweet

More Decks by Uryu Shinya

Other Decks in Research

Transcript

  1. jpmesh ɹύοέʔδ঺հ jpndistrict ʙ      ssrn

    fgdr zipangu sudachir tabularmaps kuniezu oEmbed colorinfo washoku jmastats textlintr sealr easyestat ma ff census wakatimer CRANొ࿥ޙɺ࡟আ CRANొ࿥ࡁΈ jpops kuniumi r2hue 
  2. ⁞ίϛϡχςΟɺݚڀ΁ͷߩݙ > R is free software distributed under a GNU-style

    copyleft. IUUQTTWOSQSPKFDUPSH3 IUUQTCVHTSQSPKFDUPSH IUUQTHJUIVCDPNSTUVEJPSTUVEJP 044Ͱ͋Δ͜ͱ͸3ίϛϡχςΟͷจԽͱͯ͠ී௨ 
  3. ⁠։ൃҙཉͷҡ࣋ ͜·ΊͳΞ΢τϓοτ͕ηʔϒϙΠϯτͱͳΔ ֎෦΁ൃදɾࠂ஌ ڏແײ (JU)VC(JU-BCͰͷެ։ ࠳ં͢ΔڪΕ ݽಠ ࣗ༝ʹ ޷͖ͳ΋ͷΛ 5X

    JUUFS ˠ$3"/ొ࿥ͤͣʹར༻ͯ͠΋Β͑Δ 5PLZP3ͳͲͷίϛϡχςΟ ϒ ϩ ά ϑΟʔυόοΫΛಘ΍͍͢ 044 ݸਓ΋͘΋͘ 
  4. KQNFTI ඪ४஍ҬϝογϡΛѻ͏ ,VCP 5 6SZV 4FUBM .PCJMFQIPOFOFUXPSLEBUBSFWFBMOBUJPOXJEFFDPOPNJDWBMVFPGDPBTUBMUPVSJTNVOEFSDMJNBUFDIBOHF 5PVSJTN.BOBHFNFOU  

    IUUQTEPJPSHKUPVSNBO library(jpmesh) meshcode(5133) # 80km #> <meshcode[1]> #> [1] 5133 meshcode(5133778300, .type = "subdivision") #> <subdiv_meshcode[1]> #> [1] 5133778300 mesh_to_coords(51337783) #> # A tibble: 1 × 5 #> meshcode lng_center lat_center lng_error lat_error #> <meshcode> <dbl> <dbl> <dbl> <dbl> #> 1 51337783 134. 34.7 0.00625 0.00417 coords_to_mesh(133, 34) #> <meshcode[1]> #> [1] 51330000 # Scale down mesh_convert("52350432", 0.500) #> <meshcode[4]> #> [1] 523504321 523504322 523504323 523504324 # Find out neighborhood meshes meshcode(5133) %>% neighbor_mesh(contains = TRUE) #> <meshcode[9]> #> [1] 5032 5033 5034 5132 5133 5134 5232 5233 5234
  5. [JQBOHV ೔ຊޠपΓͷ໰୊Λղܾ͢ΔศརͳػೳΛఏڙ IUUQTHJUIVCDPNVSJCP[JQBOHVJTTVFT library(zipangu) convert_jyear("R3") #> [1] 2021 convert_jdate("ྩ࿨̏೥12݄18೔") #>

    [1] "2021-12-18" # ॕ೔ͷ൑ఆ #ʢఱߖ஀ੜ೔ɺΦϦϯϐοΫؔ܎ͷΧϨϯμʔͷมߋʹ΋ରԠʣ is_jholiday("2018-12-24") #> [1] TRUE is_jholiday("2021-12-24") #> [1] FALSE is_jholiday("2022-01-10") #> [1] TRUE kansuji2arabic(c("Ұ", "ඦ")) #> [1] "1" "100" # ฦΓ஋Λ਺஋ kansuji2arabic(c("Ұ", "ඦ"), convert = FALSE) #> [1] 1 100 # Nipponύοέʔδʹͳ͔ͬͨؔ਺ separate_address("౦ژ౎ઍ୅ా۠େखொҰஸ໨") #> $prefecture #> [1] "౦ژ౎" #> #> $city #> [1] "ઍ୅ా۠" #> #> $street #> [1] "େखொҰஸ໨" harmonize_prefecture_name( c("౦ژ", "๺ւಓ", "ԭೄ"), to = "long") #> [1] "౦ژ౎" "๺ւಓ" "ԭೄݝ" 
  6. KNBTUBUT ୆෩ ؾ৅ிͷσʔλΛऔಘɾ੔ܗͯ͠ఏڙ # ਒౓σʔλϕʔε ਒౓Ϧετ read_eqdb_csv(path = "਒ݯɾ਒౓Ϧετ.csv") #>

    #> ஍਒ͷ֓ཁ #> x ൃੜ೔࣌: 2021-11-09 01:14:57 #> x ਒ԝ஍໊: ෱ౡݝத௨Γ #> • Ң౓: 37°03.7′N #> • ܦ౓: 140°35.0′E #> ! ਂ͞: 6 km #> ! Ϛάχνϡʔυ: 4.9 #> ! ࠷େ਒౓: ਒౓̐ #> # A tibble: 472 × 4 #> ౎ಓ෎ݝ ਒౓ ؍ଌ఺໊ ؾ৅ிͷ਒౓؍ଌ఺ #> <chr> <chr> <chr> <lgl> #> 1 ෱ౡݝ 4 ݹ఼ொদ઒ԣ઒ TRUE #> 2 ෱ౡݝ 4 ݹ఼ொদ઒৽܂ݪ FALSE #> 3 ෱ౡݝ 3 ఱӫଜԼদຊ FALSE #> 4 ෱ౡݝ 3 ୨૔ொ୨૔தډ໺ TRUE #> 5 ෱ౡݝ 3 伸઒ଜ੺ࡔத໺ FALSE #> 6 ෱ౡݝ 3 ੴ઒ொ௕ٱอ FALSE #> 7 ෱ౡݝ 3 ۄ઒ଜখߴ FALSE #> 8 ෱ౡݝ 3 ઙ઒ொઙ઒ FALSE #> 9 ෱ౡݝ 3 ͍Θ͖ࢢࡾ࿨ொ TRUE #> 10 ෱ౡݝ 2 ܊ࢁࢢே೔ TRUE #> # … with 462 more rows library(jmastats) # ஍఺ؾ৅σʔλ jma_collect(item = "hourly", block_no = 47646, year = 2021, month = 11, day = 27) # ۙ๣ͷؾ৅؍ଌ஍఺ͷݕࡧ nearest_station(longitude = 140.112, latitude = 36.083) #> Simple feature collection with 1 feature and 5 fields #> Geometry type: POINT #> Dimension: XY #> Bounding box: xmin: 140.125 ymin: 36.05667 xmax: 140.125 ymax: 36.05667 #> Geodetic CRS: WGS 84 #> # A tibble: 1 × 6 #> area station_no station_name block_no distance geometry #> <chr> <int> <chr> <chr> [m] <POINT [°]> #> 1 Ἒ৓ 40336 ͭ͘͹ 47646 3153. (140.125 36.05667) ைҐ ஍਒ 
  7. ݚڀऀʹקΊ͍ͨύοέʔδͷछྨ छྨ ֶज़ݚڀͷଆ໘ ඞཁͳٕज़ྗ ύοέʔδྫ ղੳख๏ͷ࣮૷ ଟ͍ গͳ͍ʙଟ͍ TVEBDIJS TTSO

    XBTIPLV σʔλ੔ܗɾՃ޻ ී௨ ී௨ʙଟ͍ KQNFTI GHES [JQBOHV ՄࢹԽ গͳ͍ ଟ͍ UBCVMBNBQT ੾Γޱ͸ଟ༷ɻ՝୊ʹదͨ͠ύοέʔδͷछྨ͕͋Δ