Re: [R] Moving 2nd column into 1st column using R

2019-09-09 Thread Jim Lemon
Hi Zuhri, Try: mydf<-mydf[,c(2,1)] You might be surprised. Jim On Tue, Sep 10, 2019 at 12:20 PM smart hendsome via R-help wrote: > > Hi R-user, > I have a problem regarding R. How can I move my 2nd column into 1st column. > For example I have data as below: > mydf <-

Re: [R] Moving 2nd column into 1st column using R

2019-09-09 Thread David Winsemius
On 9/9/19 7:19 PM, smart hendsome via R-help wrote: Hi R-user, I have a problem regarding R.  How can I move my 2nd column into 1st column.  For example I have data as below: mydf <- data.frame(matrix(1:6, ncol = 2))  mydf   X1 X2   1   4   2   5   3   6 I want move my 2nd column become

[ESS] Issue with polymode installed from ELPA

2019-09-09 Thread Sparapani, Rodney via ESS-help
Hi Gang: I am stumped. I tried to install polymode from ELPA into Vincent Goulet's distro of Emacs and ESS (it no longer contains polymode sadly). macOS 10.14.4 Mojave, Emacs version 26.2 and ESS version 18.10.2 The ELPA install seemed to go well. My load-path starts with

[R] Moving 2nd column into 1st column using R

2019-09-09 Thread smart hendsome via R-help
Hi R-user, I have a problem regarding R.  How can I move my 2nd column into 1st column.  For example I have data as below: mydf <- data.frame(matrix(1:6, ncol = 2))  mydf   X1 X2   1   4   2   5   3   6 I want move my 2nd column become like this:   X1    1      2    3    4   5   6 Hope anyone

Re: [R] Choosing specific Date Range from non-sequential Date

2019-09-09 Thread Ogbos Okike
Dear All, Many thanks for all your contributions, suggestions and advice. I find them all useful. Best wishes Ogbos On Mon, Sep 9, 2019 at 9:35 PM Rui Barradas wrote: > > Hello, > > I cannot reproduce the error but I coerce to class "Date" first. > > > MOSCFD50[[1]] <- as.Date(MOSCFD50[[1]]) >

[R] R_BATCH_OPTIONS not respected?

2019-09-09 Thread Marius Hofert
Hi, I typically start R with "--no-restore --no-save" (to avoid .RData files being written) and would like to have the same behavior under 'R CMD BATCH'. I use R_BATCH_OPTIONS="--no-restore --no-save" in my ~/.Renviron but running an R script with 'R CMD BATCH' still produces a .RData file.

Re: [R] Choosing specific Date Range from non-sequential Date

2019-09-09 Thread Rui Barradas
Hello, I cannot reproduce the error but I coerce to class "Date" first. MOSCFD50[[1]] <- as.Date(MOSCFD50[[1]]) names(MOSCFD50) <- c("date", "value") # Your subset Year <- subset(MOSCFD50, date > "1998-01-01" & date < "2005-12-31") # Another way, if there are NA's, use which(i) i <-

Re: [R] Choosing specific Date Range from non-sequential Date

2019-09-09 Thread William Dunlap via R-help
To get a quick answer to your question you should provide a smallexample that one can simply copy and paste into an R session. It also helps to show some details about how something does not work, more than " But it didn't work." E.g., d <- read.table(header=FALSE, text="1997-11-23

[R] Choosing specific Date Range from non-sequential Date: Problem Fixed

2019-09-09 Thread Ogbos Okike
Dear Bert and Jeff, The result is an output of another code and it will be too long or unnecessary to show all I'm I did to arrive at the given data frame. Since my single line code works for Jeff, I had to take a second look and try to get it working for me. I then read the data frame using

Re: [R] Choosing specific Date Range from non-sequential Date

2019-09-09 Thread Jeff Newmiller
Works for me. Apparently you are not showing us everything you are doing. As Bert recommended, you need to use the dput function rather than dumping numbers into the email if we are to know how your data are stored in memory which will affect what results you get. I highly recommend using the

Re: [R] Choosing specific Date Range from non-sequential Date

2019-09-09 Thread Ogbos Okike
Dear Bert and Jeff, Thank you for looking at this. I am surprised my message was not in plain text. It has been configured to send message to the list in plain text earlier before. The data again please. 1997-11-23 -2.91709629064653 1997-12-07 -0.960255426066815 1997-12-11 -1.98210752999868

Re: [R] how to split a column by tab ?

2019-09-09 Thread Rui Barradas
Hello, I'm glad it helped. One more thing. I forgot to set the column names, if you want to get them from the data, try something like this: nms <- lapply(s, function(.s) .s[grepl("[[:alpha:]]+", .s)]) nms <- sapply(nms, paste, collapse = ".") names(daT3) <- nms daT3 Hope this helps, Rui

Re: [R] help

2019-09-09 Thread Sarah Goslee
You can use the vector of integer cluster numbers with silhouette() from the cluster package. https://www.rdocumentation.org/packages/cluster/versions/2.1.0/topics/silhouette But note that silhouette as an assessment metric makes roughly the same assumptions that k-means does about the data

Re: [R] export the patch results landscapemetrics

2019-09-09 Thread Jeff Newmiller
Wrong mailing list. Read the Posting Guide and the package description. On September 7, 2019 11:34:29 AM PDT, Jon Hak wrote: >I've used SDMTools and Fragstats frequently and I'm trying out the >recently published landscapemetrics.  I'e worked through the agusta >demo >that came with the

Re: [R] Choosing specific Date Range from non-sequential Date

2019-09-09 Thread Jeff Newmiller
Or the column is not named "date", or it is a factor... and the question is not posted in plain text On September 9, 2019 9:55:48 AM PDT, Bert Gunter wrote: >I would guess that you first need to convert your textual dates to a >date-time object via as.date, but as you failed to provide a

Re: [R] Choosing specific Date Range from non-sequential Date

2019-09-09 Thread Bert Gunter
I would guess that you first need to convert your textual dates to a date-time object via as.date, but as you failed to provide a reproducible example (e.g. via dput) I may be wrong. Maybe others may have greater insight. Bert Gunter "The trouble with having an open mind is that people keep

[R] help

2019-09-09 Thread Nicola Fiedler
Hi together, I’m new using R and have a question concerning the Silhouette coefficient. I’ve clustered very easy objects with Affinity Propagation. My data just has one numeric attribute. apres <- apcluster(negDistMat(r=2), data, details=TRUE) show(apres) This worked very well. To compare

[R] export the patch results landscapemetrics

2019-09-09 Thread Jon Hak
I've used SDMTools and Fragstats frequently and I'm trying out the recently published landscapemetrics.  I'e worked through the agusta demo that came with the package so I think I've got a handle on how to process the models I would like to use, but I 'm a bit stumped.  the show_patches() is

[R] Choosing specific Date Range from non-sequential Date

2019-09-09 Thread Ogbos Okike
Dear Contributors, I have a data frame of the form: 1997-11-23 -2.91709629064653 1997-12-07 -0.960255426066815 1997-12-11 -1.98210752999868 1997-12-20 -1.10800598439855 1998-01-01 -1.00090115428118 1998-01-29 -1.03056081882709 1998-03-27 -0.873243859498216 1998-04-09 -2.06378384750109 1998-04-12

Re: [R] structure of NIRsoil

2019-09-09 Thread Jeff Newmiller
Beginners should definitely read the Posting Guide mentioned in the footer of this and every message from this mailing list. One key point is that this mailing list is for plain text format only, and your message gets damaged to varying degrees when you fail to set the plain text format option

Re: [R] Problems installing Dependences of my package

2019-09-09 Thread Jeff Newmiller
Wrong mailing list (use R-package-devel. Don't post HTML... your email is full of unreadable characters. On September 8, 2019 11:27:27 PM PDT, "VILAR ÁLVAREZ ANDREA" wrote: > >Hi, > >I am writting because I am doing a package in R and I have some >problems installing dependences which appear

[R] [R-pkgs] New package sclr for scaled logit model

2019-09-09 Thread Arseniy Khvorov
A new package "sclr" for fitting the "scaled logit" model from Dunning (2006)  is available. CRAN: https://cran.r-project.org/package=sclr Github: https://github.com/khvorov45/sclr I appreciate any feedback. Best regards, Arseniy Khvorov ___

[R] structure of NIRsoil

2019-09-09 Thread rhotuser
Dear Sir, After installing prospectr,  > data(NIRsoil)> mode(NIRsoil)[1] "list">  I am a beginner and the structure of “NIRsoil” is complicated. Judging from the explanation of NIRsoil (see below), there are six elements: NT, Ciso, CEC, train, validation, spc. Please tell me how to know the

[R] Problems installing Dependences of my package

2019-09-09 Thread VILAR ÁLVAREZ ANDREA
Hi, I am writting because I am doing a package in R and I have some problems installing dependences which appear at DESCRIPTION file. First of all, I am not sure about the difference between �Depends� and �Imports�, but I only use �Depends�. My problem is that my package is going to be used

[R] install.packages handles package vs package dependencies differently

2019-09-09 Thread Chase Clark
First post, please excuse any ignorance. install.packages() seems to only respect install.packages(lib=) for the specified package (in the below case {purrr}) and will ignore any dependencies ({magrittr}, {rlang}) if they are found in any of the directories in .libPaths() (e.g. R_LIBS). The

Re: [R] how to split a column by tab ?

2019-09-09 Thread Rui Barradas
Hello, You could try a character class instead of one character (the tab char). There are two character classes that you can try, [:blank:] and [:space:], see ?regex. strsplit(as.character(daT1), "[[:blank:]]+") Then form the final result. I have changed rbind to cbind, it seemed more

[R] how to split a column by tab ?

2019-09-09 Thread Marna Wagley
Hi R User, I was trying to split a column by tabs, I tried to split with several ways, but I could not split it. Is there any possibilities? The data example and the code I used daT1<-c("Column number 12345678 9 10 10 10 10 10 10 10", "comes