{"id":4440,"date":"2023-07-11T02:52:35","date_gmt":"2023-07-11T02:52:35","guid":{"rendered":"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/"},"modified":"2023-07-11T02:52:35","modified_gmt":"2023-07-11T02:52:35","slug":"lijnen-functioneren-in-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/","title":{"rendered":"Hoe de lines()-functie in r te gebruiken (met voorbeelden)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">U kunt de functie <strong>lines()<\/strong> in R gebruiken om nieuwe lijnen toe te voegen aan een bestaande basis-R-plot.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Deze functie gebruikt de volgende syntaxis:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong>lines(x, y, col, lwd, lty)<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Goud:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><b>x:<\/b> x-co\u00f6rdinaatvector die voor de nieuwe lijn moet worden gebruikt<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>y<\/strong> : y-co\u00f6rdinaatvector die voor de nieuwe lijn moet worden gebruikt<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>col<\/strong> : Kleur van de nieuwe regel<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>lwd<\/strong> : Breedte van de nieuwe regel<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>lty<\/strong> : Lijntype voor de nieuwe lijn<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Het volgende voorbeeld laat zien hoe u de functie <strong>lines()<\/strong> in de praktijk kunt gebruiken.<\/span><\/p>\n<h2> <strong><span style=\"color: #000000;\">Voorbeeld: hoe u de functie lines() in R gebruikt<\/span><\/strong><\/h2>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Stel dat we de volgende code gebruiken om een eenvoudige puntenwolk in basis R te maken:<\/span><\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#define (x, y) coordinates\n<\/span>x &lt;- c(1, 2, 3, 4, 5, 6, 7, 8)\ny &lt;- c(2, 5, 5, 9, 10, 14, 13, 15)\n\n<span style=\"color: #008080;\">#create scatterplot\n<\/span>plot(x, y)\n<\/strong><\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-34765 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lf1.png\" alt=\"\" width=\"501\" height=\"453\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">We kunnen de functie <strong>lines()<\/strong> gebruiken om een lijn met specifieke co\u00f6rdinaten (x, y) aan de plot toe te voegen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#define (x, y) coordinates\n<\/span>x &lt;- c(1, 2, 3, 4, 5, 6, 7, 8)\ny &lt;- c(2, 5, 5, 9, 10, 14, 13, 15)\n\n<span style=\"color: #008080;\">#create scatterplot\n<\/span>plot(x, y)\n\n<span style=\"color: #008080;\">#define (x, y) coordinates for new line to add\n<\/span>x_line &lt;- c(1, 2, 3, 4, 5, 6, 7, 8)\ny_line &lt;- c(2, 4, 6, 8, 10, 12, 14, 16)\n\n<span style=\"color: #008080;\">#add new line to plot\n<\/span>lines(x_line, y_line)\n<\/strong><\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-34766 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lf2.png\" alt=\"\" width=\"491\" height=\"434\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">We kunnen ook de argumenten <strong>col<\/strong> , <strong>lwd<\/strong> en <strong>lty<\/strong> gebruiken om de kleur, breedte en lijnstijl van de nieuwe regel te wijzigen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#define (x, y) coordinates\n<\/span>x &lt;- c(1, 2, 3, 4, 5, 6, 7, 8)\ny &lt;- c(2, 5, 5, 9, 10, 14, 13, 15)\n\n<span style=\"color: #008080;\">#create scatterplot\n<\/span>plot(x, y)\n\n<span style=\"color: #008080;\">#define (x, y) coordinates for new line to add\n<\/span>x_line &lt;- c(1, 2, 3, 4, 5, 6, 7, 8)\ny_line &lt;- c(2, 4, 6, 8, 10, 12, 14, 16)\n\n<span style=\"color: #008080;\">#add new line to plot with custom style\n<\/span>lines(x_line, y_line, col=' <span style=\"color: #ff0000;\">red<\/span> ', lwd= <span style=\"color: #008000;\">6<\/span> , lty=' <span style=\"color: #ff0000;\">dashed<\/span> ')<\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-34767 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lf3.png\" alt=\"\" width=\"488\" height=\"442\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Voel je vrij om de waarden van de verschillende argumenten in de functie <strong>lines()<\/strong> te wijzigen om een nieuwe regel toe te voegen met de exacte stijl die je wilt.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">In de volgende tutorials wordt uitgelegd hoe u andere veelvoorkomende taken in R kunt uitvoeren:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/nl\/ablijn-in-r\/\" target=\"_blank\" rel=\"noopener\">Hoe aline() in R te gebruiken om rechte lijnen aan plots toe te voegen<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/spreidingsdiagram-met-regressielijn-r\/\" target=\"_blank\" rel=\"noopener\">Hoe u een spreidingsdiagram maakt met een regressielijn in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/dikte-van-de-ggplot-lijn\/\" target=\"_blank\" rel=\"noopener\">Hoe de lijndikte in ggplot2 aan te passen<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>U kunt de functie lines() in R gebruiken om nieuwe lijnen toe te voegen aan een bestaande basis-R-plot. Deze functie gebruikt de volgende syntaxis: lines(x, y, col, lwd, lty) Goud: x: x-co\u00f6rdinaatvector die voor de nieuwe lijn moet worden gebruikt y : y-co\u00f6rdinaatvector die voor de nieuwe lijn moet worden gebruikt col : Kleur van [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-4440","post","type-post","status-publish","format-standard","hentry","category-gids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hoe de functie lines() in R te gebruiken (met voorbeelden) - Statorials<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt uitgelegd hoe u de functie lines() in R kunt gebruiken om nieuwe lijnen aan een bestaande plot toe te voegen, met verschillende voorbeelden.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe de functie lines() in R te gebruiken (met voorbeelden) - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt uitgelegd hoe u de functie lines() in R kunt gebruiken om nieuwe lijnen aan een bestaande plot toe te voegen, met verschillende voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-11T02:52:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lf1.png\" \/>\n<meta name=\"author\" content=\"Dr.benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr.benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/\",\"url\":\"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/\",\"name\":\"Hoe de functie lines() in R te gebruiken (met voorbeelden) - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-11T02:52:35+00:00\",\"dateModified\":\"2023-07-11T02:52:35+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt uitgelegd hoe u de functie lines() in R kunt gebruiken om nieuwe lijnen aan een bestaande plot toe te voegen, met verschillende voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe de lines()-functie in r te gebruiken (met voorbeelden)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/nl\/#website\",\"url\":\"https:\/\/statorials.org\/nl\/\",\"name\":\"Statorials\",\"description\":\"Uw gids voor statistische competentie\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder\",\"sameAs\":[\"http:\/\/statorials.org\/nl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hoe de functie lines() in R te gebruiken (met voorbeelden) - Statorials","description":"In deze tutorial wordt uitgelegd hoe u de functie lines() in R kunt gebruiken om nieuwe lijnen aan een bestaande plot toe te voegen, met verschillende voorbeelden.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe de functie lines() in R te gebruiken (met voorbeelden) - Statorials","og_description":"In deze tutorial wordt uitgelegd hoe u de functie lines() in R kunt gebruiken om nieuwe lijnen aan een bestaande plot toe te voegen, met verschillende voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/","og_site_name":"Statorials","article_published_time":"2023-07-11T02:52:35+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lf1.png"}],"author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr.benjamin anderson","Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/","url":"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/","name":"Hoe de functie lines() in R te gebruiken (met voorbeelden) - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-11T02:52:35+00:00","dateModified":"2023-07-11T02:52:35+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt uitgelegd hoe u de functie lines() in R kunt gebruiken om nieuwe lijnen aan een bestaande plot toe te voegen, met verschillende voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/lijnen-functioneren-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe de lines()-functie in r te gebruiken (met voorbeelden)"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/nl\/#website","url":"https:\/\/statorials.org\/nl\/","name":"Statorials","description":"Uw gids voor statistische competentie","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder","sameAs":["http:\/\/statorials.org\/nl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/4440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/comments?post=4440"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/4440\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=4440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=4440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=4440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}