{"id":469,"date":"2023-07-29T19:40:31","date_gmt":"2023-07-29T19:40:31","guid":{"rendered":"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/"},"modified":"2023-07-29T19:40:31","modified_gmt":"2023-07-29T19:40:31","slug":"%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/","title":{"rendered":"R \u4e2d apply()\u3001lapply()\u3001sapply() \u548c tapply() \u6307\u5357"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">\u672c\u6559\u7a0b\u89e3\u91ca\u4e86\u5185\u7f6e R \u51fd\u6570<strong>apply()<\/strong> \u3001 <strong>sapply()<\/strong> \u3001 <strong>lapply()<\/strong>\u548c<strong>tapply()<\/strong>\u4e4b\u95f4\u7684\u5dee\u5f02\uff0c\u4ee5\u53ca\u4f55\u65f6\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u6bcf\u4e2a\u51fd\u6570\u7684\u793a\u4f8b\u3002<\/span><\/p>\n<h2><span style=\"color: #000000;\"><strong>\u7533\u8bf7\uff08\uff09<\/strong><\/span><\/h2>\n<p><span style=\"color: #000000;\">\u5f53\u60a8\u60f3\u8981\u5c06\u51fd\u6570\u5e94\u7528\u4e8e\u77e9\u9635\u6216\u6570\u636e\u6846\u7684\u884c\u6216\u5217\u65f6\uff0c\u8bf7\u4f7f\u7528<strong>apply()<\/strong>\u51fd\u6570\u3002<\/span><\/p>\n<p> <span style=\"color: #000000;\">apply() \u51fd\u6570\u7684\u57fa\u672c\u8bed\u6cd5\u662f\uff1a<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"color: #000000;\"><strong>\u5e94\u7528\uff08X\u3001\u4fdd\u8bc1\u91d1\u3001\u4e50\u8da3\uff09<\/strong><\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">X \u662f\u6570\u7ec4\u6216\u6570\u636e\u5757\u7684\u540d\u79f0<\/span><\/li>\n<li><span style=\"color: #000000;\">MARGIN \u6307\u793a\u5728\u54ea\u4e2a\u7ef4\u5ea6\u4e0a\u6267\u884c\u64cd\u4f5c\uff081 = \u884c\uff0c2 = \u5217\uff09<\/span><\/li>\n<li> <span style=\"color: #000000;\">FUN \u662f\u60a8\u8981\u6267\u884c\u7684\u7279\u5b9a\u64cd\u4f5c\uff08\u4f8b\u5982\u6700\u5c0f\u503c\u3001\u6700\u5927\u503c\u3001\u603b\u548c\u3001\u5e73\u5747\u503c\u7b49\uff09<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86<strong>apply()<\/strong>\u7684\u51e0\u4e2a\u5b9e\u9645\u793a\u4f8b\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create a data frame with three columns and five rows<\/span>\ndata &lt;- data.frame(a = c(1, 3, 7, 12, 9),\n                   b = c(4, 4, 6, 7, 8),\n                   c = c(14, 15, 11, 10, 6))\ndata\n\n#abc\n#1 1 4 14\n#2 3 4 15\n#3 7 6 11\n#4 12 7 10\n#5 9 8 6\n\n<span style=\"color: #008080;\">#find the sum of each row<\/span>\napply(data, 1, sum)\n\n#[1] 19 22 24 29 23\n\n<span style=\"color: #008080;\">#find the sum of each column<\/span>\napply(data, 2, sum)\n\n#abc\n#32 29 56 \n\n<span style=\"color: #008080;\">#find the mean of each row<\/span>\napply(data, 1, mean)\n\n#[1] 6.333333 7.333333 8.000000 9.666667 7.666667\n\n<span style=\"color: #008080;\">#find the mean of each column, rounded to one decimal place<\/span>\nround(apply(data, 2, mean), 1)\n\n#abc\n#6.4 5.8 11.2 \n\n<span style=\"color: #008080;\">#find the standard deviation of each row<\/span>\napply(data, 1, sd)\n\n#[1] 6.806859 6.658328 2.645751 2.516611 1.527525\n\n<span style=\"color: #008080;\">#find the standard deviation of each column<\/span>\napply(data, 2, sd)\n\n#abc\n#4.449719 1.788854 3.563706 \n<\/strong><\/pre>\n<h2><span style=\"color: #000000;\"><strong>\u7533\u8bf7\uff08\uff09<\/strong><\/span><\/h2>\n<p><span style=\"color: #000000;\">\u5f53\u60a8\u60f3\u8981\u5c06\u51fd\u6570\u5e94\u7528\u4e8e\u5217\u8868\u3001\u5411\u91cf\u6216\u6570\u636e\u6846\u7684\u6bcf\u4e2a\u5143\u7d20\u5e76\u83b7\u53d6\u5217\u8868\u4f5c\u4e3a\u7ed3\u679c\u65f6\uff0c\u8bf7\u4f7f\u7528<strong>lapply()<\/strong>\u51fd\u6570\u3002<\/span><\/p>\n<p> <span style=\"color: #000000;\">lapply() \u51fd\u6570\u7684\u57fa\u672c\u8bed\u6cd5\u662f\uff1a<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"color: #000000;\"><strong>\u7533\u8bf7\uff08X\uff0c\u6709\u8da3\uff09<\/strong><\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">X \u662f\u5217\u8868\u3001\u5411\u91cf\u6216\u6570\u636e\u6846\u7684\u540d\u79f0<\/span><\/li>\n<li><span style=\"color: #000000;\">FUN \u662f\u60a8\u8981\u6267\u884c\u7684\u5177\u4f53\u64cd\u4f5c<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u5728\u6570\u636e\u6846\u4e2d\u7684\u5217\u4e0a\u4f7f\u7528<strong>lapply()<\/strong>\u7684\u51e0\u4e2a\u793a\u4f8b\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create a data frame with three columns and five rows\n<\/span>data &lt;- data.frame(a = c(1, 3, 7, 12, 9),\n                   b = c(4, 4, 6, 7, 8),\n                   c = c(14, 15, 11, 10, 6))\ndata\n\n#abc\n#1 1 4 14\n#2 3 4 15\n#3 7 6 11\n#4 12 7 10\n#5 9 8 6\n\n<span style=\"color: #008080;\">#find mean of each column and return results as a list<\/span>\napply(data, mean)\n\n#$a\n# [1] 6.4\n#\n# $b\n# [1] 5.8\n#\n# $c\n# [1] 11.2\n\n<span style=\"color: #008080;\">#multiply values in each column by 2 and return results as a list<\/span>\nlapply(data, function(data) data*2)\n\n#$a\n# [1] 2 6 14 24 18\n#\n# $b\n# [1] 8 8 12 14 16\n#\n# $c\n# [1] 28 30 22 20 12\n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528<strong>lapply()<\/strong>\u5bf9\u5217\u8868\u6267\u884c\u64cd\u4f5c\u3002\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u6267\u884c\u6b64\u64cd\u4f5c\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create a list\n<\/span>x &lt;- list(a=1, b=1:5, c=1:10) \nx\n\n#$a\n# [1] 1\n#\n# $b\n# [1] 1 2 3 4 5\n#\n# $c\n# [1] 1 2 3 4 5 6 7 8 9 10\n\n<span style=\"color: #008080;\">#find the sum of each element in the list<\/span>\nlapply(x, sum)\n\n#$a\n# [1] 1\n#\n# $b\n# [1] 15\n#\n# $c\n#[1]55\n\n<span style=\"color: #008080;\">#find the mean of each element in the list<\/span>\nlapply(x, mean)\n\n#$a\n# [1] 1\n#\n# $b\n# [1] 3\n#\n# $c\n# [1] 5.5\n\n<span style=\"color: #008080;\">#multiply values of each element by 5 and return results as a list<\/span>\nlapply(x, function(x) x*5)\n\n#$a\n# [1] 5\n#\n# $b\n# [1] 5 10 15 20 25\n#\n# $c\n# [1] 5 10 15 20 25 30 35 40 45 50\n<\/strong><\/pre>\n<h2><span style=\"color: #000000;\"><strong>\u7533\u8bf7\uff08\uff09<\/strong><\/span><\/h2>\n<p><span style=\"color: #000000;\">\u5f53\u60a8\u60f3\u8981\u5c06\u51fd\u6570\u5e94\u7528\u4e8e\u5217\u8868\u3001\u5411\u91cf\u6216\u6570\u636e\u5e27\u7684\u6bcf\u4e2a\u5143\u7d20\u5e76\u4ece\u800c\u83b7\u5f97<strong>\u5411\u91cf<\/strong>\u800c\u4e0d\u662f\u5217\u8868\u65f6\uff0c\u8bf7\u4f7f\u7528<strong>sapply()<\/strong>\u51fd\u6570\u3002<\/span><\/p>\n<p> <span style=\"color: #000000;\">sapply() \u51fd\u6570\u7684\u57fa\u672c\u8bed\u6cd5\u662f\uff1a<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"color: #000000;\"><strong>\u7533\u8bf7\uff08X\uff0c\u6709\u8da3\uff09<\/strong><\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">X \u662f\u5217\u8868\u3001\u5411\u91cf\u6216\u6570\u636e\u6846\u7684\u540d\u79f0<\/span><\/li>\n<li><span style=\"color: #000000;\">FUN \u662f\u60a8\u8981\u6267\u884c\u7684\u5177\u4f53\u64cd\u4f5c<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u5728\u6570\u636e\u6846\u4e2d\u7684\u5217\u4e0a\u4f7f\u7528<strong>sapply()<\/strong>\u7684\u51e0\u4e2a\u793a\u4f8b\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create a data frame with three columns and five rows\n<\/span>data &lt;- data.frame(a = c(1, 3, 7, 12, 9),\n                   b = c(4, 4, 6, 7, 8),\n                   c = c(14, 15, 11, 10, 6))\ndata\n\n#abc\n#1 1 4 14\n#2 3 4 15\n#3 7 6 11\n#4 12 7 10\n#5 9 8 6\n\n<span style=\"color: #008080;\">#find mean of each column and return results as a vector\n<\/span>sapply(data, mean)\n\n#abc\n#6.4 5.8 11.2 \n\n<span style=\"color: #008080;\">#multiply values in each column by 2 and return results as a matrix\n<\/span>sapply(data, function(data) data*2)\n\n#abc\n#[1,] 2 8 28\n#[2,] 6 8 30\n#[3,] 14 12 22\n#[4,] 24 14 20\n#[5,] 18 16 12<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528<strong>sapply()<\/strong>\u5bf9\u5217\u8868\u6267\u884c\u64cd\u4f5c\u3002\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u6267\u884c\u6b64\u64cd\u4f5c\u3002<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create a list\n<\/span>x &lt;- list(a=1, b=1:5, c=1:10) \nx\n\n#$a\n# [1] 1\n#\n# $b\n# [1] 1 2 3 4 5\n#\n# $c\n# [1] 1 2 3 4 5 6 7 8 9 10\n\n<span style=\"color: #008080;\">#find the sum of each element in the list<\/span>\nsapply(x, sum)\n\n#abc\n#1 15 55 \n\n<span style=\"color: #008080;\">#find the mean of each element in the list<\/span>\nsapply(x, mean)\n\n#abc\n#1.0 3.0 5.5\n<\/strong><\/pre>\n<h2><span style=\"color: #000000;\"><strong>\u8f7b\u6572\uff08\uff09<\/strong><\/span><\/h2>\n<p><span style=\"color: #000000;\">\u5f53\u60a8\u60f3\u8981\u5c06\u51fd\u6570\u5e94\u7528\u4e8e\u5411\u91cf\u7684\u5b50\u96c6\u5e76\u4e14\u5b50\u96c6\u7531\u53e6\u4e00\u4e2a\u5411\u91cf\uff08\u901a\u5e38\u662f\u56e0\u5b50\uff09\u5b9a\u4e49\u65f6\uff0c\u8bf7\u4f7f\u7528<strong>tapply()<\/strong>\u51fd\u6570\u3002<\/span><\/p>\n<p> <span style=\"color: #000000;\">tapply() \u51fd\u6570\u7684\u57fa\u672c\u8bed\u6cd5\u662f\uff1a<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"color: #000000;\"><strong>\u70b9\u51fb\uff08X\uff0c\u7d22\u5f15\uff0c\u4e50\u8da3\uff09<\/strong><\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">X\u662f\u5bf9\u8c61\u7684\u540d\u79f0\uff0c\u901a\u5e38\u662f\u5411\u91cf<\/span><\/li>\n<li><span style=\"color: #000000;\">INDEX \u662f\u4e00\u4e2a\u6216\u591a\u4e2a\u56e0\u7d20\u7684\u5217\u8868<\/span><\/li>\n<li><span style=\"color: #000000;\">FUN \u662f\u60a8\u8981\u6267\u884c\u7684\u5177\u4f53\u64cd\u4f5c<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u4ee5\u4e0b\u4ee3\u7801\u663e\u793a\u4e86\u5728 iris \u5d4c\u5165\u7684 R \u6570\u636e\u96c6\u4e0a\u4f7f\u7528<strong>tapply()<\/strong>\u7684\u793a\u4f8b<strong><em>\u3002<\/em><\/strong><\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#view first six lines of <em>iris<\/em> dataset<\/span>\nhead(iris)\n\n# Sepal.Length Sepal.Width Petal.Length Petal.Width Species\n#1 5.1 3.5 1.4 0.2 setosa\n#2 4.9 3.0 1.4 0.2 setosa\n#3 4.7 3.2 1.3 0.2 setosa\n#4 4.6 3.1 1.5 0.2 setosa\n#5 5.0 3.6 1.4 0.2 setosa\n#6 5.4 3.9 1.7 0.4 setosa\n\n<span style=\"color: #008080;\">#find the max Sepal.Length of each of the three Species<\/span>\ntapply(iris$Sepal.Length, iris$Species, max)\n\n#setosa versicolor virginica \n#5.8 7.0 7.9 \n\n<span style=\"color: #008080;\">#find the mean Sepal.Width of each of the three Species\n<\/span>tapply(iris$Sepal.Width, iris$Species, mean)\n\n# setosa versicolor virginica \n# 3,428 2,770 2,974\n\n<span style=\"color: #008080;\">#find the minimum Petal.Width of each of the three Species\n<\/span>tapply(iris$Petal.Width, iris$Species, min)\n\n# setosa versicolor virginica \n#0.1 1.0 1.4 \n<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6559\u7a0b\u89e3\u91ca\u4e86\u5185\u7f6e R \u51fd\u6570apply() \u3001 sapply() \u3001 lapply()\u548ctapply()\u4e4b\u95f4\u7684\u5dee [&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-469","post","type-post","status-publish","format-standard","hentry","category-11"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>R \u4e2d apply()\u3001lapply()\u3001sapply() \u548c tapply() \u7684\u6307\u5357 - Statorials<\/title>\n<meta name=\"description\" content=\"\u672c\u6559\u7a0b\u89e3\u91ca\u4e86\u5185\u7f6e R \u51fd\u6570 apply()\u3001sapply()\u3001lapply() \u548c tapply() \u4e4b\u95f4\u7684\u5dee\u5f02\u4ee5\u53ca\u4f7f\u7528\u793a\u4f8b\u3002\" \/>\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\/cn\/\u5728-r-\u4e2d\u5e94\u7528-lapply-sapply-\u548c-tapply-\u7684\u6307\u5357\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R \u4e2d apply()\u3001lapply()\u3001sapply() \u548c tapply() \u7684\u6307\u5357 - Statorials\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6559\u7a0b\u89e3\u91ca\u4e86\u5185\u7f6e R \u51fd\u6570 apply()\u3001sapply()\u3001lapply() \u548c tapply() \u4e4b\u95f4\u7684\u5dee\u5f02\u4ee5\u53ca\u4f7f\u7528\u793a\u4f8b\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/cn\/\u5728-r-\u4e2d\u5e94\u7528-lapply-sapply-\u548c-tapply-\u7684\u6307\u5357\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-29T19:40:31+00:00\" \/>\n<meta name=\"author\" content=\"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/\",\"url\":\"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/\",\"name\":\"R \u4e2d apply()\u3001lapply()\u3001sapply() \u548c tapply() \u7684\u6307\u5357 - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/cn\/#website\"},\"datePublished\":\"2023-07-29T19:40:31+00:00\",\"dateModified\":\"2023-07-29T19:40:31+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/cn\/#\/schema\/person\/124e4e5b7c9f8dc0f1f95cc8c1db3261\"},\"description\":\"\u672c\u6559\u7a0b\u89e3\u91ca\u4e86\u5185\u7f6e R \u51fd\u6570 apply()\u3001sapply()\u3001lapply() \u548c tapply() \u4e4b\u95f4\u7684\u5dee\u5f02\u4ee5\u53ca\u4f7f\u7528\u793a\u4f8b\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u5bb6\",\"item\":\"https:\/\/statorials.org\/cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R \u4e2d apply()\u3001lapply()\u3001sapply() \u548c tapply() \u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/cn\/#website\",\"url\":\"https:\/\/statorials.org\/cn\/\",\"name\":\"Statorials\",\"description\":\"\u60a8\u7684\u7edf\u8ba1\u7d20\u517b\u6307\u5357\uff01\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/cn\/#\/schema\/person\/124e4e5b7c9f8dc0f1f95cc8c1db3261\",\"name\":\"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/statorials.org\/cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/cn\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/cn\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a\"},\"description\":\"\u5927\u5bb6\u597d\uff0c\u6211\u662f\u672c\u6770\u660e\uff0c\u4e00\u4f4d\u9000\u4f11\u7684\u7edf\u8ba1\u5b66\u6559\u6388\uff0c\u540e\u6765\u6210\u4e3a Statorials \u7684\u70ed\u5fc3\u6559\u5e08\u3002 \u51ed\u501f\u5728\u7edf\u8ba1\u9886\u57df\u7684\u4e30\u5bcc\u7ecf\u9a8c\u548c\u4e13\u4e1a\u77e5\u8bc6\uff0c\u6211\u6e34\u671b\u5206\u4eab\u6211\u7684\u77e5\u8bc6\uff0c\u901a\u8fc7 Statorials \u589e\u5f3a\u5b66\u751f\u7684\u80fd\u529b\u3002\u4e86\u89e3\u66f4\u591a\",\"sameAs\":[\"https:\/\/statorials.org\/cn\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"R \u4e2d apply()\u3001lapply()\u3001sapply() \u548c tapply() \u7684\u6307\u5357 - Statorials","description":"\u672c\u6559\u7a0b\u89e3\u91ca\u4e86\u5185\u7f6e R \u51fd\u6570 apply()\u3001sapply()\u3001lapply() \u548c tapply() \u4e4b\u95f4\u7684\u5dee\u5f02\u4ee5\u53ca\u4f7f\u7528\u793a\u4f8b\u3002","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\/cn\/\u5728-r-\u4e2d\u5e94\u7528-lapply-sapply-\u548c-tapply-\u7684\u6307\u5357\/","og_locale":"zh_CN","og_type":"article","og_title":"R \u4e2d apply()\u3001lapply()\u3001sapply() \u548c tapply() \u7684\u6307\u5357 - Statorials","og_description":"\u672c\u6559\u7a0b\u89e3\u91ca\u4e86\u5185\u7f6e R \u51fd\u6570 apply()\u3001sapply()\u3001lapply() \u548c tapply() \u4e4b\u95f4\u7684\u5dee\u5f02\u4ee5\u53ca\u4f7f\u7528\u793a\u4f8b\u3002","og_url":"https:\/\/statorials.org\/cn\/\u5728-r-\u4e2d\u5e94\u7528-lapply-sapply-\u548c-tapply-\u7684\u6307\u5357\/","og_site_name":"Statorials","article_published_time":"2023-07-29T19:40:31+00:00","author":"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/","url":"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/","name":"R \u4e2d apply()\u3001lapply()\u3001sapply() \u548c tapply() \u7684\u6307\u5357 - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/cn\/#website"},"datePublished":"2023-07-29T19:40:31+00:00","dateModified":"2023-07-29T19:40:31+00:00","author":{"@id":"https:\/\/statorials.org\/cn\/#\/schema\/person\/124e4e5b7c9f8dc0f1f95cc8c1db3261"},"description":"\u672c\u6559\u7a0b\u89e3\u91ca\u4e86\u5185\u7f6e R \u51fd\u6570 apply()\u3001sapply()\u3001lapply() \u548c tapply() \u4e4b\u95f4\u7684\u5dee\u5f02\u4ee5\u53ca\u4f7f\u7528\u793a\u4f8b\u3002","breadcrumb":{"@id":"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/cn\/%e5%9c%a8-r-%e4%b8%ad%e5%ba%94%e7%94%a8-lapply-sapply-%e5%92%8c-tapply-%e7%9a%84%e6%8c%87%e5%8d%97\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u5bb6","item":"https:\/\/statorials.org\/cn\/"},{"@type":"ListItem","position":2,"name":"R \u4e2d apply()\u3001lapply()\u3001sapply() \u548c tapply() \u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/cn\/#website","url":"https:\/\/statorials.org\/cn\/","name":"Statorials","description":"\u60a8\u7684\u7edf\u8ba1\u7d20\u517b\u6307\u5357\uff01","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/statorials.org\/cn\/#\/schema\/person\/124e4e5b7c9f8dc0f1f95cc8c1db3261","name":"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/statorials.org\/cn\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/cn\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/cn\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a"},"description":"\u5927\u5bb6\u597d\uff0c\u6211\u662f\u672c\u6770\u660e\uff0c\u4e00\u4f4d\u9000\u4f11\u7684\u7edf\u8ba1\u5b66\u6559\u6388\uff0c\u540e\u6765\u6210\u4e3a Statorials \u7684\u70ed\u5fc3\u6559\u5e08\u3002 \u51ed\u501f\u5728\u7edf\u8ba1\u9886\u57df\u7684\u4e30\u5bcc\u7ecf\u9a8c\u548c\u4e13\u4e1a\u77e5\u8bc6\uff0c\u6211\u6e34\u671b\u5206\u4eab\u6211\u7684\u77e5\u8bc6\uff0c\u901a\u8fc7 Statorials \u589e\u5f3a\u5b66\u751f\u7684\u80fd\u529b\u3002\u4e86\u89e3\u66f4\u591a","sameAs":["https:\/\/statorials.org\/cn"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/posts\/469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/comments?post=469"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/posts\/469\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/media?parent=469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/categories?post=469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/tags?post=469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}