В Sun, 14 Jul 2024 03:16:56 -0400 DynV Montrealer <dyn...@gmail.com> пишет:
> Perhaps some way to break the spreadsheet data (eg XLdata <- > read_excel(...)), then put it back together without any writing to a > file (eg XLdataReformed <- reform(XLdata)) ? read_excel() is documented to return objects of class tibble: https://cran.r-project.org/package=tibble/vignettes/tibble.html Long story short, tibbles are named lists of columns, so it should be possible for you to access and replace the individual parts of them using the standard list subset syntax XLdata[[columnname]]. Lists are described in R Intro chapter 6 and many other books on R: https://cran.r-project.org/doc/manuals/R-intro.html#Lists-and-data-frames http://web.archive.org/web/20230415001551if_/http://ashipunov.info/shipunov/school/biol_240/en/visual_statistics.pdf (see section 3.8.2 on page 93 and following) > In addition, from is.integer() documentation I ran > > > is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x > > - round (x)) < tol > > and I'm now trying to have it stop at the 1st decimal content of a > column. If you'd like to write idiomatic R code, consider the fact that is.wholenumber is vectorised: is.wholenumber(c(1,2,3,pi)) # [1] TRUE TRUE TRUE FALSE Given a vector of numbers, it will return a vector of the same length specifying whether each element can be considered a whole number. Combine it with all() and you can test the whole column in two function calls. R also has a type.convert function that may be useful in this case: https://search.r-project.org/R/refmans/utils/html/type.convert.html -- Best regards, Ivan ______________________________________________ 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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.