{"id":1807,"date":"2023-07-24T21:57:31","date_gmt":"2023-07-24T21:57:31","guid":{"rendered":"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/"},"modified":"2023-07-24T21:57:31","modified_gmt":"2023-07-24T21:57:31","slug":"blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/","title":{"rendered":"Jak naprawi\u0107: b\u0142\u0105d w xy.coords(x, y, xlabel, ylabel, log): d\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d s\u0105 r\u00f3\u017cne"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Typowym b\u0142\u0119dem, jaki mo\u017cesz napotka\u0107 w R jest:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>Error in xy.coords(x, y, xlabel, ylabel, log): \n  'x' and 'y' lengths differ \n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Ten b\u0142\u0105d wyst\u0119puje, gdy pr\u00f3bujesz utworzy\u0107 wykres dw\u00f3ch zmiennych, ale zmienne nie s\u0105 tej samej d\u0142ugo\u015bci.<\/span><\/p>\n<p> <span style=\"color: #000000;\">W tym samouczku dok\u0142adnie wyja\u015bniono, jak naprawi\u0107 ten b\u0142\u0105d.<\/span><\/p>\n<h3> <strong>Jak odtworzy\u0107 b\u0142\u0105d<\/strong><\/h3>\n<p> <span style=\"color: #000000;\">Za\u0142\u00f3\u017cmy, \u017ce pr\u00f3bujemy utworzy\u0107 wykres rozrzutu nast\u0119puj\u0105cych dw\u00f3ch zmiennych w R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define x and y variables<\/span>\nx &lt;- c(2, 5, 5, 8)\ny &lt;- c(22, 28, 32, 35, 40, 41)\n\n<span style=\"color: #008080;\">#attempt to create scatterplot of x vs. y<\/span>\nplot(x, y)\n\nError in xy.coords(x, y, xlabel, ylabel, log): \n  'x' and 'y' lengths differ\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Otrzymujemy b\u0142\u0105d, poniewa\u017c d\u0142ugo\u015bci x i y nie s\u0105 r\u00f3wne.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Mo\u017cemy to potwierdzi\u0107, drukuj\u0105c d\u0142ugo\u015b\u0107 ka\u017cdej zmiennej:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#print length of x<\/span>\nlength(x)\n\n[1] 4\n\n<span style=\"color: #008080;\">#print length of y<\/span>\nlength(y)\n\n[1] 6\n\n<span style=\"color: #008080;\">#check if length of x and y are equal\n<\/span>length(x) <span style=\"color: #993300;\">==<\/span> length(y)\n\n[1] FALSE\n<\/strong><\/pre>\n<h3> <span style=\"color: #000000;\"><strong>Jak naprawi\u0107 b\u0142\u0105d<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Naj\u0142atwiejszym sposobem naprawienia tego b\u0142\u0119du jest po prostu upewnienie si\u0119, \u017ce oba wektory maj\u0105 t\u0119 sam\u0105 d\u0142ugo\u015b\u0107:<\/span><\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define x and y variables to have same length\n<\/span>x &lt;- c(2, 5, 5, 8, 9, 12)\ny &lt;- c(22, 28, 32, 35, 40, 41)\n\n<span style=\"color: #008080;\">#confirm that x and y are the same length<\/span>\nlength(x) <span style=\"color: #993300;\">==<\/span> length(y)\n\n[1] TRUE\n\n<span style=\"color: #008080;\">create scatterplot of x vs. y\n<\/span>plot(x, y)\n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-17546 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/longueur1.png\" alt=\"\" width=\"454\" height=\"407\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Je\u015bli jeden wektor oka\u017ce si\u0119 kr\u00f3tszy od drugiego, mo\u017cesz zdecydowa\u0107 si\u0119 na wykre\u015blenie tylko warto\u015bci do d\u0142ugo\u015bci kr\u00f3tszego wektora.<\/span><\/span><\/p>\n<p> <span style=\"color: #000000;\">Na przyk\u0142ad, je\u015bli wektor xa ma 4 warto\u015bci, a wektor y ma 6 warto\u015bci, mo\u017cemy utworzy\u0107 wykres rozrzutu, u\u017cywaj\u0105c tylko pierwszych 4 warto\u015bci ka\u017cdego wektora:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define x and y variables<\/span>\nx &lt;- c(2, 5, 5, 8)\ny &lt;- c(22, 28, 32, 35, 40, 41)\n\n<span style=\"color: #008080;\">#create scatterplot of first 4 pairwise values of x vs. y<\/span>\nplot(x, y[1: <span style=\"color: #3366ff;\">length<\/span> (x)])\n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-17547 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/longueur2.png\" alt=\"\" width=\"455\" height=\"418\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Nale\u017cy pami\u0119ta\u0107, \u017ce do utworzenia chmury punkt\u00f3w wykorzystywane s\u0105 tylko pierwsze cztery warto\u015bci ka\u017cdego wektora.<\/span><\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Dodatkowe zasoby<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/pl\/nas-wprowadzony-pod-przymusem-do-r\/\" target=\"_blank\" rel=\"noopener\">Jak naprawi\u0107 w R: NA wprowadzone przez przymus<\/a><br \/> <a href=\"https:\/\/statorials.org\/pl\/r-indeks-b\u0142edu-poza-zakresem\/\" target=\"_blank\" rel=\"noopener\">Jak naprawi\u0107 w R: wskaz\u00f3wka poza zakresem<\/a><br \/> <a href=\"https:\/\/statorials.org\/pl\" target=\"_blank\" rel=\"noopener\">Jak naprawi\u0107: D\u0142u\u017csza d\u0142ugo\u015b\u0107 obiektu nie jest wielokrotno\u015bci\u0105 kr\u00f3tszej d\u0142ugo\u015bci obiektu<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Typowym b\u0142\u0119dem, jaki mo\u017cesz napotka\u0107 w R jest: Error in xy.coords(x, y, xlabel, ylabel, log): 'x&#8217; and 'y&#8217; lengths differ Ten b\u0142\u0105d wyst\u0119puje, gdy pr\u00f3bujesz utworzy\u0107 wykres dw\u00f3ch zmiennych, ale zmienne nie s\u0105 tej samej d\u0142ugo\u015bci. W tym samouczku dok\u0142adnie wyja\u015bniono, jak naprawi\u0107 ten b\u0142\u0105d. Jak odtworzy\u0107 b\u0142\u0105d Za\u0142\u00f3\u017cmy, \u017ce pr\u00f3bujemy utworzy\u0107 wykres rozrzutu nast\u0119puj\u0105cych [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1807","post","type-post","status-publish","format-standard","hentry","category-przewodnik"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Jak naprawi\u0107: b\u0142\u0105d w xy.coords (x, y, xlabel, ylabel, log): d\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d r\u00f3\u017cni\u0105 si\u0119<\/title>\n<meta name=\"description\" content=\"W tym samouczku wyja\u015bniono, jak naprawi\u0107 nast\u0119puj\u0105cy b\u0142\u0105d w R: B\u0142\u0105d w xy.coords(x, y, xlabel, ylabel, log): D\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d s\u0105 r\u00f3\u017cne.\" \/>\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\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/\" \/>\n<meta property=\"og:locale\" content=\"pl_PL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Jak naprawi\u0107: b\u0142\u0105d w xy.coords (x, y, xlabel, ylabel, log): d\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d r\u00f3\u017cni\u0105 si\u0119\" \/>\n<meta property=\"og:description\" content=\"W tym samouczku wyja\u015bniono, jak naprawi\u0107 nast\u0119puj\u0105cy b\u0142\u0105d w R: B\u0142\u0105d w xy.coords(x, y, xlabel, ylabel, log): D\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d s\u0105 r\u00f3\u017cne.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-24T21:57:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/longueur1.png\" \/>\n<meta name=\"author\" content=\"Benjamin Anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Napisane przez\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin Anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Szacowany czas czytania\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minuty\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/\",\"url\":\"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/\",\"name\":\"Jak naprawi\u0107: b\u0142\u0105d w xy.coords (x, y, xlabel, ylabel, log): d\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d r\u00f3\u017cni\u0105 si\u0119\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/pl\/#website\"},\"datePublished\":\"2023-07-24T21:57:31+00:00\",\"dateModified\":\"2023-07-24T21:57:31+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/pl\/#\/schema\/person\/6484727a4612df3e69f016c3129c6965\"},\"description\":\"W tym samouczku wyja\u015bniono, jak naprawi\u0107 nast\u0119puj\u0105cy b\u0142\u0105d w R: B\u0142\u0105d w xy.coords(x, y, xlabel, ylabel, log): D\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d s\u0105 r\u00f3\u017cne.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/#breadcrumb\"},\"inLanguage\":\"pl-PL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Dom\",\"item\":\"https:\/\/statorials.org\/pl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Jak naprawi\u0107: b\u0142\u0105d w xy.coords(x, y, xlabel, ylabel, log): d\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d s\u0105 r\u00f3\u017cne\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/pl\/#website\",\"url\":\"https:\/\/statorials.org\/pl\/\",\"name\":\"Statorials\",\"description\":\"Tw\u00f3j przewodnik po kompetencjach statystycznych!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/pl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pl-PL\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/pl\/#\/schema\/person\/6484727a4612df3e69f016c3129c6965\",\"name\":\"Benjamin Anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pl-PL\",\"@id\":\"https:\/\/statorials.org\/pl\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/pl\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/pl\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin Anderson\"},\"description\":\"Cze\u015b\u0107, jestem Benjamin i jestem emerytowanym profesorem statystyki, kt\u00f3ry zosta\u0142 oddanym nauczycielem Statorials. Dzi\u0119ki bogatemu do\u015bwiadczeniu i wiedzy specjalistycznej w dziedzinie statystyki ch\u0119tnie dziel\u0119 si\u0119 swoj\u0105 wiedz\u0105, aby wzmocni\u0107 pozycj\u0119 uczni\u00f3w za po\u015brednictwem Statorials. Wiedzie\u0107 wi\u0119cej\",\"sameAs\":[\"https:\/\/statorials.org\/pl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Jak naprawi\u0107: b\u0142\u0105d w xy.coords (x, y, xlabel, ylabel, log): d\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d r\u00f3\u017cni\u0105 si\u0119","description":"W tym samouczku wyja\u015bniono, jak naprawi\u0107 nast\u0119puj\u0105cy b\u0142\u0105d w R: B\u0142\u0105d w xy.coords(x, y, xlabel, ylabel, log): D\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d s\u0105 r\u00f3\u017cne.","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\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/","og_locale":"pl_PL","og_type":"article","og_title":"Jak naprawi\u0107: b\u0142\u0105d w xy.coords (x, y, xlabel, ylabel, log): d\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d r\u00f3\u017cni\u0105 si\u0119","og_description":"W tym samouczku wyja\u015bniono, jak naprawi\u0107 nast\u0119puj\u0105cy b\u0142\u0105d w R: B\u0142\u0105d w xy.coords(x, y, xlabel, ylabel, log): D\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d s\u0105 r\u00f3\u017cne.","og_url":"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/","og_site_name":"Statorials","article_published_time":"2023-07-24T21:57:31+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/longueur1.png"}],"author":"Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Napisane przez":"Benjamin Anderson","Szacowany czas czytania":"2 minuty"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/","url":"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/","name":"Jak naprawi\u0107: b\u0142\u0105d w xy.coords (x, y, xlabel, ylabel, log): d\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d r\u00f3\u017cni\u0105 si\u0119","isPartOf":{"@id":"https:\/\/statorials.org\/pl\/#website"},"datePublished":"2023-07-24T21:57:31+00:00","dateModified":"2023-07-24T21:57:31+00:00","author":{"@id":"https:\/\/statorials.org\/pl\/#\/schema\/person\/6484727a4612df3e69f016c3129c6965"},"description":"W tym samouczku wyja\u015bniono, jak naprawi\u0107 nast\u0119puj\u0105cy b\u0142\u0105d w R: B\u0142\u0105d w xy.coords(x, y, xlabel, ylabel, log): D\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d s\u0105 r\u00f3\u017cne.","breadcrumb":{"@id":"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/#breadcrumb"},"inLanguage":"pl-PL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/pl\/blad-we-wspolrzednych-xy-dlugosci-x-i-y-roznia-sie-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Dom","item":"https:\/\/statorials.org\/pl\/"},{"@type":"ListItem","position":2,"name":"Jak naprawi\u0107: b\u0142\u0105d w xy.coords(x, y, xlabel, ylabel, log): d\u0142ugo\u015bci \u201ex\u201d i \u201ey\u201d s\u0105 r\u00f3\u017cne"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/pl\/#website","url":"https:\/\/statorials.org\/pl\/","name":"Statorials","description":"Tw\u00f3j przewodnik po kompetencjach statystycznych!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/pl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pl-PL"},{"@type":"Person","@id":"https:\/\/statorials.org\/pl\/#\/schema\/person\/6484727a4612df3e69f016c3129c6965","name":"Benjamin Anderson","image":{"@type":"ImageObject","inLanguage":"pl-PL","@id":"https:\/\/statorials.org\/pl\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/pl\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/pl\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","caption":"Benjamin Anderson"},"description":"Cze\u015b\u0107, jestem Benjamin i jestem emerytowanym profesorem statystyki, kt\u00f3ry zosta\u0142 oddanym nauczycielem Statorials. Dzi\u0119ki bogatemu do\u015bwiadczeniu i wiedzy specjalistycznej w dziedzinie statystyki ch\u0119tnie dziel\u0119 si\u0119 swoj\u0105 wiedz\u0105, aby wzmocni\u0107 pozycj\u0119 uczni\u00f3w za po\u015brednictwem Statorials. Wiedzie\u0107 wi\u0119cej","sameAs":["https:\/\/statorials.org\/pl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/pl\/wp-json\/wp\/v2\/posts\/1807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/pl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/pl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/pl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/pl\/wp-json\/wp\/v2\/comments?post=1807"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/pl\/wp-json\/wp\/v2\/posts\/1807\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/pl\/wp-json\/wp\/v2\/media?parent=1807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/pl\/wp-json\/wp\/v2\/categories?post=1807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/pl\/wp-json\/wp\/v2\/tags?post=1807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}