{"id":3057,"date":"2015-07-08T07:37:59","date_gmt":"2015-07-08T06:37:59","guid":{"rendered":"https:\/\/abcdr.guyader.pro\/?p=3057"},"modified":"2018-04-08T00:01:33","modified_gmt":"2018-04-07T23:01:33","slug":"comment-ajouter-un-niveau-a-un-facteur","status":"publish","type":"post","link":"https:\/\/thinkr.fr\/abcdr\/comment-ajouter-un-niveau-a-un-facteur\/","title":{"rendered":"Comment ajouter un niveau \u00e0 un facteur ?"},"content":{"rendered":"<p>Il est parfois utile d\u2019ajouter un niveau, absent \u00e0 l\u2019int\u00e9rieur du facteur mais qui est susceptible de devoir \u00eatre ajouter par la suite.<\/p>\n<pre><code><br \/>x &lt;- factor(c(\"A\",\"A\",\"B\",\"A\",\"C\",\"A\",\"B\",\"A\",\"B\",\"B\",\"C\",\"A\",\"C\"))\n\nlevels(x) &lt;- c(levels(x),\"D\") # On ajoute le niveau \u201cD\u201d au facteur x\n\n<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>On obtient\u00a0:<\/p>\n<pre><code><br \/>\u00a0x\n\n[1] A A B A C A B A B B C A C\n\nLevels: A B C D<br \/><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Il est parfois utile d\u2019ajouter un niveau, absent \u00e0 l\u2019int\u00e9rieur du facteur mais qui est susceptible de devoir \u00eatre ajouter par la suite. x &lt;- factor(c(\u00ab\u00a0A\u00a0\u00bb,\u00a0\u00bbA\u00a0\u00bb,\u00a0\u00bbB\u00a0\u00bb,\u00a0\u00bbA\u00a0\u00bb,\u00a0\u00bbC\u00a0\u00bb,\u00a0\u00bbA\u00a0\u00bb,\u00a0\u00bbB\u00a0\u00bb,\u00a0\u00bbA\u00a0\u00bb,\u00a0\u00bbB\u00a0\u00bb,\u00a0\u00bbB\u00a0\u00bb,\u00a0\u00bbC\u00a0\u00bb,\u00a0\u00bbA\u00a0\u00bb,\u00a0\u00bbC\u00a0\u00bb)) levels(x) &lt;- c(levels(x),\u00a0\u00bbD\u00a0\u00bb) # On ajoute le niveau \u201cD\u201d au facteur x \u00a0 On obtient\u00a0: \u00a0x [1] A A B A C A B A B B C A C Levels: A B C D<a class=\"more-link\" href=\"https:\/\/thinkr.fr\/abcdr\/comment-ajouter-un-niveau-a-un-facteur\/\">Read More &rarr;<\/a><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","rop_custom_images_group":[],"rop_custom_messages_group":[],"rop_publish_now":"initial","rop_publish_now_accounts":{"twitter_399453572_399453572":""},"rop_publish_now_history":[],"rop_publish_now_status":"pending","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8,12],"tags":[],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-helene","4":"post-3057","6":"format-standard","7":"category-fonctions-utiles","8":"category-manipulation-de-donnees"},"acf":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p9O7Sx-Nj","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/posts\/3057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/comments?post=3057"}],"version-history":[{"count":2,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/posts\/3057\/revisions"}],"predecessor-version":[{"id":4257,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/posts\/3057\/revisions\/4257"}],"wp:attachment":[{"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/media?parent=3057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/categories?post=3057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/tags?post=3057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}