-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07f41ce
commit 7f8bb83
Showing
2 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
_freeze/posts/2023-12-07-View/index/execute-results/html.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"hash": "8d0bf591c3ab74506f1b49f65b553541", | ||
"hash": "06541d8a0e40972bb95f2f23923b8ec5", | ||
"result": { | ||
"markdown": "---\ntitle: \"Why is `View()` capitalized, anyway?\"\ndescription: \"And down the rabbit hole we go.\"\nauthor:\n - name: Mike Mahoney\n url: {}\ndate: \"2023-12-07\"\ncategories: [R]\nimage: banner.jpg\nformat: \n html:\n toc: true\nengine: knitr\n---\n\n\n[Over on BlueSky, David John Baker asks](https://bsky.app/profile/davidjohnbaker.bsky.social/post/3kfxbci3ji22h):\n\n![](post.png){fig-alt=\"Post from David John Baker on BlueSky: Why is does the `View()` function in R start with a capital V? I have no idea why. Does this have to do with functions that are not just dealing with some sort of standard output? #rstats\"}\n\nMy first thought on reading this was that `View()` in RStudio is built to mask the `View()` function from utils, and so capitalizes the V because utils capitalized the V. Things are the way they are because they are the way they are, yet again.\n\nBut of course, that's not the actual question -- not only did David specify he's talking about the function in _R_, not in _RStudio_, but of course someone decided that utils should capitalize the `View()` function as well. And this is weird! There are not that many functions in base R that start with a capital letter:\n\n\n::: {.cell}\n\n```{.r .cell-code}\ngetOption(\"defaultPackages\") |> \n setdiff(\"datasets\") |> \n vapply(\\(x) paste0(\"package:\", x), character(1)) |> \n ls() |> \n strsplit(\"\") |> \n Filter(f = \\(x) x[[1]] %in% LETTERS) |> \n vapply(paste0, character(1), collapse = \"\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n [1] \"Rprof\" \"Rprofmem\" \"RShowDoc\" \n [4] \"RSiteSearch\" \"Rtangle\" \"RtangleFinish\" \n [7] \"RtangleRuncode\" \"RtangleSetup\" \"RtangleWritedoc\" \n[10] \"RweaveChunkPrefix\" \"RweaveEvalWithOpt\" \"RweaveLatex\" \n[13] \"RweaveLatexFinish\" \"RweaveLatexOptions\" \"RweaveLatexSetup\" \n[16] \"RweaveLatexWritedoc\" \"RweaveTryStop\" \"Stangle\" \n[19] \"Sweave\" \"SweaveHooks\" \"SweaveSyntaxLatex\" \n[22] \"SweaveSyntaxNoweb\" \"SweaveSyntConv\" \"URLdecode\" \n[25] \"URLencode\" \"View\" \n```\n:::\n:::\n\n\nThese functions all follow one of three patterns:\n\n+ Functions that start with `R` or `S`, capitalized because it's the name of a programming language; \n+ Functions that start with URL;\n+ `View()` _by itself_!\n\nSo `View()` is weird; it's the only function that starts with a capital letter that's not named after a proper noun.^[[Merriam-Webster calls \"URL\" a noun](https://www.merriam-webster.com/dictionary/URL), even if it originated as an acronym, get out of my comments.] And it's been weird for a long time. The original version of the function was also capitalized when it was added by Professor Brian D Ripley way back in 2007:\n\n![](commit.png){fig-alt=\"Commit by Prof. Brian D Ripley on Feb 19 2007, adding the capitalized `View()` function.\"}\n\nNow here's where we enter the world of wild speculation. Because if we look at the documentation for `View()`, we can see that this function is meant to \"Invoke a Data Viewer\", with \"Data Viewer\" capitalized like a proper noun in both the function title and description:\n\n![](ViewDoc.png){fig-alt=\"The rd documentation file for `View()`. Notably, the Description field capitalizes the phrase Data Viewer.\"}\n\nThis isn't a universal style. If we look for instance at the documentation for `edit()`, which pre-dates `View()`,^[Though I'm not sure who originally wrote it; I get a bit lost in the VCS logs from before base functions were split into sub-packages.] we can see that \"text editor\" is capitalized in the title but not in the description:\n\n![](EditDoc.png){fig-alt=\"The rd documentation file for `edit()`. Notably, the Description field _does not_ capitalize the phrase text editor.\"}\n\nSo this makes me suspect that Data Viewer here is being used as a proper noun. This wouldn't be a unique usage; for instance, the [RStudio user guide also describes its viewer as a Data Viewer, capitalized](https://docs.posit.co/ide/user/ide/guide/data/data-viewer.html), and a search for \"Data Viewer\" suggests the phrase is capitalized something like 2/3 of the time on public websites. I have absolutely no knowledge of the tech jargon of 2007, or of the proper styling of \"data viewer\",^[And I assume these two things are related!] but it does seem like it's _sometimes_ a proper noun.\n\nSo, to wildly speculate just a little further: is `View()` capitalized because \"Viewer\" was capitalized, at least back in 2007?\n\nNow, here's a decent piece of evidence _against_ this conjecture: the details section of the `View()` documentation, added at the same time as the title and description,^[And the function itself; all of this documentation is also still in the official help file.] doesn't capitalize the phrase \"data viewer\":\n\n![](ViewDetails.png){fig-alt=\"The details section of the `View()` documentation. Data viewer is not capitalized.\"}\n\nThat said, this is also not unique. That same [RStudio user guide also sometimes writes \"data viewer\" in lowercase](https://docs.posit.co/ide/user/ide/guide/data/data-viewer.html#scrolling), though in _most_ of the guide it's treated as a proper noun.\n\nSo there's one guess: maybe `View()` is capitalized because, like the functions starting with R and S and URL, it's named after a proper noun. Things are the way they are because they are the way they are, yet again.\n\nIf anyone knows more, though -- or feels like asking Professor Ripley -- please drop me a line. I'd love to know the actual answer.\n", | ||
"markdown": "---\ntitle: \"Why is `View()` capitalized, anyway?\"\ndescription: \"And down the rabbit hole we go.\"\nauthor:\n - name: Mike Mahoney\n url: {}\ndate: \"2023-12-07\"\ncategories: [R]\nimage: banner.jpg\nformat: \n html:\n toc: true\nengine: knitr\n---\n\n\n[Over on BlueSky, David John Baker asks](https://bsky.app/profile/davidjohnbaker.bsky.social/post/3kfxbci3ji22h):\n\n![](post.png){fig-alt=\"Post from David John Baker on BlueSky: Why is does the `View()` function in R start with a capital V? I have no idea why. Does this have to do with functions that are not just dealing with some sort of standard output? #rstats\"}\n\nMy first thought on reading this was that `View()` in RStudio is built to mask the `View()` function from utils, and so capitalizes the V because utils capitalized the V. Things are the way they are because they are the way they are, yet again.\n\nBut of course, that's not the actual question -- not only did David specify he's talking about the function in _R_, not in _RStudio_, but of course someone decided that utils should capitalize the `View()` function as well. And this is weird! There are not that many functions in base R that start with a capital letter:\n\n\n::: {.cell}\n\n```{.r .cell-code}\ngetOption(\"defaultPackages\") |> \n setdiff(\"datasets\") |> \n vapply(\\(x) paste0(\"package:\", x), character(1)) |> \n ls() |> \n strsplit(\"\") |> \n Filter(f = \\(x) x[[1]] %in% LETTERS) |> \n vapply(paste0, character(1), collapse = \"\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n [1] \"Rprof\" \"Rprofmem\" \"RShowDoc\" \n [4] \"RSiteSearch\" \"Rtangle\" \"RtangleFinish\" \n [7] \"RtangleRuncode\" \"RtangleSetup\" \"RtangleWritedoc\" \n[10] \"RweaveChunkPrefix\" \"RweaveEvalWithOpt\" \"RweaveLatex\" \n[13] \"RweaveLatexFinish\" \"RweaveLatexOptions\" \"RweaveLatexSetup\" \n[16] \"RweaveLatexWritedoc\" \"RweaveTryStop\" \"Stangle\" \n[19] \"Sweave\" \"SweaveHooks\" \"SweaveSyntaxLatex\" \n[22] \"SweaveSyntaxNoweb\" \"SweaveSyntConv\" \"URLdecode\" \n[25] \"URLencode\" \"View\" \n```\n:::\n:::\n\n\nThese functions all follow one of three patterns:\n\n+ Functions that start with `R` or `S`, capitalized because it's the name of a programming language; \n+ Functions that start with URL;\n+ `View()` _by itself_!\n\n**Update:**\n\nA few minutes after publishing, [Konrad Rudolph points out on Mastodon](https://fosstodon.org/@[email protected]/111540097245999105) that there are plenty of functions in the base package _itself_ that are capitalized and don't match these rules:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nls(\"package:base\") |> \n strsplit(\"\") |> \n Filter(f = \\(x) x[[1]] %in% LETTERS) |> \n vapply(paste0, character(1), collapse = \"\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n [1] \"Arg\" \"Conj\" \n [3] \"Cstack_info\" \"Encoding\" \n [5] \"Encoding<-\" \"F\" \n [7] \"Filter\" \"Find\" \n [9] \"I\" \"Im\" \n[11] \"ISOdate\" \"ISOdatetime\" \n[13] \"La_library\" \"La_version\" \n[15] \"La.svd\" \"LETTERS\" \n[17] \"Map\" \"Math.data.frame\" \n[19] \"Math.Date\" \"Math.difftime\" \n[21] \"Math.factor\" \"Math.POSIXt\" \n[23] \"Mod\" \"NCOL\" \n[25] \"Negate\" \"NextMethod\" \n[27] \"NROW\" \"OlsonNames\" \n[29] \"Ops.data.frame\" \"Ops.Date\" \n[31] \"Ops.difftime\" \"Ops.factor\" \n[33] \"Ops.numeric_version\" \"Ops.ordered\" \n[35] \"Ops.POSIXt\" \"Position\" \n[37] \"R_compiled_by\" \"R_system_version\" \n[39] \"R.home\" \"R.version\" \n[41] \"R.Version\" \"R.version.string\" \n[43] \"Re\" \"Recall\" \n[45] \"Reduce\" \"RNGkind\" \n[47] \"RNGversion\" \"Summary.data.frame\" \n[49] \"Summary.Date\" \"Summary.difftime\" \n[51] \"Summary.factor\" \"Summary.numeric_version\"\n[53] \"Summary.ordered\" \"Summary.POSIXct\" \n[55] \"Summary.POSIXlt\" \"Sys.chmod\" \n[57] \"Sys.Date\" \"Sys.getenv\" \n[59] \"Sys.getlocale\" \"Sys.getpid\" \n[61] \"Sys.glob\" \"Sys.info\" \n[63] \"Sys.localeconv\" \"Sys.readlink\" \n[65] \"Sys.setenv\" \"Sys.setFileTime\" \n[67] \"Sys.setLanguage\" \"Sys.setlocale\" \n[69] \"Sys.sleep\" \"Sys.time\" \n[71] \"Sys.timezone\" \"Sys.umask\" \n[73] \"Sys.unsetenv\" \"Sys.which\" \n[75] \"T\" \"UseMethod\" \n[77] \"Vectorize\" \n```\n:::\n:::\n\n\nOne of those is `Filter()`, which I _literally used in the original code chunk_ and somehow didn't notice started with a capital letter.\n\n< / update >\n\nBut even with that said, `View()` is the only function _in recommended packages_ that starts with a capital letter that's not named after a proper noun.^[[Merriam-Webster calls \"URL\" a noun](https://www.merriam-webster.com/dictionary/URL), even if it originated as an acronym, get out of my comments.] And it's been weird for a long time. The original version of the function was also capitalized when it was added by Professor Brian D Ripley way back in 2007:\n\n![](commit.png){fig-alt=\"Commit by Prof. Brian D Ripley on Feb 19 2007, adding the capitalized `View()` function.\"}\n\nNow here's where we enter the world of wild speculation. Because if we look at the documentation for `View()`, we can see that this function is meant to \"Invoke a Data Viewer\", with \"Data Viewer\" capitalized like a proper noun in both the function title and description:\n\n![](ViewDoc.png){fig-alt=\"The rd documentation file for `View()`. Notably, the Description field capitalizes the phrase Data Viewer.\"}\n\nThis isn't a universal style. If we look for instance at the documentation for `edit()`, which pre-dates `View()`,^[Though I'm not sure who originally wrote it; I get a bit lost in the VCS logs from before base functions were split into sub-packages.] we can see that \"text editor\" is capitalized in the title but not in the description:\n\n![](EditDoc.png){fig-alt=\"The rd documentation file for `edit()`. Notably, the Description field _does not_ capitalize the phrase text editor.\"}\n\nSo this makes me suspect that Data Viewer here is being used as a proper noun. This wouldn't be a unique usage; for instance, the [RStudio user guide also describes its viewer as a Data Viewer, capitalized](https://docs.posit.co/ide/user/ide/guide/data/data-viewer.html), and a search for \"Data Viewer\" suggests the phrase is capitalized something like 2/3 of the time on public websites. I have absolutely no knowledge of the tech jargon of 2007, or of the proper styling of \"data viewer\",^[And I assume these two things are related!] but it does seem like it's _sometimes_ a proper noun.\n\nSo, to wildly speculate just a little further: is `View()` capitalized because \"Viewer\" was capitalized, at least back in 2007?\n\nNow, here's a decent piece of evidence _against_ this conjecture: the details section of the `View()` documentation, added at the same time as the title and description,^[And the function itself; all of this documentation is also still in the official help file.] doesn't capitalize the phrase \"data viewer\":\n\n![](ViewDetails.png){fig-alt=\"The details section of the `View()` documentation. Data viewer is not capitalized.\"}\n\nThat said, this is also not unique. That same [RStudio user guide also sometimes writes \"data viewer\" in lowercase](https://docs.posit.co/ide/user/ide/guide/data/data-viewer.html#scrolling), though in _most_ of the guide it's treated as a proper noun.\n\nSo there's one guess: maybe `View()` is capitalized because, like the functions starting with R and S and URL, it's named after a proper noun. Things are the way they are because they are the way they are, yet again.\n\nIf anyone knows more, though -- or feels like asking Professor Ripley -- please drop me a line. I'd love to know the actual answer.\n", | ||
"supporting": [], | ||
"filters": [ | ||
"rmarkdown/pagebreak.lua" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,22 @@ These functions all follow one of three patterns: | |
+ Functions that start with URL; | ||
+ `View()` _by itself_! | ||
|
||
So `View()` is weird; it's the only function that starts with a capital letter that's not named after a proper noun.^[[Merriam-Webster calls "URL" a noun](https://www.merriam-webster.com/dictionary/URL), even if it originated as an acronym, get out of my comments.] And it's been weird for a long time. The original version of the function was also capitalized when it was added by Professor Brian D Ripley way back in 2007: | ||
**Update:** | ||
|
||
A few minutes after publishing, [Konrad Rudolph points out on Mastodon](https://fosstodon.org/@[email protected]/111540097245999105) that there are plenty of functions in the base package _itself_ that are capitalized and don't match these rules: | ||
|
||
```{r} | ||
ls("package:base") |> | ||
strsplit("") |> | ||
Filter(f = \(x) x[[1]] %in% LETTERS) |> | ||
vapply(paste0, character(1), collapse = "") | ||
``` | ||
|
||
One of those is `Filter()`, which I _literally used in the original code chunk_ and somehow didn't notice started with a capital letter. | ||
|
||
< / update > | ||
|
||
But even with that said, `View()` is the only function _in recommended packages_ that starts with a capital letter that's not named after a proper noun.^[[Merriam-Webster calls "URL" a noun](https://www.merriam-webster.com/dictionary/URL), even if it originated as an acronym, get out of my comments.] And it's been weird for a long time. The original version of the function was also capitalized when it was added by Professor Brian D Ripley way back in 2007: | ||
|
||
![](commit.png){fig-alt="Commit by Prof. Brian D Ripley on Feb 19 2007, adding the capitalized `View()` function."} | ||
|
||
|