Re: [R] Include a formula using the function “makeParamSet”

2019-10-09 Thread Jeff Newmiller
Technically this question is off-topic on this mailing list (read the Posting Guide!), but I might hazard a guess that the package doesn't like using variable that is a lowercase "c" since that is an extremely common R function name. You can sometimes get away with this, but it takes very carefu

Re: [R] include

2018-02-25 Thread Val
Thank you all for your help and sorry for that. On Sun, Feb 25, 2018 at 12:18 PM, Jeff Newmiller wrote: > Jim has been exceedingly patient (and may well continue to be so), but > this smells like "failure to launch". At what point will you start showing > your (failed) attempts at solving your o

Re: [R] include

2018-02-25 Thread Jeff Newmiller
Jim has been exceedingly patient (and may well continue to be so), but this smells like "failure to launch". At what point will you start showing your (failed) attempts at solving your own problems so we can help you work on your specific weaknesses and become self-sufficient? -- Sent from my p

Re: [R] include

2018-02-25 Thread Val
HI Jim and all, I want to put one more condition. Include col2 and col3 if they are not in col1. Here is the data mydat <- read.table(textConnection("Col1 Col2 col3 K2 X1 NA Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) The desired out put would be Col1 Col2 co

Re: [R] include

2018-02-24 Thread William Dunlap via R-help
That's not right in general, is it? I'd think that should be x[!is.na(x1)] <- 0 x2 <- x1 I left out a '1' on the first line - it should have been x1[!is.na(x1)] <- 0 In the following examples the value of the assignment expression is the right hand side of the assignment.

Re: [R] include

2018-02-24 Thread Val
Thank you so much Jim! On Sat, Feb 24, 2018 at 6:38 PM, Jim Lemon wrote: > Hi Val, > My fault - I assumed that the NA would be first in the result produced > by "unique": > > mydat <- read.table(textConnection("Col1 Col2 col3 > Z1 K1 K2 > Z2 NA NA > Z3 X1 NA > Z4 Y1 W1"),header = TRUE,stringsAsF

Re: [R] include

2018-02-24 Thread Jim Lemon
Hi Val, My fault - I assumed that the NA would be first in the result produced by "unique": mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) val23<-unique(unlist(mydat[,c("Col2","col3")])) napos<-which(is.na(val23)) prev

Re: [R] include

2018-02-24 Thread Val
Thank you Jim, I read the data as you suggested but I could not find K1 in col1. rbind(preval,mydat) Col1 Col2 col3 1 2 X1 3 Y1 4 K2 5 W1 6 Z1 K1 K2 7 Z2 8 Z3 X1 9 Z4 Y1 W1 On Sat, Feb 24, 2018 at 6:18 PM, Jim Lemon wrote: > hi Val, > Your problem s

Re: [R] include

2018-02-24 Thread Jim Lemon
hi Val, Your problem seems to be that the data are read in as a factor. The simplest way I can think of to get around this is: mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) preval<-data.frame(Col1=unique(unlist(mydat[

Re: [R] include

2018-02-24 Thread Val
Sorry , I hit the send key accidentally here is my complete message. Thank you Jim and all, I got it. I have one more question on the original question What does this "[-1] " do? preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) myd

Re: [R] include

2018-02-24 Thread Val
Thank you Jim and all, I got it. I have one more question on the original question What does this "[-1] " do? preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1

Re: [R] include

2018-02-24 Thread Duncan Murdoch
On 24/02/2018 1:53 PM, William Dunlap via R-help wrote: x1 = rbind(unique(preval),mydat) x2 <- x1[is.na(x1)] <- 0 x2 # gives 0 Why introduce the 'x2'? x1[...] <- 0 alters x1 in place and I think that altered x1 is what you want. You asked why x2 was zero. The value of the express

Re: [R] include

2018-02-24 Thread William Dunlap via R-help
x1 = rbind(unique(preval),mydat) x2 <- x1[is.na(x1)] <- 0 x2 # gives 0 Why introduce the 'x2'? x1[...] <- 0 alters x1 in place and I think that altered x1 is what you want. You asked why x2 was zero. The value of the expression f(a) <- b and assignments are processed right to left

Re: [R] include

2018-02-24 Thread Val
Thank you Jim I wanted a final data frame after replacing the NA's to "0" x1 = rbind(unique(preval),mydat) x2 <- x1[is.na(x1)] <- 0 x2 but I got this, [1] 0 why I am getting this? On Sat, Feb 24, 2018 at 12:17 AM, Jim Lemon wrote: > Hi Val, > Try this: > > preval<-data.frame(Col1=unique(

Re: [R] include

2018-02-23 Thread Jim Lemon
Hi Val, Try this: preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) rbind(preval,mydat) Jim On Sat, Feb 24, 2018 at 3:34 PM, Val wrote: > Hi All, > > I am reading a file as follow, > > mydat <- read.table(textConnection("Col1 Col2 col3 > Z2 NA NA > Z3 X1 NA

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread Michael Hannon
Exporting to LaTeX is a good idea. Thanks, guys. On Mon, Feb 19, 2018 at 4:22 AM, stephen sefick wrote: > Yes, 'C-c C-e l l' I think, but follow the pop-up, and everything should be > ok. > > On Feb 19, 2018 07:05, "Rainer Krug" wrote: > >> >> >> > On 19 Feb 2018, at 12:25, Duncan Murdoch >

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread stephen sefick
Yes, 'C-c C-e l l' I think, but follow the pop-up, and everything should be ok. On Feb 19, 2018 07:05, "Rainer Krug" wrote: > > > > On 19 Feb 2018, at 12:25, Duncan Murdoch > wrote: > > > > On 19/02/2018 5:47 AM, Michael Hannon wrote: > >> Thanks, Duncan. The f

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread Rainer Krug
> On 19 Feb 2018, at 12:25, Duncan Murdoch > wrote: > > On 19/02/2018 5:47 AM, Michael Hannon wrote: >> Thanks, Duncan. The files in question are Emacs Org-mode files, and I >> think these are more or less isomorphic to Rmd files, but I haven't >> used Org-mode

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread Duncan Murdoch
On 19/02/2018 5:47 AM, Michael Hannon wrote: Thanks, Duncan. The files in question are Emacs Org-mode files, and I think these are more or less isomorphic to Rmd files, but I haven't used Org-mode in a long time, so I think the mapping (Org-mode ==> Rmd) would be painful. If they aren't LaTeX

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread Michael Hannon
Thanks, Duncan. The files in question are Emacs Org-mode files, and I think these are more or less isomorphic to Rmd files, but I haven't used Org-mode in a long time, so I think the mapping (Org-mode ==> Rmd) would be painful. -- Mike On Mon, Feb 19, 2018 at 1:20 AM, Duncan Murdoch wrote: > O

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread Michael Hannon
Heh. Thanks, Ista, for your diplomatically-phrased suggestion :-) In fact, I *did* read the "vignettes" section of the Extensions manual, but evidently not closely enough. Upon further review, I see that one can use ".../vignettes/.install_extras" to list additional files that should be copied t

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread Duncan Murdoch
On 18/02/2018 9:06 PM, Michael Hannon wrote: Greetings. The group that I work with has just started using the approach outlined in Karl Broman's handy primer: http://kbroman.org/pkg_primer/pages/vignettes.html to create vignettes for a couple of R packages. This works fine as long as we

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-18 Thread Ista Zahn
Hi Mike, Did you read the relevant section of the official "Writing R Extensions" manual? If so, what about the instructions provided there do you find lacking? Best, Ista On Sun, Feb 18, 2018 at 9:06 PM, Michael Hannon wrote: > Greetings. The group that I work with has just started using the

Re: [R] Include plotting symbals pch 16 and 17 into captions / text in pdf graph

2014-07-21 Thread David Winsemius
It's a hack but this works: cairo_pdf("utftext.pdf", family="Calibri") plot(0:1,0:1, type="n") points(0.2, 1, pch=16) mtext( text = "pch=16 (\U25CF)", side = 3, at = 0.2, line = 1, ) points(0.8, 1, pch=17); points(0.85, 1.1, pch=17, xpd=TRUE) # par(xpd=TRUE) lets p

Re: [R] Include Random Effects in Poisson Regressing (Nested Data)

2014-03-29 Thread el_alisio
Hi, one way to include a random effect would be: require("lme4") mymodel <- lmer(counts ~ Season + Rainfall + (1 | Year), family = quasipoisson, data = mydata) Nevertheless, there are other ways to include a random effect using R. In any case, you need to provide justification why you are us

Re: [R] include sql statements

2014-03-03 Thread Streng Ge-heim
Thanks a lot. The hint with readLines worked :) Then I got it to work like this: sql <- paste(readLines(con = "stmnt.sql"), collapse = " ") result <- sqlQuery(db,sql) Michel 2014-03-02 17:52 GMT+01:00 Gabor Grothendieck : > On Fri, Feb 28, 2014 at 5:16 AM, Streng Ge-heim > wrote: > > Hi, > >

Re: [R] include sql statements

2014-03-03 Thread MacQueen, Don
One way would be sql <- scan('stmt.sql', what='') Then sql <- paste(sql, collapse=' ') or sql <- paste(sql, collapse='\n') After which you can check with cat(sql, '\n') I do this sort of thing when I want to maintain an SQL template in an external file, then modify it in R before using o

Re: [R] include sql statements

2014-03-02 Thread Jeff Newmiller
R does not require the begin and end quote marks for string literals to be on the same line. There is nothing preventing you from formatting your SQL to your preference right in within R code. --- Jeff Newmiller

Re: [R] include sql statements

2014-03-02 Thread normannus
Am 28.02.2014 20:54, schrieb Duncan Murdoch: On 28/02/2014 5:16 AM, Streng Ge-heim wrote: Hi, first of all: I am new to R. Anyway, I would like to include sql files in my r-script, which I load via source("scriptname") in the CLI. The sql files (i.e. "stmt.sql") contains select statements wi

Re: [R] include sql statements

2014-03-02 Thread Duncan Murdoch
On 14-03-02 8:06 AM, normannus wrote: Am 28.02.2014 20:54, schrieb Duncan Murdoch: On 28/02/2014 5:16 AM, Streng Ge-heim wrote: Hi, first of all: I am new to R. Anyway, I would like to include sql files in my r-script, which I load via source("scriptname") in the CLI. The sql files (i.e. "stm

Re: [R] include sql statements

2014-02-28 Thread Duncan Murdoch
On 28/02/2014 5:16 AM, Streng Ge-heim wrote: Hi, first of all: I am new to R. Anyway, I would like to include sql files in my r-script, which I load via source("scriptname") in the CLI. The sql files (i.e. "stmt.sql") contains select statements with joins, line breaks, various characters, they

Re: [R] include variable of a dataframe in other dataframe

2013-09-11 Thread ernesto villarino
It works !!! you are super !!! thank you !! :) On Wed, Sep 11, 2013 at 10:22 AM, Ernesto Villarino < villarino.erne...@gmail.com> wrote: > Hello Ian. > I explained wrong myself. > summary (data.all.evp) > Year Month LongLat z > > Min. :1959

Re: [R] include variable of a dataframe in other dataframe

2013-09-11 Thread ernesto villarino
Hello Ian. I explained wrong myself. summary (data.all.evp) Year Month LongLat z Min. :1959 Jan:124200 Min. :-74.0 Min. :36.0 Min. :-5615.00 1st Qu.:1970 Feb:124200 1st Qu.:-52.0 1st Qu.:43.0 1st Qu.:-3451.25 Media

Re: [R] include a dataset in my package

2012-05-22 Thread Uwe Ligges
On 22.05.2012 06:24, Richard M. Heiberger wrote: you do have a dataset x. it is probably inside the test.rda file. start a fresh R session and library(yourPackage) then ls() data(test) No, you meant data(x) Note that the name of the filename is still the original mname it had hen creatin

Re: [R] include a dataset in my package

2012-05-21 Thread Richard M. Heiberger
you do have a dataset x. it is probably inside the test.rda file. start a fresh R session and library(yourPackage) then ls() data(test) ls() ## you will probably have now have x. Should you need to use load, then use load("/full/path/to/test.rda") ## in quotes ls() The idiom for saving a data

Re: [R] Include C++ DLL, error in ...: C symbol name not in load table

2011-04-21 Thread Massimiliano
Maybe you have to add #include #include to your C++ source code. Massimiliano Tripoli Il giorno mer, 20/04/2011 alle 22.06 +0200, Sascha Vieweg ha scritto: > #include > using namespace std; > void foo (double* x, double* y, double* out) > { > out[0] = x[0] + y[0]; > } > > _

Re: [R] Include C++ DLL, error in ...: C symbol name not in load table

2011-04-20 Thread Duncan Murdoch
On 20/04/2011 4:38 PM, Dirk Eddelbuettel wrote: On 20 April 2011 at 16:24, Duncan Murdoch wrote: | On 20/04/2011 4:06 PM, Sascha Vieweg wrote: |> Hello R experts |> |> I am googling and reading around, however, I can't get it working |> (perhaps because I do not understand much C, however, I'

Re: [R] Include C++ DLL, error in ...: C symbol name not in load table

2011-04-20 Thread Dirk Eddelbuettel
On 20 April 2011 at 16:24, Duncan Murdoch wrote: | On 20/04/2011 4:06 PM, Sascha Vieweg wrote: | > Hello R experts | > | > I am googling and reading around, however, I can't get it working | > (perhaps because I do not understand much C, however, I'll give it | > a try). I am trying to include C++

Re: [R] Include C++ DLL, error in ...: C symbol name not in load table

2011-04-20 Thread Duncan Murdoch
On 20/04/2011 4:06 PM, Sascha Vieweg wrote: Hello R experts I am googling and reading around, however, I can't get it working (perhaps because I do not understand much C, however, I'll give it a try). I am trying to include C++ code into an R routine, where the C++ code looks: #include using na

Re: [R] Include externally generated pdf in output (without Sweave)

2010-10-04 Thread Greg Snow
Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Dieter Menne > Sent: Sunday, October 03, 2010 7:39 AM > To: r-help@r-project.org > Subject: Re: [R]

Re: [R] Include externally generated pdf in output (without Sweave)

2010-10-03 Thread Dieter Menne
Tal Galili wrote: > > You could potentially read an image file (like, for example, tiff) using > something like > read.picture {SoPhy} > Thanks to you and Baptiste Auguie. Looks like the best way would be to import the picture as a pixel graphics with "read.picture". It might be possible to r

Re: [R] Include externally generated pdf in output (without Sweave)

2010-10-03 Thread baptiste auguie
Hi, Check the grImport package (I think it has a vignette, perhaps on Paul Murrell's homepage.) HTH, baptiste On 3 October 2010 14:52, Tal Galili wrote: > Hello Dieter, > > Looking at this thread (from 2005) > http://tolstoy.newcastle.edu.au/R/help/05/10/14320.html > It seems you can't read

Re: [R] Include externally generated pdf in output (without Sweave)

2010-10-03 Thread Tal Galili
Hello Dieter, Looking at this thread (from 2005) http://tolstoy.newcastle.edu.au/R/help/05/10/14320.html It seems you can't read a pdf file to R (at least then, I hope there was an update since). BUT You could potentially read an image file (like, for example, tiff) using something like read.pic

Re: [R] Include local files when running R remotely

2010-08-30 Thread Erik Shilts
Thanks for the response. I'm currently running ESS. I sent a message to the ESS listserv to see if anyone can help with that since I don't see how to do it in the Manual or Readme. Erik On Mon, Aug 30, 2010 at 2:04 PM, RICHARD M. HEIBERGER wrote: > Since you are already on emacs, try using ESS.

Re: [R] Include local files when running R remotely

2010-08-30 Thread RICHARD M. HEIBERGER
Since you are already on emacs, try using ESS. I am pretty sure we do that. http://ess.r-project.org Please follow up on the ESS mailing ess-h...@stat.math.ethz.ch Rich On Mon, Aug 30, 2010 at 12:48 PM, Barry Rowlingson wrote: > On Mon, Aug 30, 2010 at 5:29 PM, Erik Shilts wrote: >> I run R o

Re: [R] Include local files when running R remotely

2010-08-30 Thread Barry Rowlingson
On Mon, Aug 30, 2010 at 5:29 PM, Erik Shilts wrote: > I run R on a remote UNIX server where the data are stored that I ssh into > through Emacs, while I store my R scripts on local Windows network drives. > So far this arrangement hasn't been a problem, though now I'd like to use > source() or a s

Re: [R] Include manually an intercept in lm without breaking it?

2009-11-28 Thread Matthieu Stigler
Thanks for your answer! Actually, the reason to include it manually was that the function I wanted to create should have args like: type=c("const", "trend", "both", "none") and so was easier to create a matrix and simply put lm(y~-1+datamat) But following your advices I think rather change th

Re: [R] Include manually an intercept in lm without breaking it?

2009-11-28 Thread Duncan Murdoch
On 28/11/2009 10:14 AM, Matthieu Stigler wrote: Hi Say I want to add manually an intercept in the function lm. Even if almost all results will be identical, few stats are different as DF counting will be different as intercept will not be included in "automatic" case, while it will be in "man

Re: [R] Include files?

2009-07-24 Thread Mark Knecht
On Fri, Jul 24, 2009 at 10:22 AM, Duncan Murdoch wrote: > On 7/24/2009 12:25 PM, Mark Knecht wrote: >> >> Hi, >>   I have 15 or 20 functions I've written to convert the sort of data >> I'm working with. They are currently in their own R file which I load >> by hand in Rgui before loading and runnin

Re: [R] Include files?

2009-07-24 Thread Duncan Murdoch
On 7/24/2009 12:25 PM, Mark Knecht wrote: Hi, I have 15 or 20 functions I've written to convert the sort of data I'm working with. They are currently in their own R file which I load by hand in Rgui before loading and running my main programs. Is there any way to have this file included in

Re: [R] Include files?

2009-07-24 Thread cls59
Mark Knecht wrote: > > Hi, >I have 15 or 20 functions I've written to convert the sort of data > I'm working with. They are currently in their own R file which I load > by hand in Rgui before loading and running my main programs. > >Is there any way to have this file included in my R pr

Re: [R] Include files?

2009-07-24 Thread Mark Knecht
Thanks. I think source is what I was looking for. Cheers, Mark On Fri, Jul 24, 2009 at 9:30 AM, Erik Iverson wrote: > Several solutions, easiest might be to use the source function in your > program.  Also, you could create a .Rprofile if you use them every time you > use R. > > See ?source and

Re: [R] Include files?

2009-07-24 Thread jim holtman
?Startup ?.Rprofile On Fri, Jul 24, 2009 at 12:25 PM, Mark Knecht wrote: > Hi, >   I have 15 or 20 functions I've written to convert the sort of data > I'm working with. They are currently in their own R file which I load > by hand in Rgui before loading and running my main programs. > >   Is ther

Re: [R] Include files?

2009-07-24 Thread Erik Iverson
Several solutions, easiest might be to use the source function in your program. Also, you could create a .Rprofile if you use them every time you use R. See ?source and ?Startup Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Beha

Re: [R] #INCLUDE

2009-07-08 Thread John Kane
?source perhaps? --- On Wed, 7/8/09, Idgarad wrote: > From: Idgarad > Subject: [R] #INCLUDE > To: r-help@r-project.org > Received: Wednesday, July 8, 2009, 11:16 AM > What is R's equivalent to a C-like > #include to incorporate external files. I > have a 2k line function that is generated and

Re: [R] #INCLUDE

2009-07-08 Thread Andy Zhu
source(_external_file_name) --- On Wed, 7/8/09, Idgarad wrote: From: Idgarad Subject: [R] #INCLUDE To: r-help@r-project.org Date: Wednesday, July 8, 2009, 11:16 AM What is R's equivalent to a C-like #include to incorporate external files. I have a 2k line function that is generated and need to

Re: [R] #INCLUDE

2009-07-08 Thread Godmar Back
?source ? On Wed, Jul 8, 2009 at 11:16 AM, Idgarad wrote: > What is R's equivalent to a C-like #include to incorporate external files. I > have a 2k line function that is generated and need to include it at runtime > but not manage it as a package (as it changes hourly.) Any ideas? > >        [[al

Re: [R] include scripts into main file (the LaTeX way)

2008-09-26 Thread Michael Schulte
source() does the trick thanks to you all! m baptiste auguie wrote: you mean like ?source ? On 26 Sep 2008, at 13:49, Michael Schulte wrote: Dear R-people, I want to use an idea from LaTeX in the work flow with R. It is possible in LaTeX to have a main file from which other files are called

Re: [R] include scripts into main file (the LaTeX way)

2008-09-26 Thread Prof Brian Ripley
This is hardly original to LaTeX (in fact even TeX has a way), and most programming languages have such a mechanism (e.g. #include in C). R's nearest equivalent is source(), but that does not have a mechanism like TEXINPUTS to search for files (but then neither does MikTeX). I believe I have

Re: [R] include scripts into main file (the LaTeX way)

2008-09-26 Thread baptiste auguie
you mean like ?source ? On 26 Sep 2008, at 13:49, Michael Schulte wrote: Dear R-people, I want to use an idea from LaTeX in the work flow with R. It is possible in LaTeX to have a main file from which other files are called (ie included). So for example if you have book, the main index file

Re: [R] include scripts into main file (the LaTeX way)

2008-09-26 Thread Marianne Promberger
Hi, On Friday, 26 September 2008, 14:49 (UTC+0200), Michael Schulte wrote: [...] > So for example if you have book, the main index file would call each > chapter separately. > > Is there something comparable in R that follows the above 'include' idea > from LaTeX? I've used source() for that.

Re: [R] include scripts into main file (the LaTeX way)

2008-09-26 Thread Gábor Csárdi
Perhaps ?source. Gabor On Fri, Sep 26, 2008 at 2:49 PM, Michael Schulte <[EMAIL PROTECTED]> wrote: > Dear R-people, > > I want to use an idea from LaTeX in the work flow with R. > It is possible in LaTeX to have a main file from which other files are > called (ie included). > So for example if yo

Re: [R] include S4 class and methods in a package

2008-06-28 Thread baptiste Auguié
Thanks Haris, I eventually got this to work thanks to some off-list help and lots of trials and error. I have to admit I still don't understand all the details of the procedure (the "generic" paradigm in particular escapes me), but at least I have achieved a working example that I can alter

Re: [R] include S4 class and methods in a package

2008-06-28 Thread Charilaos Skiadas
On Jun 27, 2008, at 1:44 PM, baptiste Auguié wrote: DeaR list, Pardon the stupidity of this question but I've been trying this for a while now without success. I've followed the example given in the green book "programming with data", and I now have a working example of a S4 class with a