Re: [R] create new

2017-03-24 Thread Bert Gunter
?ifelse Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Mar 24, 2017 at 8:56 PM, Val wrote: > Hi all, > > > I have

[R] create new

2017-03-24 Thread Val
Hi all, I have several variables in a group and one group contains three variables. Sample of data ( Year, x1, x3 and x2) mydat <- read.table(header=TRUE, text=' Year x1 x3 x2 Year1 10 120 Year2 0 150 Year3 0 020 Year4 25 0 12 Year5 15 25 12 Year6 0 16 14

Re: [R] change the value of vector based on the string of its name

2017-03-24 Thread David Winsemius
> On Mar 24, 2017, at 10:12 AM, Qill Bel wrote: > > Dear R-users, > > Imagine I have 3 vectors: > *proc1<-0* > *proc2<-0* > *cpd<-c("proc1","proc2")* The `cpd` vector has only character values in it, and has no relation to either the `proc1` or `proc2` vectors. If you want

[R] Unzip multiple layer of compressed (zip/tar) file

2017-03-24 Thread Mohammad Tanvir Ahamed via R-help
Hi, In a folder , there are multiple compressed (zip+tar) files. Each of compressed file can have multiple layer of compression (compressed file inside the compressed file and so on). Can anyone suggest, is there any way to decompress all the files in a single directory ? Tanvir Ahamed

[R] change the value of vector based on the string of its name

2017-03-24 Thread Qill Bel
Dear R-users, Imagine I have 3 vectors: *proc1<-0* *proc2<-0* *cpd<-c("proc1","proc2")* How can I change the value of proc1 to 1, based on vector cpd only? I tried with *as.factor(cpd[1])<-1*, but it produces an error. Any idea how could I achieve that? [[alternative HTML version

Re: [R] Default value of Numerals argument in read.table function R 3.3.2 on Mac

2017-03-24 Thread Bert Gunter
... and I should have added: It is a specific instance of how ?match.arg works . Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Mar 24,

Re: [R] Default value of Numerals argument in read.table function R 3.3.2 on Mac

2017-03-24 Thread Bert Gunter
Follow the "type.convert" link in the numerals section of ?read.table. That's what it's there for. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On

Re: [R] Default value of Numerals argument in read.table function R 3.3.2 on Mac

2017-03-24 Thread Sarah Goslee
Those are the available options, not the defaults. If you follow the chain to ?type.convert as the help for read.table suggests, you will learn that "allow.loss" is the default value. The help for type.convert also explains what each option means. Sarah On Fri, Mar 24, 2017 at 2:55 PM, Ramnik

[R] Default value of Numerals argument in read.table function R 3.3.2 on Mac

2017-03-24 Thread Ramnik Bansal
Hi, The help file for function read.table mentions the default value for the argument numerals as c("allow.loss", "warn.loss", "no.loss") How are the three values used as default values ? Thanks Ramnik [[alternative HTML version deleted]]

Re: [R] Setting up a .Rprofile file

2017-03-24 Thread Henrik Bengtsson
R for Windows is a bit peculiar where it locates your .Rprofile file, or rather what it consider to be your home directory. If you look from within R, the file you do want to create / edit is: > f <- normalizePath("~/.Rprofile", mustWork = FALSE) > f [1] "C:\\Users\\joe\\Documents\\.Rprofile"

Re: [R] Setting up a .Rprofile file

2017-03-24 Thread Bert Gunter
Inline. Cheers, Bert On Fri, Mar 24, 2017 at 2:36 AM, Bruce Ratner PhD wrote: > Henrico: > Thanks for quick reply. > However, one last question: > If I want to change working directory, and put setwd() in the Rprofile file, > logically R will not know where the be work

Re: [R] Using betareg package to fit beta mixture with given initial parameters

2017-03-24 Thread Michael Dayan
Dear Achim, Thank you for your help, this is exactly what I needed. Your help and didactic example is very much appreciated. Best wishes, Michael On Wed, Mar 22, 2017 at 11:34 AM, Achim Zeileis wrote: > On Wed, 22 Mar 2017, Michael Dayan wrote: > > The method of

Re: [R] Setting up a .Rprofile file

2017-03-24 Thread Bruce Ratner PhD
Henrico: Thanks for quick reply. However, one last question: If I want to change working directory, and put setwd() in the Rprofile file, logically R will not know where the be work directory is, correct? So, should I install R in my preferred working directory? Thanks again, in advance. Bruce

Re: [R] How to change parameter values as a function to time with the package "deSolve"

2017-03-24 Thread Marine Regis
Thanks very much David for your answer. Sorry ! here is the code without the error: library(deSolve) param <- c(a = 0.1, b = 1) yini <- c(alpha0 = 6, beta0 = 2) mod <- function(times, yini, param) { with(as.list(c(yini, param)), { gamma0 <- ifelse(times %in% seq(0,10,1), 5, 0) ##

Re: [R] Setting up a .Rprofile file

2017-03-24 Thread Jeff Newmiller
OP is on some variant of MSWindows, which doesn't use a Bash shell, so the syntax of that example is a bit foreign, Enrico. I would say that the concept of using .Rprofile to change directories is ill-advised, since having ALL of your R work in one place is not sustainable. However you can

Re: [R] Error: could not find function "ap"

2017-03-24 Thread PIKAL Petr
Hi Did you define function ap? Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Frederic > Ntirenganya > Sent: Friday, March 24, 2017 1:18 PM > To: r-help@r-project.org > Subject: [R] Error: could not find function "ap" > > Dear All, > >

[R] Error: could not find function "ap"

2017-03-24 Thread Frederic Ntirenganya
Dear All, I hope you are doing well. I am new in using evapotranspiration packages and got the following error: Error: could not find function "ap" The code I am using and data are: dat1<-read.csv("/home/fredo/Documents/Meteo Data/Meteo Rwa data.csv",header=T,na.string="")

Re: [R] Setting up a .Rprofile file

2017-03-24 Thread Enrico Schumann
On Fri, 24 Mar 2017, Bruce Ratner PhD writes: > Henrico: > Thanks for quick reply. > However, one last question: > If I want to change working directory, and put setwd() in the Rprofile > file, logically R will not know where the be work directory is, > correct? > > So, should I install R in my

Re: [R] Modeling Time Series with Missing Observations

2017-03-24 Thread Berend Hasselman
There is also a package imputeTS, which may be able to do what you want. It has a nice Introduction vignette and also appears to have nice plot functions Berend Hasselman > On 24 Mar 2017, at 02:11, David Winsemius wrote: > > There's also an irts-package "irregular

Re: [R] Setting up a .Rprofile file

2017-03-24 Thread Enrico Schumann
On Thu, 23 Mar 2017, Bruce Ratner PhD writes: > Hi R'ers: > I would like to setting up a .Rprofile file with > setwd("C:/R_WorkDir") > set.seed(12345) > options (prompt "> R ") > > --- > Can you help providing the code or instructive link, > I've find many links, but I can't figure it out? > >

[R] Setting up a .Rprofile file

2017-03-24 Thread Bruce Ratner PhD
Hi R'ers: I would like to setting up a .Rprofile file with setwd("C:/R_WorkDir") set.seed(12345) options (prompt "> R ") --- Can you help providing the code or instructive link, I've find many links, but I can't figure it out? Thanks. Bruce __ Bruce Ratner PhD The Significant

Re: [R] (no subject)

2017-03-24 Thread Bert Gunter
Please read and follow the directions at the bottom of your email. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Mar 23, 2017 at 9:55 AM,