Re: [R] A problem with order() function in R

2017-07-17 Thread John
On Tue, 18 Jul 2017 09:58:19 +0700 Jesadaporn Pupantragul wrote: > Hello r-help > I am learning R and use R-studio. > I create vector x <- c(19,17,23,11) and use function order(x). > The result show [1] 4 2 1 3. Why it doesn't show [1] 3 2 4 1. > Follow picture that i attach. > Thank you for you

Re: [R] A problem with order() function in R

2017-07-17 Thread Peter Langfelder
I think you want rank, not order. > x <- c(19,17,23,11) > order(x) [1] 4 2 1 3 > rank(x) [1] 3 2 4 1 See help(order) and help(rank) for the difference. Peter On Mon, Jul 17, 2017 at 7:58 PM, Jesadaporn Pupantragul wrote: > Hello r-help > I am learning R and use R-studio. > I create vector x <-

Re: [R] [FORGED] A problem with order() function in R

2017-07-17 Thread Rolf Turner
On 18/07/17 14:58, Jesadaporn Pupantragul wrote: Hello r-help I am learning R and use R-studio. I create vector x <- c(19,17,23,11) and use function order(x). The result show [1] 4 2 1 3. Why it doesn't show [1] 3 2 4 1. Follow picture that i attach. Thank you for you answer. Perhaps this will

Re: [R] A problem with order() function in R

2017-07-17 Thread Bert Gunter
You need to study ?order and perhaps also subscripting. If that isn't sufficient, I suggest you consult one of the many R web tutorials that cover this. Perhaps this will help: x[order(x)] gives x in sorted order, which is what you woud get with sort(x). Indeed, the code implementing sort.defaul

Re: [R] A problem with order() function in R

2017-07-17 Thread Jim Lemon
Hi Jesadaporn, Try: order(x,decreasing=TRUE) Jim On Tue, Jul 18, 2017 at 12:58 PM, Jesadaporn Pupantragul wrote: > Hello r-help > I am learning R and use R-studio. > I create vector x <- c(19,17,23,11) and use function order(x). > The result show [1] 4 2 1 3. Why it doesn't show [1] 3 2 4 1. >

Re: [R] How to apply a system of ordinary differential equations to a cell grid?

2017-07-17 Thread Marine Regis
It seems that the method `iteration` in the function `ode` can be useful in my case: > Method "iteration" is special in that here the function func should > return the new value of the state variables rather than the rate of > change. This can be used for individual based models, for difference >

[R] dbplyr error updating database

2017-07-17 Thread Conklin, Mike (GfK)
I am trying to use a shiny app to update records in an sqlite database. I keep running into the following error: unable to find an inherited method for function 'dbSendQuery' for signature '"src_dbi", "character"' The query I am trying to send is: [1] "update kpquestions set mrisupercat = 'Dem

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-17 Thread Anthony Damico
awesome, thank you! looks like folks on bugzilla have also reproduced and submitted a patch, so i am happy. thanks all On Mon, Jul 17, 2017 at 11:36 AM, William Dunlap wrote: > The original file had a lot of trailing null bytes so I tried making a > similar file with: > > tf <- tempfile(); file

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-17 Thread William Dunlap via R-help
The original file had a lot of trailing null bytes so I tried making a similar file with: tf <- tempfile(); file <- file(tf, "wb") for(i in 1:(2^15-1))writeBin(rep(as.raw(32:127), len=2^16), file) for(i in 1:(2^15-1))writeBin(rep(as.raw(0L), len=2^16), file) close(file) log2(file.size(tf)) #[1] 31

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-17 Thread Jeff Newmiller
I'll pass. Just because some non-CRAN "archive" package has bugs or your disk storage is flaky does not mean that any of dozens or hundreds of other compression tools (e.g. the built-in Windows "Send to compressed folder" pop-up menu) won't get it right, and we would know if it did fail because

Re: [R] label sunflower point

2017-07-17 Thread Michael Friendly
On 7/16/2017 9:36 AM, Nada Gh wrote: Hi, I create a plot using sunflowerplot, I need to highlight one point to show its importance. What suggestion you have to accomplish this? Thanks, In general, the way to answer such a question for yourself is to read the documentation for arguments relat

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-17 Thread Anthony Damico
hi, thanks again for taking the time. since corrupted compression prompted the segfault for me in the first place, i've just posted the text file as-is. it's a 2.4GB file so to be avoided on a metered internet connection. i've updated the bugzilla report at https://bugs.r-project.org/bugzilla3/s