Re: [R] how to deal with deprecated functions
Ok I understand. I wasn't intended to look as complaining, sorry. It was interesting to get the pointview of a developer (thanks JC Nash). To code a new package comprising useful but deprecated functions is a very good advice, thanks, I will try to hone my coding skills to do so (and to be more involved with the R community as well). Thanks again for your feedback Dr. Néstor Toledo División Paleontología Vertebrados ntol...@fcnym.unlp.edu.ar Unidades de Investigación Anexo Museo FCNyM-UNLP Av. 60 y 122 B1900FWA (B1906CXT) La Plata, Argentina Tel. 54 221 422 8451 int 115 of 115 http://sedici.unlp.edu.ar/handle/10915/55101 El jue., 5 de dic. de 2019 14:16, Duncan Murdoch escribió: > On 04/12/2019 2:07 p.m., Nestor Toledo wrote: > > Hello everyone, even I'm not fluent in coding, R has become a > > fundamental part of my daily work as a researcher and I'm very much > > grateful for such a wonderful, open tool. However, I have faced in many > > opportunities the problems associated with updates/upgrades of packages. > > Frequently packages developers modify command syntax or directly > > deprecate entire functions. This becomes a nuisance, since I must to > > recode my scripts partially or totally, or even search for alternative > > functions in other packages. Is there any solution to this, other than > > skip updates or keeping old versions installed in a different folder? > > Could be acceptable ask developers to do not deprecate functions but > > keep them as "legacy" ones or similar? > > > > Thanks in advance and I apologize for my deficient English grammar > > > > As Rui said, there's no easy way to prevent this. In my experience, > most maintainers are quite willing to avoid changes that cause problems, > or help users to work around them: but they have to know that problems > were caused. > > The easiest way to do this is to share your own code by putting it in a > package on CRAN with sufficient tests to detect problems. When a > package maintainer submits a package update, CRAN checks that all > "revdeps" (i.e. reverse dependencies, packages that depend on the > updated one) still pass their tests. The submitter is asked to contact > the maintainers of the other packages to resolve any new problems. > > Duncan Murdoch > [[alternative HTML version deleted]] __ 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.
Re: [R] R commander (Rcmdr) won't start [SOLVED]
Dear Gabriele, I'm glad that you were able to solve your problem. I spent a bit of time today updating my R from 3.6.0 to 3.6.1 and updating all R packages on Ubuntu, and, for what is now an obvious reason, I was unable to duplicate the problem. Saving the .Rhistory file is benign but saving the R workspace at the end of a session in .RData can be problematic, and not just for the Rcmdr. You'll notice that while R makes saving the workspace the default (presumably to avoid inadvertent data loss, and in my opinion not a good default choice), the Rcmdr doesn't offer to save the R workspace when you select "File > Exit > From Commander and R" from the Rcmdr menus. Best, John - John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada Web: http::/socserv.mcmaster.ca/jfox > On Dec 6, 2019, at 1:38 PM, gabriele pallotti wrote: > > I managed to get Rcmdr working simply by deleting the .Rdata and .Rhistory > file from the work directory. It is rather weird, as I thought they only > contained data and settings, but probably some of these belonged to the > older version of R/Rcmdr and were not compatible with the new version. > I'll keep the old data files in a separate folder and try to open them as a > workspace after launching Rcmdr, but I won't do it now as I need Rcmdr to > work in the next days and I don't want to take any risks... > > [[alternative HTML version deleted]] > > __ > 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. __ 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.
Re: [R] R commander (Rcmdr) won't start [SOLVED]
Experienced R users avoid creating .Rdata files (with nothing in front of the period) because R will automatically load them and any mistakes recorded there can interfere with future uses of R when started from the directory containing that file. RData files with something in front of the period can be loaded interactively and any problems they bring can be avoided by simply not choosing to load them. .Rhistory files have no such negative effect... it is highly unlikely that that file was causing you any problems. They are just a record of R commands that have been used and are only retrieved by R user interfaces such as Rgui or RStudio upon request. On December 6, 2019 10:38:45 AM PST, gabriele pallotti wrote: >I managed to get Rcmdr working simply by deleting the .Rdata and >.Rhistory >file from the work directory. It is rather weird, as I thought they >only >contained data and settings, but probably some of these belonged to the >older version of R/Rcmdr and were not compatible with the new version. >I'll keep the old data files in a separate folder and try to open them >as a >workspace after launching Rcmdr, but I won't do it now as I need Rcmdr >to >work in the next days and I don't want to take any risks... > > [[alternative HTML version deleted]] > >__ >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. -- Sent from my phone. Please excuse my brevity. __ 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.
[R] R commander (Rcmdr) won't start [SOLVED]
I managed to get Rcmdr working simply by deleting the .Rdata and .Rhistory file from the work directory. It is rather weird, as I thought they only contained data and settings, but probably some of these belonged to the older version of R/Rcmdr and were not compatible with the new version. I'll keep the old data files in a separate folder and try to open them as a workspace after launching Rcmdr, but I won't do it now as I need Rcmdr to work in the next days and I don't want to take any risks... [[alternative HTML version deleted]] __ 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.
Re: [R] How prevent update of a package
Thanks for your answer. I try this trick: mkdir packages sudo chmod -R a+w packages ls -al drwxrwxrwx��� 2 marcgirondot staff� 64� 6 d�c 17:20 packages Now in R > require(devtools) > > install_version("raster", version = "2.5-8", repos ="http://cran.us.r-project.org;, ��� lib="/Users/marcgirondot/ Here the full path /packages") And I get: Erreur : Failed to install 'unknown package' from URL: � (converti depuis l'avis) 'lib = "/Users/marcgirondot/Documents/Espace_de_travail_R/packages "' is not writable Not sure were I do something wrong. Thanks if you have an idea. Marc Le 06/12/2019 � 08:42, Amit Mittal a �crit�: > Just install Older R from the project R archives in a separate directory > > Best Regards > > Please excuse the brevity of the message. This message was sent from a > mobile device. > > *From:* R-help on behalf of Marc > Girondot via R-help > *Sent:* Friday, December 6, 2019 1:09 PM > *To:* R-help Mailing List > *Subject:* [R] How prevent update of a package > I use R 3.6.1 in macOSX 10.15.1 (Catalina). > > I cannot install the last version (3.0-7) of the package raster from > source or from binary. In both cases I get > > ??*** caught segfault *** > address 0x31, cause 'memory not mapped' > > when I try to load it. > > Same occurs when I use the development version using: > > library(devtools) > install_github("rspatial/raster") > > This is the same bug as described here: > https://github.com/rspatial/raster/issues/63 > > The last working version for me is the 2.5-8 > > require(devtools) > install_version("raster", version = "2.5-8", repos = > "http://cran.us.r-project.org;) > > However, each time that I use update.packages(), raster wants to be > updated. > > So here my three questions: > > - Does someone has a solution to have raster 3.0-7 working in MacOSX ? > > - Do others have raster 3.0-7 working in R 3.6.1 and Catalina MacOSX ? > > - How to prevent raster package to be updated ? > > Thanks a lot > > Marc > > __ > 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. [[alternative HTML version deleted]] __ 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.
[R] A better scales::dollar() ?
I'm writing a quite large document in Rmarkdown which has financial data in it. I format that data using scales::dollar() currently something like this: > > require (scales) > x = 10 > cat (dollar (x, prefix ="£", big.mark=",")) £100,000 But actually, I'd quite like to get £100k out in that instance so I'd do: > cat (dollar (x/10^3, prefix ="£", suffix="k" )) £100k But x could be 100 or 10,000,000. I want some form of 'automatic' version that might give me something like: > > require (scales) > y = 0:7 > x = 1^y > dollar(x, prefix="£") [1] "£1" "£10" "£100""£1,000" "£10,000" "£100,000""£1,000,000" "£10,000,000" But what I want is more like: £1.00 £10.00 £100 £1k £10k £100k £1m £10m I'm sure I can write something as a little function, but before I do - is there something already out there? I have a similar need to format milligrams through to kilograms. This message may contain confidential information. If you are not the intended recipient please inform the sender that you have received the message in error before deleting it. Please do not disclose, copy or distribute information in this e-mail or take any action in relation to its contents. To do so is strictly prohibited and may be unlawful. Thank you for your co-operation. NHSmail is the secure email and directory service available for all NHS staff in England and Scotland. NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and other accredited email services. For more information and to find out how you can switch, https://portal.nhs.net/help/joiningnhsmail __ 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.
[R] R commander (Rcmdr) won't start
Hallo I've been using R and R commander (Rcmdr) for some years, never had problems. I'm on Xubuntu 16.04. Yesterday I updated R from 3.4.4 to 3.6.1 and all sorts of problems occurred. Firstly I completely removed R from my system, including old directories (with some hiccups, I must admit). Then I installed R and R-dev without issues. Had some issues installing Rcmdr, but in the end I met all the requirements and installed all the requested packages, including rgl and a few others that were requested upon first launching Rcmdr. After that, no more error messages. However, whenever I launch R commander I get these lines, which don't mention any problem, but the GUI won't launch. > library(Rcmdr) Carico il pacchetto richiesto: splines Carico il pacchetto richiesto: RcmdrMisc Carico il pacchetto richiesto: car Carico il pacchetto richiesto: carData Carico il pacchetto richiesto: sandwich Carico il pacchetto richiesto: effects Registered S3 methods overwritten by 'lme4': method from cooks.distance.influence.merMod car influence.merModcar dfbeta.influence.merMod car dfbetas.influence.merModcar lattice theme set by effectsTheme() See ?effectsTheme for details. After seeing, if I type library(Rcmdr) again, nothing happens. I installed Hmisc, leaps and aplpack, as these were indicated as possible solutions, but to no avail. This is the output of sys.info and sessionInfo > Sys.info() sysname "Linux" release "4.4.0-170-generic" version "#199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019" nodename "me-HP430" machine "x86_64" login "me" user "me" effective_user "me" > sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.6 LTS Matrix products: default BLAS: /usr/lib/libblas/libblas.so.3.6.0 LAPACK: /usr/lib/lapack/liblapack.so.3.6.0 Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding locale: [1] LC_CTYPE=it_IT.UTF-8 LC_NUMERIC=C [3] LC_TIME=it_IT.UTF-8LC_COLLATE=it_IT.UTF-8 [5] LC_MONETARY=it_IT.UTF-8LC_MESSAGES=it_IT.UTF-8 [7] LC_PAPER=it_IT.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=it_IT.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] effects_4.1-4 RcmdrMisc_2.5-1 sandwich_2.5-1 car_3.0-5 [5] carData_3.0-3 loaded via a namespace (and not attached): [1] Rcpp_1.0.3 lattice_0.20-38 tcltk2_1.2-11 [4] class_7.3-15zoo_1.8-6 relimp_1.0-5 [7] zeallot_0.1.0 digest_0.6.23 R6_2.4.1 [10] cellranger_1.1.0backports_1.1.5 acepack_1.4.1 [13] survey_3.36 e1071_1.7-3 ggplot2_3.2.1 [16] pillar_1.4.2rlang_0.4.2 lazyeval_0.2.2 [19] curl_4.3readxl_1.3.1minqa_1.2.4 [22] rstudioapi_0.10 data.table_1.12.6 nloptr_1.2.1 [25] rpart_4.1-15Matrix_1.2-18 checkmate_1.9.4 [28] lme4_1.1-21 stringr_1.4.0 foreign_0.8-72 [31] htmlwidgets_1.5.1 munsell_0.5.0 compiler_3.6.1 [34] xfun_0.11 pkgconfig_2.0.3 base64enc_0.1-3 [37] mitools_2.4 htmltools_0.4.0 tcltk_3.6.1 [40] nnet_7.3-12 tibble_2.1.3gridExtra_2.3 [43] htmlTable_1.13.3Hmisc_4.3-0 rio_0.5.16 [46] Rcmdr_2.6-1 crayon_1.3.4MASS_7.3-51.4 [49] grid_3.6.1 DBI_1.0.0 nlme_3.1-142 [52] gtable_0.3.0lifecycle_0.1.0 magrittr_1.5 [55] scales_1.1.0zip_2.0.4 stringi_1.4.3 [58] latticeExtra_0.6-28 vctrs_0.2.0 boot_1.3-23 [61] openxlsx_4.1.3 nortest_1.0-4 Formula_1.2-3 [64] RColorBrewer_1.1-2 tools_3.6.1 forcats_0.4.0 [67] hms_0.5.2 abind_1.4-5 survival_3.1-8 [70] colorspace_1.4-1cluster_2.1.0 knitr_1.26 [73] haven_2.2.0 This is the list of installed packages: PackageVersion aplpack 1.3.3 Hmisc 4.3-0 leaps3.0 Rcmdr 2.6-1 abind 1.4-5 acepack 1.4.1 aplpack 1.3.3 arm 1.10-1 assertthat 0.2.1 backports 1.1.5 base64enc 0.1-3 BH 1.69.0-1 callr 3.3.2 car 3.0-5
Re: [R] Help to write the R-code, please
> Richard O'Keefe > on Fri, 6 Dec 2019 12:18:50 +1300 writes: > This particular task is not a problem about R. > It is a problem n combinatorics. > Start with the obvious brute force algorithm > (1) Let S be the union of all the sets > (2) For each K in 0 .. |S| > (3) Enumerate all |S| choose K subsets C of S > (4) If C satisfies the condition, report it and stop > (5) Report that there is no solution. > There is a function 'combn' in the 'combinat' package that > is perfectly suited to step 3. combn() in "base R" (package 'utils') should probably suffice; its help page [ help(combn) ] also mentions Author(s): Scott Chasalow wrote the original in 1994 for S; R package ‘combinat’ and documentation by Vince Carey ; small changes by the R core team, notably to return an array in all cases of ‘simplify = TRUE’, e.g., for ‘combn(5,5)’. which may suggest that R's ("utils") version of combn() may even be slightly improved > I have not examined your outlined solution. Even if it is right, > it pays to START by writing a crude obvious brute force > algorithm like this so that you can test your test cases. Definitely! First be *right*, only then think of being fast .. Martin > On Fri, 6 Dec 2019 at 03:14, Александр Дубровский > wrote: >> >> Task: >> A family of sets of letters is given. Find K for which one can construct a >> set consisting of K letters, each of them belonging to exactly K sets of a >> given family. >> >> Possible solution: >> For each letter, we will have a separate 'scoop', in which we will' put ' >> the letter. This can be done using array A of 255 elements. In this case, >> the number of the 'scoop' corresponding to a letter is determined by the >> letter code (it is known that any letter is encoded by some binary number >> containing 8 digits - called bits; in Pascal, its code can be determined by >> using the ord function). When viewing the sets, let's count how many times >> each letter met. This is done as follows. When you meet a letter, increase >> the contents of the corresponding array element by 1. The initial contents >> of the array elements are 0. After viewing the letters of all sets, >> elements a determine the number of corresponding letters, and therefore the >> number of sets that have the corresponding letter (because in one set, all >> elements are different!). Using similarly array B from 255 elements (more >> need not, so as the desired the number of to on condition not exceeds >> number of letters) count the number of units, twos and so on in array A. >> Maximum significance index K, for which K=B[K] and will solution meet the >> tasks. >> >> [[alternative HTML version deleted]] >> >> __ >> 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. > __ > 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. __ 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.