Hi Ivan, Thanks for the suggestions. Will try them. -------- Keith
On Fri, Aug 23, 2024 at 1:57 AM Ivan Krylov <ikry...@disroot.org> wrote: > > В Thu, 22 Aug 2024 13:07:37 -0600 > Keith Christian <keith1christ...@gmail.com> пишет: > > > I'm interested in R construct(s) to be entered at the command > > line that would output slope, y-intercept, and r-squared values read > > from a csv or other filename entered at the command line, and the same > > for standard deviation calculations, namely the standard deviation, > > variance, and z-scores for every data point in the file. > > If you'd like to script R at the command line, consider the > commandArgs() function (try entering ?commandArgs at the R prompt). > This way you can pass a file path to an R process without unsafely > interpolating it into the R expression itself. These arguments can be > given to R --args or to Rscript (without the --args). > > Also consider the 'littler' scripting-oriented R front-end > <https://CRAN.R-project.org/package=littler>, which puts the command > line arguments into the 'argv' variable and has a very convenient -d > option which loads CSV data from the standard input into a variable > named 'X'. > > > Are line numbers, commas, etc. needed or no? > > Depends on how you read it. By default, the function read.table() will > expect your data to be separated by a mixture of tabs and spaces and > will recognise a header if the first line contains one less column than > the rest of the file. Enter ?read.table at the R prompt to see the > available options (which include read.csv). > > Good introductions to R include, well, "An Introduction to R" [1] (also > available by typing RShowDoc('R-intro') into the R prompt) and "Visual > Statistics" by Dr. A. Shipunov [2]. > > Start with functions read.table(), lm(), scale(), sd(), summary(). Use > str() to look at the structure of a variable: summary(lm(...)) will > return a named list from which you can extract the values you are > interested in (see ?summary.lm). When in doubt, call > help(name_of_the_function). > > -- > Best regards, > Ivan > > [1] > https://cran.r-project.org/doc/manuals/R-intro.html > > [2] > http://web.archive.org/web/20230106210646/http://ashipunov.info/shipunov/school/biol_240/en/visual_statistics.pdf ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.