{"id":1713,"date":"2017-01-13T16:02:28","date_gmt":"2017-01-13T07:02:28","guid":{"rendered":"http:\/\/www.con3.com\/rinlab\/?p=1713"},"modified":"2019-07-02T20:50:22","modified_gmt":"2019-07-02T11:50:22","slug":"r%e3%81%a7pisa2015%e3%80%88%e3%81%9d%e3%81%ae2%e3%80%89","status":"publish","type":"post","link":"https:\/\/www.con3.com\/rinlab\/?p=1713","title":{"rendered":"R\u3067PISA2015\u3008\u305d\u306e2\u3009"},"content":{"rendered":"<p>\u300c<a href=\"http:\/\/www.con3.com\/rinlab\/?p=1652\" target=\"_blank\" rel=\"noopener noreferrer\">R\u3067PISA2015<\/a>\u300d\u3068\u3044\u3046\u30a8\u30f3\u30c8\u30ea\u30fc\u3067\u3001\u3044\u304f\u3064\u304b\u306eWeb\u8a18\u4e8b\u306b\u89e6\u767a\u3055\u308c\u3066\u3001OECD\u3068\u3044\u3046\u56fd\u969b\u6a5f\u95a2\u304c\uff13\u5e74\u9593\u9694\u3067\u884c\u306a\u3063\u3066\u3044\u308b\u56fd\u969b\u5b66\u529b\u8abf\u67fb\u300cPISA\u300d\u306e2015\u5e74\u5b9f\u65bd\u30c7\u30fc\u30bf\u3092\u3001\u7d71\u8a08\u5411\u3051\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u300cR\u300d\u3092\u4f7f\u3063\u3066\u89e6\u308a\u59cb\u3081\u305f\u3053\u3068\u3092\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>R\u8a00\u8a9e\u306e\u57fa\u790e\u77e5\u8b58\u304c\u7121\u3044\u307e\u307e\u3001\u30b5\u30f3\u30d7\u30eb\u3092\u898b\u69d8\u898b\u771f\u4f3c\u3067\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u304b\u3089\u30b0\u30e9\u30d5\u306e\u63cf\u753b\u307e\u3067\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u307e\u3060\u307e\u3060\u672a\u5b8c\u6210\u72b6\u614b\u3067\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u5f8c\u3001R\u8a00\u8a9e\u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u66f8\u7c4d\u3092\u8cfc\u5165\u3057\u305f\u4e0a\u3067\u3001\u3055\u3089\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4fee\u6b63\u3057\u3001\u601d\u3044\u63cf\u3044\u3066\u3044\u305f\u30b0\u30e9\u30d5\u3092\u4e00\u901a\u308a\u63cf\u3051\u308b\u3068\u3053\u308d\u307e\u3067\u8fbf\u308a\u7740\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"http:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/0f414cf410efaabb5ec12ecddeb352c8-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1722 size-medium\" src=\"http:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/0f414cf410efaabb5ec12ecddeb352c8-1-276x300.jpg\" alt=\"PISA2015_IC013Q12NA\u306e\u30b0\u30e9\u30d5\" width=\"276\" height=\"300\" srcset=\"https:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/0f414cf410efaabb5ec12ecddeb352c8-1-276x300.jpg 276w, https:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/0f414cf410efaabb5ec12ecddeb352c8-1-768x835.jpg 768w, https:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/0f414cf410efaabb5ec12ecddeb352c8-1-941x1024.jpg 941w, https:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/0f414cf410efaabb5ec12ecddeb352c8-1.jpg 1848w\" sizes=\"auto, (max-width: 276px) 100vw, 276px\" \/><\/a><\/p>\n<p>&#8212;<\/p>\n<p>\u4f5c\u6210\u4e2d\u6c17\u306b\u306a\u3063\u3066\u3044\u305f\u3053\u3068\u306e\u4e00\u3064\u3068\u3057\u3066\u3001PISA2015\u30c7\u30fc\u30bf\u3092\u65e5\u672c\u8a9e\u3067\u6271\u3046\u305f\u3081\u306e\u60c5\u5831\u304c\u3001<a href=\"http:\/\/www.akashi.co.jp\/news\/n3896.html\" target=\"_blank\" rel=\"noopener noreferrer\">\u660e\u77f3\u66f8\u5e97<\/a>\u767a\u884c\u306ePISA\u6b63\u898f\u5831\u544a\u66f8\uff08\u6709\u511f\uff09\u3057\u304b\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>PISA2015\u95a2\u9023\u306e\u60c5\u5831\u306b\u3064\u3044\u3066\u306f\u3001\u300c<a href=\"http:\/\/ict.edufolder.jp\/archives\/1135\" target=\"_blank\" rel=\"noopener noreferrer\">PISA2015\u95a2\u9023<\/a>\u300d\uff08ICT\u306e\u3042\u308b\u5b66\u3073\uff09\u306b\u307e\u3068\u3081\u3066\u304a\u304d\u307e\u3057\u305f\u304c\u3001\u65e5\u672c\u8a9e\u7248\u3092\u4f5c\u6210\u3057\u3066\u8abf\u67fb\u5354\u529b\u3092\u3057\u305f<a href=\"http:\/\/www.nier.go.jp\/kokusai\/pisa\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u56fd\u7acb\u6559\u80b2\u653f\u7b56\u7814\u7a76\u6240\u306eWeb\u30da\u30fc\u30b8<\/a>\u3067\u3055\u3048\u5831\u9053\u6a5f\u95a2\u5411\u3051\u30ec\u30d9\u30eb\u306e\u516c\u8868\u8cc7\u6599\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u3060\u3051\u3067\u3001PISA\u306b\u95a2\u3059\u308b\u6b63\u898f\u306e\u65e5\u672c\u8a9e\u60c5\u5831\u306f\u660e\u77f3\u66f8\u5e97\u304c\u5951\u7d04\u3057\u3066\u767a\u884c\u3057\u3066\u3044\u308b\u65e5\u672c\u8a9e\u7248\u5831\u544a\u66f8\u304f\u3089\u3044\u3057\u304b\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u80cc\u666f\u6307\u6a19\u3092\u5f97\u308b\u8cea\u554f\u8abf\u67fb\uff08ICT\u6d3b\u7528\u8abf\u67fb\u3092\u542b\u3080\uff09\u306e\u65e5\u672c\u8a9e\u306f\u3001\u8ca9\u58f2\u3055\u308c\u3066\u3044\u308b\u5831\u544a\u66f8\u3092\u624b\u306b\u5165\u308c\u306a\u3044\u3068\u77e5\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u3044\u304f\u3064\u304b\u306eWeb\u8a18\u4e8b\u3067\u5206\u6790\u30fb\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308b\u8abf\u67fb\u7d50\u679c\u306e\u8cea\u554f\u3084\u56de\u7b54\u306e\u6587\u7ae0\u306f\u3001OECD\u304cWeb\u30b5\u30a4\u30c8\u3067\u7121\u511f\u516c\u958b\u3057\u3066\u3044\u308b\u82f1\u8a9e\u7248\u5831\u544a\u66f8\u3092\u5404\u81ea\u3067\u7ffb\u8a33\u3057\u3066\u3044\u308b\u72b6\u614b\u3067\u3059\u3002<\/p>\n<p>PISA\u306e\u8da3\u65e8\u3084\u76ee\u7684\u304b\u3089\u3059\u308c\u3070\u3001\u8abf\u67fb\u7d50\u679c\u3092\u3082\u3068\u306b\u5404\u56fd\u306e\u6559\u80b2\u653f\u7b56\u306b\u95a2\u3059\u308b\u8b70\u8ad6\u304c\u69d8\u3005\u306b\u8a98\u767a\u3055\u308c\u308b\u3053\u3068\u304c\u5927\u4e8b\u3067\u3042\u308b\u306b\u3082\u95a2\u308f\u3089\u305a\u3001\u65e5\u672c\u306e\u5834\u5408\u3001\u3069\u3046\u3057\u3066\u3082\u65e5\u672c\u8a9e\u8981\u7d04\u3055\u308c\u305f\u5831\u9053\u767a\u8868\u7bc4\u56f2\u306e\u9650\u3089\u308c\u305f\u8a71\u984c\u3057\u304b\u6271\u308f\u308c\u305a\u3001\u305d\u308c\u4ee5\u5916\u306f\u82f1\u8a9e\u539f\u6587\u304b\u6709\u511f\u306e\u65e5\u672c\u8a9e\u7248\u5831\u544a\u66f8\u3092\u5f97\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u58c1\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u3088\u3046\u306b\u8abf\u67fb\u306e\u751f\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3057\u3066\u8996\u899a\u5316\u3059\u308b\u969b\u3082\u3001\u8cea\u554f\u6587\u3084\u56de\u7b54\u9078\u629e\u80a2\u6587\u3092\u65e5\u672c\u8a9e\u3067\u8868\u793a\u3057\u305f\u65b9\u304c\u5727\u5012\u7684\u306b\u7406\u89e3\u304c\u3057\u3084\u3059\u3044\u308f\u3051\u3067\u3059\u304c\u3001\u305d\u306e\u305f\u3081\u306e\u30ea\u30bd\u30fc\u30b9\u306f\u30cd\u30c3\u30c8\u4e0a\u306b\u5b58\u5728\u3057\u307e\u305b\u3093\u3002<\/p>\n<p>\u65e5\u672c\u8a9e\u306b\u3088\u308bPISA\u8abf\u67fb\u4f5c\u696d\u91cf\u306e\u5927\u5909\u3055\u3068\u305d\u308c\u3092\u62c5\u308f\u308c\u3066\u3044\u308b\u95a2\u4fc2\u8005\u306e\u52b4\u529b\u306b\u306f\u656c\u610f\u3092\u6301\u3061\u307e\u3059\u3057\u3001\u305d\u308c\u3092\u8e0f\u307e\u3048\u3066\u767a\u884c\u3055\u308c\u308b\u65e5\u672c\u8a9e\u5831\u544a\u66f8\u304c\u6709\u511f\u8ca9\u58f2\u3055\u308c\u308b\u3053\u3068\u306f\u7406\u89e3\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3001\u3082\u3046\u5c11\u3057\u793e\u4f1a\u7684\u306a\u8b70\u8ad6\u304c\u9032\u3080\u3088\u3046\u7121\u511f\u90e8\u5206\u306e\u60c5\u5831\u6d41\u901a\u91cf\u3092\u5897\u3084\u3059\u52aa\u529b\u3082\u5fc5\u8981\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u5c11\u306a\u304f\u3068\u3082\u8abf\u67fb\u30c7\u30fc\u30bf\u3092\u81ea\u524d\u3067\u51e6\u7406\u3059\u308b\u969b\u306b\u4f7f\u3048\u308b\u30ea\u30bd\u30fc\u30b9\u306f\u6b32\u3057\u3044\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>&#8212;<\/p>\n<p>\u305d\u3053\u3067\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u51e6\u7406\u3059\u308b\u969b\u306b\u4f7f\u3048\u308b\u3088\u3046PISA2015\u306b\u304a\u3051\u308b\u300c\u56fd\u5225\u30b3\u30fc\u30c9\u3068\u56fd\u540d\u300d\u300cICT\u6d3b\u7528\u8abf\u67fb\u306e\u8cea\u554f\u6587\u300d\u300cICT\u6d3b\u7528\u8abf\u67fb\u306e\u56de\u7b54\u9078\u629e\u80a2\u6587\u300d\u3092csv\u30d5\u30a1\u30a4\u30eb\u306b\u3057\u3066\u304a\u304d\u307e\u3057\u305f\u3002<\/p>\n<pre>\u56fd\u5225\u30b3\u30fc\u30c9\u3068\u56fd\u540d\n\uff08csv\uff09<a href=\"http:\/\/www.edufolder.jp\/files\/pisa2015\/ISO3166_pisa.csv\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.edufolder.jp\/files\/pisa2015\/ISO3166_pisa.csv<\/a>\n\uff08xlsx\uff09<a href=\"http:\/\/www.edufolder.jp\/files\/pisa2015\/ISO3166_pisa.xlsx\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.edufolder.jp\/files\/pisa2015\/ISO3166_pisa.xlsx<\/a>\nICT\u6d3b\u7528\u8abf\u67fb\u306e\u8cea\u554f\u6587\n\uff08csv\uff09<a href=\"http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_ICT_Familiarity_Questionnaire.csv\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_ICT_Familiarity_Questionnaire.csv<\/a>\n\uff08xlsx\uff09<a href=\"http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_ICT_Familiarity_Questionnaire.xlsx\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_ICT_Familiarity_Questionnaire.xlsx<\/a>\nICT\u6d3b\u7528\u8abf\u67fb\u306e\u56de\u7b54\u9078\u629e\u80a2\u6587\n\uff08csv\uff09<a href=\"http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_ICT_Familiarity_Questionnaire_answercode.csv\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_ICT_Familiarity_Questionnaire_answercode.csv<\/a>\n\uff08xlsx\uff09<a href=\"http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_ICT_Familiarity_Questionnaire_answercode.xlsx\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_ICT_Familiarity_Questionnaire_answercode.xlsx<\/a><\/pre>\n<p>\uff08csv\u5f62\u5f0f\u306e\u65b9\u306f\uff09UTF-8\u30b3\u30fc\u30c9\u3067\u65e5\u672c\u8a9e\u3082\u542b\u3081\u3066\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u82f1\u6587\u3068\u65e5\u672c\u6587\u3092\u5207\u308a\u66ff\u3048\u3066\u5229\u7528\u3059\u308b\u306e\u306b\u3082\u4fbf\u5229\u3067\u3059\u3002\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u89e3\u8aac\u306f\u4eca\u56de\u7701\u7565\u3057\u307e\u3059\uff08\u3054\u3081\u3093\u306a\u3055\u3044\uff09\u3002<\/p>\n<p>\uff08\u4fee\u6b6320170116\uff1a\u300c\u301c\u300d\u3092\u300c-\u300d\u306b\u4fee\u6b63\u3057\uff0cxlsx\u5f62\u5f0f\u3082\u7528\u610f\u3057\u307e\u3057\u305f\u3002\uff09<\/p>\n<p>\u3061\u306a\u307f\u306b\uff0cOECD\u304c\u7528\u610f\u3057\u3066\u3044\u308b\u30b3\u30fc\u30c9\u8868\u306f\u300c<a href=\"http:\/\/www.oecd.org\/pisa\/data\/2015database\/Codebook_CMB.xlsx\" target=\"_blank\" rel=\"noopener noreferrer\">Codebooks for the main files<\/a>\u300d\u3068\u3057\u3066<a href=\"http:\/\/www.oecd.org\/pisa\/data\/2015database\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30da\u30fc\u30b8<\/a>\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306e\u65e5\u672c\u8a9e\u7248\u304c\u3042\u3063\u305f\u3089\u3044\u3044\u306e\u306b\u306a\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>&#8212;<\/p>\n<p>\u4e0a\u8a18\u306e\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u3092\u5229\u7528\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u8cea\u554f\u756a\u53f7\uff08\u3068\u8868\u793a\u9806\u5e8f\uff09\u3092\u8a2d\u5b9a\u3057\u305f\u3089\u534a\u81ea\u52d5\u3067\u30b0\u30e9\u30d5\u304c\u51fa\u529b\u3055\u308c\u308b\u3068\u3053\u308d\u307e\u3067\u52d5\u304f\u3088\u3046\u306b\u306a\u3063\u305f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u8a2d\u5b9a\u3057\u305f\u8cea\u554f\u306b\u3064\u3044\u3066\u30b0\u30e9\u30d5\u5316\u3059\u308bR\u8a00\u8a9e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u304c\u73fe\u5728\u306e\u9032\u6357\u3067\u3059\u3002\u4eca\u56de\u306f\u30d5\u30a1\u30a4\u30eb\u3084\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u8aad\u307f\u8fbc\u307f\uff08Base\u90e8\u5206\uff09\u3068\u8cea\u554f\u3054\u3068\u306b\u96c6\u8a08\u3057\u3066\u30b0\u30e9\u30d5\u63cf\u753b\u3059\u308b\u90e8\u5206\uff08ICT\u90e8\u5206\uff09\u3092\u5206\u3051\u3066\u307f\u307e\u3057\u305f\u3002Base\u90e8\u5206\u306f\u6700\u521d\u306e\u4e00\u56de\u3060\u3051\u5b9f\u884c\u3059\u308c\u3070\u3001\u3042\u3068\u306f\u8aad\u8fbc\u307f\u6e08\u307f\u306e\u30c7\u30fc\u30bf\u3067\u51e6\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\uff08\u8ffd\u8a1820170114\uff1amacOS\u3067\u306e\u5c0e\u5165\u3092\u524d\u63d0\u3068\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u305f\u3081\uff0cWindows\u7b49\u306e\u4ed6\u74b0\u5883\u3067\u306f\uff0c\u65e5\u672c\u8a9e\u30d5\u30a9\u30f3\u30c8\u6307\u5b9a\u306e\u90e8\u5206\u7b49\u306b\u3064\u3044\u3066\u6539\u5909\u3059\u308b\u5fc5\u8981\u3042\u308a\u3002\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1773\" src=\"http:\/\/con3.xsrv.jp\/rinlab\/wp-content\/uploads\/2017\/01\/R_pisa2015_files-1-300x166.png\" alt=\"\" width=\"300\" height=\"166\" srcset=\"https:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/R_pisa2015_files-1-300x166.png 300w, https:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/R_pisa2015_files-1-768x426.png 768w, https:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/R_pisa2015_files-1-1024x568.png 1024w, https:\/\/www.con3.com\/rinlab\/wp-content\/uploads\/2017\/01\/R_pisa2015_files-1.png 1608w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<pre><span style=\"font-size: 1em;\"># For PISA2015 Base \uff08\u203b\u6700\u65b0\u306e\u3082\u306e\u304c\u4e0b\u65b9\u306e\u30ea\u30f3\u30af\u306b\u6709\u308a\uff09\n# K.RIN\n\nlibrary(readr)\nlibrary(haven)\nlibrary(ggplot2)\nlibrary(plyr)\nlibrary(tidyverse)\n\nquestion_items &lt;- read_csv(\"pisa2015_ICT_Familiarity_Questionnaire.csv\", col_names = TRUE, col_types = list(col_character(), col_character(), col_character()))\nanswer_items &lt;- read_csv(\"pisa2015_ICT_Familiarity_Questionnaire_answercode.csv\", col_names = TRUE, col_types = list(.default = col_character(), items_count = col_character()))\ncountry_code &lt;- read_csv(\"ISO3166_pisa.csv\", col_names = TRUE, col_types = list(col_character(),\u00a0col_character(), col_character(), col_character()))\n\nstudent_raw &lt;- read_sav(\"Cy6_ms_cmb_stu_qqq.sav\")\nschool_raw &lt;- read_sav(\"Cy6_ms_cmb_sch_qqq.sav\")\n<\/span><\/pre>\n<p><a href=\"http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_base.R\" target=\"_blank\" rel=\"noopener noreferrer\">pisa2015_base.R<\/a> \uff08\u2190\u3053\u3061\u3089\u306e\u65b9\u304c\u6700\u65b0\u7248\uff09<\/p>\n<pre><span style=\"font-size: 1em;\"># For PISA2015 ICT \uff08\u203b\u6700\u65b0\u306e\u3082\u306e\u304c\u4e0b\u65b9\u306e\u30ea\u30f3\u30af\u306b\u6709\u308a\uff09\n# K.RIN\n#\n# \u2605\u8a2d\u5b9a\u9805\u76ee\n# \u30fb\u8cea\u554fID\uff08\u300cselected_question = \" \"\u300d\u306e\u90e8\u5206\uff09\n# \u30fb\u8868\u793a\u9806\u5e8f\u306e\u7d44\u5408\u308f\u305b\uff08\u300cmutate('list_order' = `1`)\u300d\u306e\u90e8\u5206\uff09\n\n#\u2605\u8cea\u554f\u756a\u53f7\nselected_question = \"IC010Q09NA\"\nselected_question_big = substring(selected_question, 1,5)\n\n#\u8cea\u554f\u6587\u8aad\u8fbc\nq_title &lt;- paste(question_items$questions_ja[grep(selected_question_big, question_items$questions_no, value = FALSE, fixed = FALSE)][[1]])\n\n#\u8cea\u554f\u6587\u6574\u5f62\nq_width = 39\nq_title_disp &lt;- character()\nq_title_length &lt;- nchar(q_title)\nfor(i in 1:q_title_length%\/%q_width+1) {\n q_title_disp[i] &lt;- paste(substring(q_title, ((i-1)*q_width+1), ((i-1)*q_width+1)+(q_width-1)), '\\n')\n}\nq_title_disp[i+1] &lt;- paste(\"\\n\", selected_question,\"\\n\", question_items$questions_ja[grep(selected_question, question_items$questions_no)])\nq_title_all &lt;- paste(q_title_disp, collapse=\"\")\n\n#\u56de\u7b54\u9078\u629e\u80a2\u8aad\u8fbc\nans_item_count &lt;- as.integer(answer_items$items_count[grep(selected_question, answer_items$questions_no)])\nans_item_colcount &lt;- as.integer(answer_items$items_count[grep(selected_question_big, answer_items$questions_no)][1])\n\n#\u56de\u7b54\u9078\u629e\u80a2\u8a2d\u5b9a\nans_limits &lt;- as.character(answer_items[grep(selected_question_big, answer_items$questions_no),][1,3:sum(ans_item_count+2)])\nans_labels &lt;- as.character(answer_items[grep(selected_question, answer_items$questions_no),][1,sum(ans_item_colcount+3):sum(ans_item_colcount+ans_item_count+2)])\n\n#\u30e9\u30d9\u30eb\ny_label &lt;- \"\u30d1\u30fc\u30bb\u30f3\u30c8 %\"\nx_label &lt;- \"\u56fd\"\nlegend_label &lt;- \"\u56de\u7b54\"\n\n#\u56de\u7b54\u30c7\u30fc\u30bf\u62bd\u51fa\nstu_tmp &lt;- subset(student_raw, student_raw[[selected_question]] != \"NaN\")\n#scl_tmp &lt;- subset(school_raw, school_raw$[[selected_question]] != \"NaN\")\ncountry_ans_table &lt;- table(stu_tmp[[\"CNT\"]],stu_tmp[[selected_question]])\n\n#\u7e26\u9577df\u3078\u5909\u63db\ncountry_ans_long &lt;- as_tibble(country_ans_table,validate = FALSE)\ncolnames(country_ans_long) &lt;- c(\"CNT\", \"answer\", \"count\")\n#\u6a2a\u9577df\u7248\u30af\u30ed\u30b9\u8868\ncountry_ans_wide &lt;- spread(country_ans_long, answer, count)\n\n#\u2605\u8868\u793a\u9806\u5e8f\u7528\u5bfe\u8c61\u9805\u76ee\u8a2d\u5b9a\uff08\u56de\u7b54\u306e\u5834\u5408\uff09 `1`+`2`\ncountry_ans_wide &lt;- country_ans_wide %&gt;% rownames_to_column('num') %&gt;% mutate('list_order' = `1`)\n\n#\u6587\u5b57\u304b\u3089\u6570\u5024\u306b\u30e2\u30fc\u30c9\u5909\u63db\nmode(country_ans_wide$id) &lt;- \"integer\"\n\n#\u56fd\u540d\u5909\u63db\ncountry_ans_wide &lt;- ddply(country_ans_wide, 'CNT', transform, country_name = country_code$Name_ja[grep(CNT, country_code$Alpha3)])\n\n#\u8868\u793a\u9806\u5e8f\u7528\u5bfe\u51e6\u6570\u5024\u8a2d\u5b9a\uff08\u30ca\u30f3\u30d0\u30ea\u30f3\u30b0\u306e\u5834\u5408\uff09\n#country_ans_wide &lt;- ddply(country_ans_wide, num, transform, list_order = num * -1)\n#\u30e9\u30d9\u30eb\u304c\"X1\"\u306a\u3069\u306b\u306a\u3063\u305f\u5834\u5408\u3082\u60f3\u5b9a\u3057\u3066\u2026\ncolnames(country_ans_wide) &lt;- c(\"num\", \"CNT\", ans_limits, \"list_order\", \"country_name\")\n\n#\u56fd\u540d\u4ed8\u304d\u7e26\u9577df\ncountry_ans_long &lt;- gather(country_ans_wide, answer,count,-num,-CNT,-list_order,-country_name)\n\n#\u4e26\u3079\u66ff\u3048\ncountry_ans_long &lt;- arrange(country_ans_long, desc(CNT), desc(answer))\n\n#\u5217\u540d\u5909\u66f4\ncolnames(country_ans_long) &lt;- c(\"num\", \"CNT\", \"list_order\",\"country_name\",\"answer\", \"count\")\n\n#\u30d1\u30fc\u30bb\u30f3\u30c8\u8a08\u7b97\uff08\u63cf\u753b\u8a08\u7b97\u7528\uff09\ncountry_ict &lt;- ddply(country_ans_long, \"CNT\", transform, percent = count \/ sum(count) * 100, 0.1)\n#\u5c0f\u6570\u70b9\u4ee5\u4e0b\uff11\u6841\u51e6\u7406\uff08\u8868\u793a\u7528\uff09\ncountry_ict &lt;- ddply(country_ict, \"CNT\", transform, percent_rounded = round_any(count \/ sum(count) * 100, 0.1))\n\n#\u30ea\u30b9\u30c8\u9806\u5e8f\uff08\u30d1\u30fc\u30bb\u30f3\u30c8\u8a08\u7b97\uff09\ncountry_ict &lt;- ddply(country_ict, \"CNT\", transform, list_percent_order = round_any(list_order \/ sum(count) * 100, 0.1))\n\n#\u30e9\u30d9\u30eb\u4f4d\u7f6e\u8a08\u7b97\ncountry_ict &lt;- ddply(country_ict, \"CNT\", transform, percent_label_y = cumsum(percent)-0.5*percent)\n\ncountry_ict &lt;- arrange(country_ict, CNT, desc(answer))\n\n#\u30d5\u30a9\u30f3\u30c8\u30d5\u30a1\u30df\u30ea\u30fc\u8a2d\u5b9a\uff08macOS\u7528\uff09\nquartzFonts(HiraKaku = quartzFont(rep(\"HiraginoSans-W3\", 4)))\npar(family = \"HiraKaku\")\n\n#\u30b0\u30e9\u30d5\u63cf\u753b\ngraph &lt;- ggplot(country_ict, aes(x = reorder(country_name, list_percent_order), y = percent, fill = factor(answer))) + \n ggtitle(sprintf(\"%s\", q_title_all)) + \n ylab(y_label) + \n xlab(x_label) + \n labs(fill = legend_label) + \n coord_flip(expand = FALSE) + \n geom_bar(stat = \"identity\", position='stack') + \n geom_text(aes(y = percent_label_y, \n label = paste(format(percent_rounded, nsmall = 1),\"\")), color = \"white\", size = 3) + \n scale_y_reverse(breaks = c(100.0,75.0,50.0,25.0,0.0), \n labels = c(\"0%\",\"25%\",\"50%\",\"75%\",\"100%\")) + \n scale_fill_discrete(limits = ans_limits, labels = ans_labels) + \n scale_color_manual(values = rainbow(7)) + \n theme_bw() + \n theme(plot.margin = margin(1, 1, 1, 1, \"cm\"), \n plot.title = element_text(family = \"HiraKaku\", size = 10), \n plot.caption = element_text(family = \"HiraKaku\", size = 10),\n legend.title = element_text(family = \"HiraKaku\", size = 10), \n legend.text = element_text(family = \"HiraKaku\", size = 7), \n axis.title = element_text(family = \"HiraKaku\", size = 9), \n axis.title.y = element_text(angle = 0, vjust = 0.5), \n axis.text.x = element_text(family = \"HiraKaku\", size = 9), \n axis.text.y = element_text(family = \"HiraKaku\", size = 10)) \n\nprint(graph)\n\n#ggsave(\"pisa2015_graph.png\", graph)<\/span><\/pre>\n<p><a href=\"http:\/\/www.edufolder.jp\/files\/pisa2015\/pisa2015_ict.R\" target=\"_blank\" rel=\"noopener noreferrer\">pisa2015_ict.R<\/a>\u00a0\uff08\u2190\u3053\u3061\u3089\u306e\u65b9\u304c\u6700\u65b0\u7248\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300cR\u3067PISA2015\u300d\u3068\u3044\u3046\u30a8\u30f3\u30c8\u30ea\u30fc\u3067\u3001\u3044\u304f\u3064\u304b\u306eWeb\u8a18\u4e8b\u306b\u89e6\u767a\u3055\u308c\u3066\u3001OECD\u3068\u3044\u3046\u56fd\u969b\u6a5f\u95a2\u304c\uff13\u5e74\u9593\u9694\u3067\u884c\u306a\u3063\u3066\u3044\u308b\u56fd\u969b\u5b66\u529b\u8abf\u67fb\u300cPISA\u300d\u306e2015\u5e74\u5b9f\u65bd\u30c7\u30fc\u30bf\u3092\u3001\u7d71\u8a08\u5411\u3051\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u300cR\u300d\u3092\u4f7f\u3063\u3066\u89e6\u308a\u59cb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2,4],"tags":[],"class_list":["post-1713","post","type-post","status-publish","format-standard","hentry","category-resources","category-activity"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4WGyZ-rD","jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=\/wp\/v2\/posts\/1713","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1713"}],"version-history":[{"count":3,"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=\/wp\/v2\/posts\/1713\/revisions"}],"predecessor-version":[{"id":3551,"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=\/wp\/v2\/posts\/1713\/revisions\/3551"}],"wp:attachment":[{"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.con3.com\/rinlab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}