[R] diff question
R version 3.1.1 (2014-07-10) -- Sock it to Me Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) Dear friends - I have a small problem with diff (I guess) I made a sequence with fixed interval between consecutive elements - and hence thought the diff would be as specified but had a vector with apparently identical 12 elements returned from diff tt - seq(0,20,by=0.02) unique(diff(tt)) #[1] 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 Trying to see if these elements in diff were duplicated duplicated(diff(tt)) #[1] FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE TRUE and from sum(duplicated(diff(tt))) [1] 988 saw that 12 of the elements in duplicated(diff(tt)) were FALSE. Would it be expected that the first was FALSE and the rest TRUE? |duplicated()|determines which elements of a vector or data frame are duplicates of elements with smaller subscripts, and returns a logical vector indicating which elements (rows) are duplicates. All best wishes Troels Aalborg, Denmark [[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] diff question
See FAQ 7.31. cheers, Rolf Turner On 11/01/15 21:29, Troels Ring wrote: R version 3.1.1 (2014-07-10) -- Sock it to Me Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) Dear friends - I have a small problem with diff (I guess) I made a sequence with fixed interval between consecutive elements - and hence thought the diff would be as specified but had a vector with apparently identical 12 elements returned from diff tt - seq(0,20,by=0.02) unique(diff(tt)) #[1] 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 Trying to see if these elements in diff were duplicated duplicated(diff(tt)) #[1] FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE TRUE and from sum(duplicated(diff(tt))) [1] 988 saw that 12 of the elements in duplicated(diff(tt)) were FALSE. Would it be expected that the first was FALSE and the rest TRUE? |duplicated()|determines which elements of a vector or data frame are duplicates of elements with smaller subscripts, and returns a logical vector indicating which elements (rows) are duplicates. -- Rolf Turner Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 Home phone: +64-9-480-4619 __ 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] diff question
Troels, this is due to the usual tiny difference between numbers as computed by R and the numbers that you think they are! tt - seq(0,20,by=0.02) dtt - diff(tt) length(dtt) # [1] 1000 r02 - rep(0.02,1000) unique(r02 - dtt) # [1] 0.00e+00 3.469447e-18 -3.469447e-18 1.040834e-17 # [5] -1.734723e-17 3.816392e-17 9.367507e-17 2.046974e-16 # [9] 4.267420e-16 -4.614364e-16 -1.349615e-15 -3.125972e-15 Hoping this helps! Ted. On 11-Jan-2015 08:29:26 Troels Ring wrote: R version 3.1.1 (2014-07-10) -- Sock it to Me Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) Dear friends - I have a small problem with diff (I guess) I made a sequence with fixed interval between consecutive elements - and hence thought the diff would be as specified but had a vector with apparently identical 12 elements returned from diff tt - seq(0,20,by=0.02) unique(diff(tt)) #[1] 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 Trying to see if these elements in diff were duplicated duplicated(diff(tt)) #[1] FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE TRUE and from sum(duplicated(diff(tt))) [1] 988 saw that 12 of the elements in duplicated(diff(tt)) were FALSE. Would it be expected that the first was FALSE and the rest TRUE? |duplicated()|determines which elements of a vector or data frame are duplicates of elements with smaller subscripts, and returns a logical vector indicating which elements (rows) are duplicates. All best wishes Troels Aalborg, Denmark [[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. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 11-Jan-2015 Time: 08:48:03 This message was sent by XFMail __ 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] how to sort a column with numbers and characters
Hi, I would like to sort a data frame by a column, the column to sort by has a list of numbers 1:150 (a few numbers are missing so the total is 137) and two letters S , Z. How can I sort it so that first I have the numbers in running order (1,2,3,...150) and then the letters S and Z? the column class is factor [1] 1 10 100 101 102 104 105 106 107 108 109 11 110 111 113 114 115 116 [19] 117 118 119 12 120 122 123 124 125 126 127 128 129 130 131 132 134 135 [37] 136 137 138 139 140 141 142 143 144 145 146 147 148 149 15 150 16 17 [55] 18 19 2 20 22 23 24 25 26 27 28 29 3 30 31 32 33 34 [73] 35 36 37 38 39 4 40 41 42 43 44 45 46 47 48 5 50 51 [91] 52 53 54 55 56 57 58 59 6 60 61 62 63 64 65 68 69 7 [109] 70 71 72 74 76 77 78 79 8 80 81 82 83 84 85 86 87 88 [127] 89 9 90 91 92 93 94 95 96 97 98 S Z Thanks, Raz -- \m/ [[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 vs. RStudio?
On 10/01/2015 9:22 PM, Boris Steipe wrote: Could someone kindly enlighten me whether there are currently advantages to use R Studio vs. the normal R GUI? On the Mac I can't seem to find anything compelling, on Windows (which I don't use myself) I noticed last year that there seems to be no syntax highlighting available for the R GUI but R Studio had it. Surely there must be some value proposition in that project, what am I missing? I find several advantages, and one or two disadvantages. - The debugger is nicer. You can set breakpoints in the code editor and it installs them in the right place. - It has lots of support for things like Sweave, knitr, rmarkdown, etc. - It is easy to switch between different projects. - It looks the same on all platforms, so if you switch platforms you still know what you're doing. Negatives: - I don't like the tiled display. I find it doesn't give me enough space. - At least until recently, I haven't checked with the latest release, it converts files to the native format, i.e. saving a file on Windows gives you CR LF line endings, doing it elsewhere converts them to LF. This is really irritating when files get changed for no good reason. Duncan Murdoch __ 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] diff question
I should have added an extra line to the code below, to complete the picture. Here it is (see below line ##. Ted. On 11-Jan-2015 08:48:06 Ted Harding wrote: Troels, this is due to the usual tiny difference between numbers as computed by R and the numbers that you think they are! tt - seq(0,20,by=0.02) dtt - diff(tt) length(dtt) # [1] 1000 r02 - rep(0.02,1000) unique(r02 - dtt) # [1] 0.00e+00 3.469447e-18 -3.469447e-18 1.040834e-17 # [5] -1.734723e-17 3.816392e-17 9.367507e-17 2.046974e-16 # [9] 4.267420e-16 -4.614364e-16 -1.349615e-15 -3.125972e-15 ## sum(dtt != 0.02) # [1] 998 So only 2 values among the 1000 in diff(tt) are exactly equal to [R's representation of] 0.2! Hoping this helps! Ted. On 11-Jan-2015 08:29:26 Troels Ring wrote: R version 3.1.1 (2014-07-10) -- Sock it to Me Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) Dear friends - I have a small problem with diff (I guess) I made a sequence with fixed interval between consecutive elements - and hence thought the diff would be as specified but had a vector with apparently identical 12 elements returned from diff tt - seq(0,20,by=0.02) unique(diff(tt)) #[1] 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 Trying to see if these elements in diff were duplicated duplicated(diff(tt)) #[1] FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE TRUE and from sum(duplicated(diff(tt))) [1] 988 saw that 12 of the elements in duplicated(diff(tt)) were FALSE. Would it be expected that the first was FALSE and the rest TRUE? |duplicated()|determines which elements of a vector or data frame are duplicates of elements with smaller subscripts, and returns a logical vector indicating which elements (rows) are duplicates. All best wishes Troels Aalborg, Denmark [[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. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 11-Jan-2015 Time: 08:48:03 This message was sent by XFMail __ 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. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 11-Jan-2015 Time: 11:41:27 This message was sent by XFMail __ 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 vs. RStudio?
There are other R-friendly editors too. Tinn-R and Notepad++ come to mind. On 1/10/2015 11:04 PM, billy am wrote: I concur. Pls try it. -- | http://billyam.com || http://use-r.com || http://shinyserver.com (BETA) SAS Certified Base Programmer for SAS 9 Oracle SQL Expert(11g) On Sun, Jan 11, 2015 at 10:47 AM, John Sorkin jsor...@grecc.umaryland.edu wrote: I urge you to try it. John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Bert Gunter gunter.ber...@gene.com 1/10/2015 9:46 PM That is what websites are for. Go to rstudio.com and make your own judgment . I have found that they provide much useful functionality above and beyond R's bare bones GUI. Bert On Saturday, January 10, 2015, Boris Steipe boris.ste...@utoronto.ca wrote: Could someone kindly enlighten me whether there are currently advantages to use R Studio vs. the normal R GUI? On the Mac I can't seem to find anything compelling, on Windows (which I don't use myself) I noticed last year that there seems to be no syntax highlighting available for the R GUI but R Studio had it. Surely there must be some value proposition in that project, what am I missing? Thanks, Boris __ R-help@r-project.org javascript:; 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. -- Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. Clifford Stoll [[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. Confidentiality Statement: This email message, including any attachments, is for ...{{dropped:16}} __ 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. -- David K Stevens, P.E., Ph.D. Professor and Head, Environmental Engineering Civil and Environmental Engineering Utah Water Research Laboratory 8200 Old Main Hill Logan, UT 84322-8200 435 797 3229 - voice 435 797 1363 - fax david.stev...@usu.edu __ 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] Interview questions?
Folks, I was wondering if anyone has put together a list of R job interview questions? I’m thinking of about 5-20 possibly open ended questions for interviewing a candidate to do R programming. Just programming. Not statistics or mathematics. What I don’t want are tricky “puzzles” that are more about how clever the interviewer questions are than how to get the best person for the job. I would consider myself a mid-level R programmer so this would also be a great opportunity to learn more and be able to hire a great candidate. I am perfectly happy to get a reference, book title or URL. Not looking for anyone to do my work for me! Best to all, Happy New Year, KW __ 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] Question about package principal
On Jan 11, 2015, at 3:55 AM, 오건희 wrote: Hi, I tried to run principal function in the 'psych' package, but it failed to do.. here is both my code and error message. I searched on the web, but couldn't find the exact answer I wanted. data-read.csv( https://raw.githubusercontent.com/mylesmharrison/delta_PCA_kmeans/master/delta.csv ,row.names=1) airpca-principal(data,nfactors=33,rotate=none) Error in solve.default(model, r) : system is computationally singular: reciprocal condition number = 7.05776e-17 In addition: Warning messages: 1: In cor.smooth(model) : Matrix was not positive definite, smoothing was done 2: In cor.smooth(r) : Matrix was not positive definite, smoothing was done Looks like your data is highly correlated in some of those columns: dat[[1]] [1] 0.0 19.4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 [25] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 dat[[29]] [1] 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dat[[2]] [1] 0 44 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [42] 0 0 0 dat[[3]] [1] 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [42] 0 0 0 I'd retry after removing the problem columns. Thank you for your help. [[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. David Winsemius Alameda, CA, USA __ 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 for organization
Actually I would be interested to know which are the organisations that does not allow R. -- | http://billyam.com || http://use-r.com || http://shinyserver.com (BETA) SAS Certified Base Programmer for SAS 9 Oracle SQL Expert(11g) On Sun, Jan 11, 2015 at 12:00 AM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 10.01.2015 15:42, Vlada Polovinska wrote: Hello, I am interesting in R usage in a big organization. It is always top question about how it is safe to use R working with sensitive data. Because of this I have decided to write to your team. Actually you wrote to a public mailng list with thousands of readers. I am waititng that you can help me to understand what are the main reasons why some organizations don't allow to use this open source and install packages which are very useful for analytics. Could you please give me an explanation about risks installing R packages? Of course, I would appreciate too if you will send me some sources where I can find information about this instead of explain in e-mail (if you don't have enough time). To start reading, I suggest http://www.r-project.org/certification.html Best, Uwe Ligges Thank you! Sincerely, Vlada [[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. [[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 vs. RStudio?
I have four years in the R trenches, and code in R on the Ubuntu command line and the Windows R GUI. Here is an RStudio comparative overview: In the absence of Rstudio, to construct and debug a script I need: 1) A programmer's editor (such as VIM (bad) or Bluefish (better)), in which I enter the script 2) The R GUI / command/console window to run the script To test / debug the script: use the source() function to load and execute. To pause the script: insert browser(); statements at desired stopping points (thus adding needles complexity to the code) To view variable contents: use the message() and sprintf() functions to print text Viewing R help files using the ?() command opens another popup window or windows with the help files. These must be manually closed when not needed. When using RStudio, I need: *Only* the RStudio app running - its GUI includes: - A very good color-coded programmer's editor, - The R console, and (when activated), an excellent debug information window., - The Debug information window, which displays execution information (e.g., variable values), once the debugger is activated (see below) - The R documentation window, to display help files. To step through / debug the R script: Use RStudio's integrated debugger, which takes approximately 5 minutes to learn. for more info: https://support.rstudio.com/hc/en-us/articles/200713843-Debugging-with-RStudio?version=0.98.1091mode=desktop OR within RStudio, select Debug/Debugging Help The quality and usability of RStudio has markedly improved since the early versions: Most beginner-level R programmers can become comfortable using RStudio in 45 minutes. They will recoup their time investment within the first three hours of R development. Hope this helps, Rick Reeves Foxgrove Solutions, Ltd On 1/10/2015 6:47 PM, John Sorkin wrote: I urge you to try it. John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Bert Gunter gunter.ber...@gene.com 1/10/2015 9:46 PM That is what websites are for. Go to rstudio.com and make your own judgment . I have found that they provide much useful functionality above and beyond R's bare bones GUI. Bert On Saturday, January 10, 2015, Boris Steipe boris.ste...@utoronto.ca wrote: Could someone kindly enlighten me whether there are currently advantages to use R Studio vs. the normal R GUI? On the Mac I can't seem to find anything compelling, on Windows (which I don't use myself) I noticed last year that there seems to be no syntax highlighting available for the R GUI but R Studio had it. Surely there must be some value proposition in that project, what am I missing? Thanks, Boris __ R-help@r-project.org javascript:; 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] Interview questions?
On Sun, 11 Jan 2015, Keith S Weintraub wrote: I was wondering if anyone has put together a list of R job interview questions? I’m thinking of about 5-20 possibly open ended questions for interviewing a candidate to do R programming. Just programming. Not statistics or mathematics. Keith, You're the best person to determine the questions to ask because you're the only one who knows what you want this programmer to do. What are the criteria by which the coder's efforts will be judged successful? Ergo, make a list of what the hired coder is expected to do, then write questions that ask about experience with this type of application, how best to approach designing the application, and what other languages and applications have been developed. Those are just spur-of-the-moment ideas but they could get you thinking productively. Rich __ 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] nonmonotonic glm?
I have the following problem. DV is binomial p IV is quantitative variable that goes from negative to positive values. The data look like this (need nonproportional font to view): o o o o o o o o o --+ 0 If these data were symmetrical about zero, I could use abs(IV) and do glm(p ~ absIV). I suppose I could fit two glms, one to positive and one to negative IV values. Seems a rather ugly approach. (To complicate things further, this is within-subjects design) Any suggestions welcome. Thanks! Bill [[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] Question about package principal
Hi, I tried to run principal function in the 'psych' package, but it failed to do.. here is both my code and error message. I searched on the web, but couldn't find the exact answer I wanted. data-read.csv( https://raw.githubusercontent.com/mylesmharrison/delta_PCA_kmeans/master/delta.csv ,row.names=1) airpca-principal(data,nfactors=33,rotate=none) Error in solve.default(model, r) : system is computationally singular: reciprocal condition number = 7.05776e-17 In addition: Warning messages: 1: In cor.smooth(model) : Matrix was not positive definite, smoothing was done 2: In cor.smooth(r) : Matrix was not positive definite, smoothing was done Thank you for your help. [[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] Interview questions?
1. What have they done in the way of R package development? If they've done that, then you can review packages they've worked on and ask questions about that (the package development process as well as the documentation they wrote) to see if that's of sufficient quality. 2. What do they do to assure they produce trustworthy code? [Hint: The least they need to be doing, I think, is writing good examples on a package documentation file that stop if they do not get the right answer -- unit tests. Anyone not doing that is a hack, not a professional.] 3. Any questions about their knowledge of statistics as applied in your particular kinds of applications. 4. Their search strategies for finding other literature relevant to R code development. [Caveat: I'm the lead author of the sos package including its vignette. For me, it's the fastest literature search for anything statistical available anywhere: In seconds, you can search all the packages on CRAN and a few others for matches to your search term AND get the results sorted by package, not by help page. If what you want is there, it's easy and quick to download it, try it, ... .] Hope this helps. Spencer Graves On Jan 11, 2015, at 8:46 AM, Keith S Weintraub kw1...@gmail.com wrote: Folks, I was wondering if anyone has put together a list of R job interview questions? I’m thinking of about 5-20 possibly open ended questions for interviewing a candidate to do R programming. Just programming. Not statistics or mathematics. What I don’t want are tricky “puzzles” that are more about how clever the interviewer questions are than how to get the best person for the job. I would consider myself a mid-level R programmer so this would also be a great opportunity to learn more and be able to hire a great candidate. I am perfectly happy to get a reference, book title or URL. Not looking for anyone to do my work for me! Best to all, Happy New Year, KW __ 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] Interview questions?
Ask if they have a favourite R programmer. This will tell you how much into the R culture they are, and perhaps also tell you if their opinions of a good programmer concur with yours... On 11 Jan 2015 16:49, Keith S Weintraub kw1...@gmail.com wrote: Folks, I was wondering if anyone has put together a list of R job interview questions? I’m thinking of about 5-20 possibly open ended questions for interviewing a candidate to do R programming. Just programming. Not statistics or mathematics. What I don’t want are tricky “puzzles” that are more about how clever the interviewer questions are than how to get the best person for the job. I would consider myself a mid-level R programmer so this would also be a great opportunity to learn more and be able to hire a great candidate. I am perfectly happy to get a reference, book title or URL. Not looking for anyone to do my work for me! Best to all, Happy New Year, KW __ 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.
Re: [R] how to sort a column with numbers and characters
Change that column to be a factor with the levels in the order that you wish. dataFrame$column - factor(dataFrame$column, levels=c(1:150, S, Z)) Then it will sort in that order. E.g., d - data.frame(One=c(5,21,10,Z,S,9), Two=2^(1:6)) d[order(d$One),] One Two 3 10 8 2 21 4 1 5 2 6 9 64 5 S 32 4 Z 16 d$One - factor(d$One, levels=c(1:150,S,Z)) d[order(d$One),] One Two 1 5 2 6 9 64 3 10 8 2 21 4 5 S 32 4 Z 16 Bill Dunlap TIBCO Software wdunlap tibco.com On Sun, Jan 11, 2015 at 2:21 AM, raz barvazd...@gmail.com wrote: Hi, I would like to sort a data frame by a column, the column to sort by has a list of numbers 1:150 (a few numbers are missing so the total is 137) and two letters S , Z. How can I sort it so that first I have the numbers in running order (1,2,3,...150) and then the letters S and Z? the column class is factor [1] 1 10 100 101 102 104 105 106 107 108 109 11 110 111 113 114 115 116 [19] 117 118 119 12 120 122 123 124 125 126 127 128 129 130 131 132 134 135 [37] 136 137 138 139 140 141 142 143 144 145 146 147 148 149 15 150 16 17 [55] 18 19 2 20 22 23 24 25 26 27 28 29 3 30 31 32 33 34 [73] 35 36 37 38 39 4 40 41 42 43 44 45 46 47 48 5 50 51 [91] 52 53 54 55 56 57 58 59 6 60 61 62 63 64 65 68 69 7 [109] 70 71 72 74 76 77 78 79 8 80 81 82 83 84 85 86 87 88 [127] 89 9 90 91 92 93 94 95 96 97 98 S Z Thanks, Raz -- \m/ [[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. [[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] Interview questions?
Here is a question that I might ask. What are the alternatives to R and how does R compare? That is, for what class of problems is R the best tool around? Bob On 1/11/2015 1:16 PM, Barry Rowlingson wrote: Ask if they have a favourite R programmer. This will tell you how much into the R culture they are, and perhaps also tell you if their opinions of a good programmer concur with yours... On 11 Jan 2015 16:49, Keith S Weintraub kw1...@gmail.com wrote: Folks, I was wondering if anyone has put together a list of R job interview questions? I’m thinking of about 5-20 possibly open ended questions for interviewing a candidate to do R programming. Just programming. Not statistics or mathematics. What I don’t want are tricky “puzzles” that are more about how clever the interviewer questions are than how to get the best person for the job. I would consider myself a mid-level R programmer so this would also be a great opportunity to learn more and be able to hire a great candidate. I am perfectly happy to get a reference, book title or URL. Not looking for anyone to do my work for me! Best to all, Happy New Year, KW __ 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-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 vs. RStudio?
On Sat, 10 Jan 2015 21:22:56 -0500 Boris Steipe boris.ste...@utoronto.ca wrote: Could someone kindly enlighten me whether there are currently advantages to use R Studio vs. the normal R GUI? On the Mac I can't seem to find anything compelling, on Windows (which I don't use myself) I noticed last year that there seems to be no syntax highlighting available for the R GUI but R Studio had it. Surely there must be some value proposition in that project, what am I missing? Thanks, Boris There are pros and cons as with all things. RStudio in so far R itself is concerned is effectively simply a graphic interface for the terminal. You operate R from within RStudio essentially the same as you would from a terminal. Useful traits include a streamlined means of installing new packages without trolling through CRAN, quick displays of data sets and other objects currently in the work environment, and a very handy way to build scripts for an analysis. Commands can be run from the Console window and copied to an *.R script which can then be fine tuned to produce analytical, tabular and graphical output to files that is readily incorporated into a comprehensive analysis and report. Graphics - plots - are created and buffered in sequence and can be saved from the plot window as image files or pdfs without adding device() lines to the script. A nice addition would be an output window similar to the plot window. As it is, I still use sink() to capture output of tables and analytical results. RStudio does have some highlighting. The biggest gotcha is that R is not precisely the same experience under different environments (e.g. linux vs. windows). RStudio is more consistent across platforms. RStudio is not an environment like RKward or JGR where analytical tools are available through a menu. jwdougherty __ 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] nonmonotonic glm?
On Jan 11, 2015, at 4:00 PM, Ben Bolker bbol...@gmail.com wrote: Stanislav Aggerwal stan.aggerwal at gmail.com writes: I have the following problem. DV is binomial p IV is quantitative variable that goes from negative to positive values. The data look like this (need nonproportional font to view): [snip to make gmane happy] If these data were symmetrical about zero, I could use abs(IV) and do glm(p ~ absIV). I suppose I could fit two glms, one to positive and one to negative IV values. Seems a rather ugly approach. [snip] What's wrong with a GLM with quadratic terms in the predictor variable? This is perfectly respectable, well-defined, and easy to implement: glm(y~poly(x,2),family=binomial,data=...) or y~x+I(x^2) or y~poly(x,2,raw=TRUE) (To complicate things further, this is within-subjects design) glmer, glmmPQL, glmmML, etc. should all support this just fine. As an alternative to Ben's recommendation, consider using a piecewise cubic spline on the IV. This can be done using glm(): # splines is part of the Base R distribution # I am using 'df = 5' below, but this can be adjusted up or down as may be apropos require(splines) glm(DV ~ ns(IV, df = 5), family = binomial, data = YourDataFrame) and as Ben's notes, is more generally supported in mixed models. If this was not mixed model, another logistic regression implementation is in Frank's rms package on CRAN, using his lrm() instead of glm() and rcs() instead of ns(): # after installing rms from CRAN require(rms) lrm(DV ~ rcs(IV, 5), data = YourDataFrame) Regards, Marc Schwartz __ 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-help Digest, Vol 143, Issue 10
This follows up on Duncan Murdock's reply to Boris Steipe's question about possible advantages to using RStudio. I agree with Mr. Murdock's list of advantages of RStudio, but disagree mildly with his comment about feeling that the tiled display provides too little space. When I use RStudio, I usually set its window to occupy most of the available workspace on my monitor; and I adjust the sizes of the different quadrants of the tiling to suit what I'm doing at the moment. Typically, this means that I use a wide rectangle to display plots and the like, often choose a smaller height for the Environment area, and so on. It's very easy to re-size the individual tile areas. In addition to Mr. Murdock's list of advantages, I can point out that RStudio provides a substantial number of shortcuts and time-savers. The following book is a rich source of information about detailed capabilities of RStudio: Learning RStudio for R Statistical Computing, by M.P.J. van der Loo and E. de Jonge, 2012. Their book has impressed me so much that I have spent a good part of the past week working methodically, page by page, through the book, an effort which has contributed much to my personal comfort with using R and RStudio. I'm still learning to use R, but the tricks and shortcuts I've learned from this book have been extremely helpful; and I'm a considerably better user of both R and RStudio, thanks to the book. (And I've even given a post-Christmas gift copy of the book to a son-in-law who uses R in his job in the oil business.) Ronald Wyllys Emeritus Professor The University of Texas at Austin On 01/11/2015 05:00 AM, r-help-requ...@r-project.org wrote: Message: 14 Date: Sun, 11 Jan 2015 05:30:55 -0500 From: Duncan Murdoch murdoch.dun...@gmail.com To: Boris Steipe boris.ste...@utoronto.ca, R mailing list r-help@r-project.org Subject: Re: [R] R vs. RStudio? Message-ID: 54b250df.8080...@gmail.com Content-Type: text/plain; charset=windows-1252 On 10/01/2015 9:22 PM, Boris Steipe wrote: Could someone kindly enlighten me whether there are currently advantages to use R Studio vs. the normal R GUI? On the Mac I can't seem to find anything compelling, on Windows (which I don't use myself) I noticed last year that there seems to be no syntax highlighting available for the R GUI but R Studio had it. Surely there must be some value proposition in that project, what am I missing? I find several advantages, and one or two disadvantages. - The debugger is nicer. You can set breakpoints in the code editor and it installs them in the right place. - It has lots of support for things like Sweave, knitr, rmarkdown, etc. - It is easy to switch between different projects. - It looks the same on all platforms, so if you switch platforms you still know what you're doing. Negatives: - I don't like the tiled display. I find it doesn't give me enough space. - At least until recently, I haven't checked with the latest release, it converts files to the native format, i.e. saving a file on Windows gives you CR LF line endings, doing it elsewhere converts them to LF. This is really irritating when files get changed for no good reason. Duncan Murdoch __ 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 vs. RStudio?
David Stevens [david.stev...@usu.edu] wrote: There are other R-friendly editors too. Tinn-R and Notepad++ come to mind. TextPad also has an R syntax file. S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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] two-sample KS test: data becomes significantly different after normalization
Hi all, This question is sort of related to R (I'm not sure if I used an R function correctly), but also related to stats in general. I'm sorry if this is considered as off-topic. I'm currently working on a data set with two sets of samples. The csv file of the data could be found here: http://pastebin.com/200v10py I would like to use KS test to see if these two sets of samples are from different distributions. I ran the following R script: # read data from the file data = read.csv('data.csv') ks.test(data[[1]], data[[2]]) Two-sample Kolmogorov-Smirnov test data: data[[1]] and data[[2]] D = 0.025, p-value = 0.9132 alternative hypothesis: two-sided The KS test shows that these two samples are very similar. (In fact, they should come from same distribution.) However, due to some reasons, instead of the raw values, the actual data that I will get will be normalized (zero mean, unit variance). So I tried to normalize the raw data I have and run the KS test again: ks.test(scale(data[[1]]), scale(data[[2]])) Two-sample Kolmogorov-Smirnov test data: scale(data[[1]]) and scale(data[[2]]) D = 0.3273, p-value 2.2e-16 alternative hypothesis: two-sided The p-value becomes almost zero after normalization indicating these two samples are significantly different (from different distributions). My question is: How the normalization could make two similar samples becomes different from each other? I can see that if two samples are different, then normalization could make them similar. However, if two sets of data are similar, then intuitively, applying same operation onto them should make them still similar, at least not different from each other too much. I did some further analysis about the data. I also tried to normalize the data into [0,1] range (using the formula (x-min(x))/(max(x)-min(x))), but same thing happened. At first, I thought it might be outliers caused this problem (I can see that an outlier may cause this problem if I normalize the data into [0,1] range.) I deleted all data whose abs value is larger than 4 standard deviation. But it still didn't help. Plus, I even plotted the eCDFs, they *really* look the same to me even after normalization. Anything wrong with my usage of the R function? Since the data contains ties, I also tried ks.boot ( http://sekhon.berkeley.edu/matching/ks.boot.html ), but I got the same result. Could anyone help me to explain why it happened? Also, any suggestion about the hypothesis testing on normalized data? (The data I have right now is simulated data. In real world, I cannot get raw data, but only normalized one.) Regards, -Monnand [[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] nonmonotonic glm?
If you're going to use splines, another possibility is mgcv::gam (also part of standard R installation) require(mgcv) gam(DV ~ s(IV), data= YourDataFrame, family=binomial) this has the advantage that the complexity of the spline is automatically adjusted/selected by the fitting algorithm (although occasionally you need to use s(IV,k=something_bigger) to adjust the default *maximum* complexity chosen by the code) On Sun, Jan 11, 2015 at 5:23 PM, Marc Schwartz marc_schwa...@me.com wrote: On Jan 11, 2015, at 4:00 PM, Ben Bolker bbol...@gmail.com wrote: Stanislav Aggerwal stan.aggerwal at gmail.com writes: I have the following problem. DV is binomial p IV is quantitative variable that goes from negative to positive values. The data look like this (need nonproportional font to view): [snip to make gmane happy] If these data were symmetrical about zero, I could use abs(IV) and do glm(p ~ absIV). I suppose I could fit two glms, one to positive and one to negative IV values. Seems a rather ugly approach. [snip] What's wrong with a GLM with quadratic terms in the predictor variable? This is perfectly respectable, well-defined, and easy to implement: glm(y~poly(x,2),family=binomial,data=...) or y~x+I(x^2) or y~poly(x,2,raw=TRUE) (To complicate things further, this is within-subjects design) glmer, glmmPQL, glmmML, etc. should all support this just fine. As an alternative to Ben's recommendation, consider using a piecewise cubic spline on the IV. This can be done using glm(): # splines is part of the Base R distribution # I am using 'df = 5' below, but this can be adjusted up or down as may be apropos require(splines) glm(DV ~ ns(IV, df = 5), family = binomial, data = YourDataFrame) and as Ben's notes, is more generally supported in mixed models. If this was not mixed model, another logistic regression implementation is in Frank's rms package on CRAN, using his lrm() instead of glm() and rcs() instead of ns(): # after installing rms from CRAN require(rms) lrm(DV ~ rcs(IV, 5), data = YourDataFrame) Regards, Marc Schwartz __ 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 vs. RStudio?
The RStudio editor itself is pretty mediocre. It is the context sensitive tab-completion with as-you type help that sells it to me anyway. That, with debugging and roxygen and knitr support really make it worth looking at. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On January 11, 2015 5:03:42 PM PST, S Ellison s.elli...@lgcgroup.com wrote: David Stevens [david.stev...@usu.edu] wrote: There are other R-friendly editors too. Tinn-R and Notepad++ come to mind. TextPad also has an R syntax file. S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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] curves naming in fda object
When creating fda object of 50 curves, how to label all curves so that information can be tracked with all curves? [[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] nonmonotonic glm?
Stanislav Aggerwal stan.aggerwal at gmail.com writes: I have the following problem. DV is binomial p IV is quantitative variable that goes from negative to positive values. The data look like this (need nonproportional font to view): [snip to make gmane happy] If these data were symmetrical about zero, I could use abs(IV) and do glm(p ~ absIV). I suppose I could fit two glms, one to positive and one to negative IV values. Seems a rather ugly approach. [snip] What's wrong with a GLM with quadratic terms in the predictor variable? This is perfectly respectable, well-defined, and easy to implement: glm(y~poly(x,2),family=binomial,data=...) or y~x+I(x^2) or y~poly(x,2,raw=TRUE) (To complicate things further, this is within-subjects design) glmer, glmmPQL, glmmML, etc. should all support this just fine. __ 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] Change of locale
Could anyone kindly guide me how to change locale? Any advice would be greatly appreciated. What I am trying to do is to see if messages are correctly in a given locale. The environment variables are: sessionInfo() R version 3.1.2 (2014-10-31) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_CA.UTF-8LC_COLLATE=en_CA.UTF-8 [5] LC_MONETARY=en_CA.UTF-8LC_MESSAGES=en_CA.UTF-8 [7] LC_PAPER=en_CA.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base * Since I do not create any objects yet, the following message must be shown when typing the alphabet 'a'. a Error: object 'a' not found Sys.getenv()[c(LANG, LANGUAGE)] LANG LANGUAGE en_CA.UTF-8 en_CA:en_US:en Sys.getlocale(LC_MESSAGES) [1] en_CA.UTF-8 I am happy with this result. Now, I'd like to see messages in Chineses. Sys.setlocale(LC_MESSAGES, zh_CN.utf8) [1] zh_CN.utf8 a Error: object 'a' not found The message is still shown in English; thus, I am changing the value of 'LANGUAGE'. Sys.setenv(LANGUAGE=zh_CN.utf8) a 错误: 找不到对象'a' Sys.getenv()[c(LANG, LANGUAGE)] LANG LANGUAGE en_CA.UTF-8 zh_CN.utf8 Sys.getlocale(LC_MESSAGES) [1] zh_CN.utf8 Now, I'd like to use messages in English again. At this time, I changed the value of LANGUAGE rather than LC_MESSAGES. Sys.setenv(LANGUAGE=en_CA.utf8) a 错误: 找不到对象'a' I still see this message in Chinese so that I change 'LC_MESSAGES'. Sys.setlocale(LC_MESSAGES, en_CA.utf8) [1] en_CA.utf8 a Error: object 'a' not found Sys.getenv()[c(LANG, LANGUAGE)] LANG LANGUAGE en_CA.UTF-8 en_CA.utf8 Sys.getlocale(LC_MESSAGES) [1] en_CA.utf8 Thus, should I set the same value on both 'LANGUAGE' and 'LC_MESSAGES' in order to change messages in a given locale? However, it is questionable. Please see the following example (messages in Japanese): Sys.setenv(LANGUAGE=ja_JP.utf8) a エラー: オブジェクト 'a' がありません Sys.getenv()[c(LANG, LANGUAGE)] LANG LANGUAGE en_CA.UTF-8 ja_JP.utf8 Sys.getlocale(LC_MESSAGES) [1] en_CA.utf8 Sys.setenv(LANGUAGE=en_CA.utf8) a エラー: オブジェクト 'a' がありません Sys.getenv()[c(LANG, LANGUAGE)] LANG LANGUAGE en_CA.UTF-8 en_CA.utf8 Sys.getlocale(LC_MESSAGES) [1] en_CA.utf8 a エラー: オブジェクト 'a' がありません Is this a bug? Any advice would be greatly appreciated. Chel Hee Lee __ 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] list of vectors which are part of an initial vector
Dear list users, given for example the vector a - c(1:5), which is the easiest way to create a list of 5 vectors with three elements each apart from the head and the tail, like 1 2 1 2 3 2 3 4 3 4 5 4 5 ? I tried to use the split command, with no success. Could somebody show me hints for an efficient way? Thank you for your help Stefano AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario. IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system. [[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.