[R] WG: Fw: Re: rmarkdown and font size

2017-06-12 Thread G . Maubach
Hi Dan, Hi All, I read the below post. I am wondering how do I know which "keys" are available, e.g. "core.r" and "pre". Where kind I find the definition of what can be adjusted and which "words" to use? Kind regards Georg > Gesendet: Donnerstag, 08. Juni 2017 um 16:16 Uhr > Von: "Nordlund,

[R] Antwort: Re: Re: Paths in knitr

2017-06-12 Thread G . Maubach
Hi Yihui, I took root.dir and base.dir out. Everything works fine despite the change. I have implemented the solution Duncun suggested. I have difficulties with the scaling / image size in my report. Some plots are too big, some are too small. I need to adjust any plot. Steep learning curve :)

Re: [R] How Can I Execute a String Expression?

2017-06-12 Thread Jeff Newmiller
R is not a very good macro language... I recommend against this strategy. We could be more concrete in offering alternatives if you were a little more complete in your reproducible example [1][2][3]. What variations exactly were you thinking of? What kind of data are you working with? The way yo

Re: [R] How Can I Execute a String Expression?

2017-06-12 Thread Bert Gunter
eval(parse(text = yourstring)) # your string must be quoted, because that's what a string is. But don't do this! (usually) install.packages("fortunes") ## if not already downloaded and installed library("fortunes") fortune(106) See ?substitute and ?bquote for perhaps better ways to procee

Re: [R] How Can I Execute a String Expression?

2017-06-12 Thread Rolf Turner
On 13/06/17 13:55, Donald Macnaughton wrote: I have the string ggstr that I've built with string manipulation: ggstr = "ggplot(df1, aes(x,y)) + geom_smooth(se=FALSE, span=0.01)" Assuming df1 is properly defined, this string will execute properly if I submit it manually without the quotes. Ho

[R] How Can I Execute a String Expression?

2017-06-12 Thread Donald Macnaughton
I have the string ggstr that I've built with string manipulation: ggstr = "ggplot(df1, aes(x,y)) + geom_smooth(se=FALSE, span=0.01)" Assuming df1 is properly defined, this string will execute properly if I submit it manually without the quotes. How can execute the command as a string, so that I

Re: [R] replacement has *** rows, data has ***

2017-06-12 Thread William Dunlap via R-help
This can happen if there are rows containing missing values (NA's) in the data used to fit the model. Use na.action=na.exclude when fitting the model instead of the default na.action=na.omit to make the prediction vector line up with the input data instead of lining up with the input data after th

Re: [R] replacement has *** rows, data has ***

2017-06-12 Thread David Winsemius
> On Jun 12, 2017, at 1:32 PM, Manqing Liu wrote: > > Hi all, > > I created a predicted variable based on a model, but somehow not all > observations have a predicted value. When I tired to add the predicated > value to the main data set (data$pr <- pr) , it said: > replacement has 34333 rows,

[R] replacement has *** rows, data has ***

2017-06-12 Thread Manqing Liu
Hi all, I created a predicted variable based on a model, but somehow not all observations have a predicted value. When I tired to add the predicated value to the main data set (data$pr <- pr) , it said: replacement has 34333 rows, data has 34347. Do you know how to solve that? Thanks, Manqing

Re: [R] Paths in knitr

2017-06-12 Thread Yihui Xie
Will there be anything wrong if you do not set these options? Regards, Yihui -- https://yihui.name On Mon, Jun 12, 2017 at 2:24 AM, wrote: > Hi Yihui, > Hi Duncan, > > I corrected my typo. Unfortunately knitr did not find my plots in the > directory where they reside which is different from th

Re: [R] plotting gamm results in lattice

2017-06-12 Thread Duncan Mackay
Hi Maria If you have problems just start with a small model with predictions and then plot with xyplot the same applies to xyplot Try library(gamm4) spring <- dget(file = "G:/1/example.txt") str(spring) 'data.frame': 11744 obs. of 11 variables: $ WATERBODY_ID : Factor w/ 1994 lev

Re: [R] count number of stop words in R

2017-06-12 Thread Bert Gunter
I am unfamiliar with the tm package, but using basic regex tools, is this what you want: test <- "Mhm . Alright . There's um a young boy that's getting a cookie jar . And it he's uh in bad shape because uh the thing is falling over . And in the picture the mother is washing dishes and doesn't see

Re: [R] count number of stop words in R

2017-06-12 Thread Florian Schwendinger
If you just want to count the stopwords you cloud do something like, library(slam) library(tm) your_string <- "Mhm . Alright . There's um a young boy that's getting a cookie jar . And it he's uh in bad shape because uh the thing is falling over . And in the picture the mother is washing dishes

Re: [R] count number of stop words in R

2017-06-12 Thread Patrick Casimir
Or use the qdap package to perform any quantitative analysis of your string. https://cran.r-project.org/web/packages/qdap/qdap.pdf Package �qdap� - The Comprehensive R Archive Network cran.r-project.org Package �qdap� August 29, 2016 Type Pa

Re: [R] count number of stop words in R

2017-06-12 Thread Patrick Casimir
you can use summary (my string) Patrick Casimir, PhD Health Analytics, Data Science, Big Data Expert & Independent Consultant C: 954.614.1178 From: Elahe chalabi Sent: Monday, June 12, 2017 11:42:43 AM To: Patrick Casimir; Bert Gunter Cc: R-help Mailing List Su

Re: [R] count number of stop words in R

2017-06-12 Thread Elahe chalabi via R-help
Defining data as you mentioned in your respond causes the following error: Error in UseMethod("tm_map", x) : no applicable method for 'tm_map' applied to an object of class "character" I can solve this error by using Corpus(VectorSource(my string)) and the using your command but I cannot

Re: [R] count number of stop words in R

2017-06-12 Thread Patrick Casimir
define your string as whatever object you want: data <- "Mhm . Alright . There's um a young boy that's getting a cookie jar . And it he's uh in bad shape because uh the thing is falling over . And in the picture the mother is washing dishes and doesn't see it . And so is the the water is overfl

Re: [R] count number of stop words in R

2017-06-12 Thread Elahe chalabi via R-help
Thanks for your reply. I know the command data <- tm_map(data, removeWords, stopwords("english")) removes English stop words, I don't know how should I count stop words of my string: str="Mhm . Alright . There's um a young boy that's getting a cookie jar . And it he's uh in bad shape because

Re: [R] count number of stop words in R

2017-06-12 Thread Patrick Casimir
You can define stop words as below. data <- tm_map(data, removeWords, stopwords("english")) Patrick Casimir, PhD Health Analytics, Data Science, Big Data Expert & Independent Consultant C: 954.614.1178 From: R-help on behalf of Bert Gunter Sent: Monday, June

Re: [R] count number of stop words in R

2017-06-12 Thread Bert Gunter
You can use regular expressions. ?regex and/or the stringr package are good places to start. Of course, you have to define "stop words." 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 Breathe

Re: [R] Keep only those values in a row in a data frame which occur only once.

2017-06-12 Thread S Ellison
> I have a file data.txt as follows: > > Name_1,A,B,C > Name_2,E,F > Name_3,I,J,I,K,L,M > > My query is how can I keep only the unique elements in each row? For > example: I want the row 3 to be Name_3,I,J,K,L,M > > Please note I don't want the 2nd I to appear. > > How can I do this? Use unique

Re: [R] Problem related to rowSums

2017-06-12 Thread PIKAL Petr
Hi Not sure of your intention, do you want count how many rows have zeroes in all columns? In that case something like sum(rowSums(dat == 0) == ncol(dat)) should do the trick. If it is not an answer for your problem, post some toy data and desired result. Regards Petr > -Original Messa

[R] count number of stop words in R

2017-06-12 Thread Elahe chalabi via R-help
Hi all, Is there a way in R to count the number of stop words (English) of a string using tm package? str="Mhm . Alright . There's um a young boy that's getting a cookie jar . And it he's uh in bad shape because uh the thing is falling over . And in the picture the mother is washing dishes and

Re: [R] Memory leak in nleqslv()

2017-06-12 Thread Ismail SEZEN
> On 12 Jun 2017, at 00:16, Andrew Leach wrote: > > Hello all, > > I am relatively new to R, but enjoying it very much. I am hoping that > someone on this list can help me with an issue I am having. > > I am having issues with iterations over nleqslv, in that the solver > does not appear to c

Re: [R] plspm package error in data frame

2017-06-12 Thread Rui Barradas
Hello, Please allways cc the list, don't answer just to me. Now I'm getting a different error. I had noticed that you have no reference to 'TPBDATA' before the call to plspm but I forgot to mention it in my first e-mail. TPB_pls1 = plspm(TPBDATA, TPB_path, TPB_blocks, modes = TPB_modes) Err

Re: [R] issues in plm using random effect model

2017-06-12 Thread Nina Schönfelder
Dear Kailas Gokhale, The negative individual variance is not a problem with your code or plm. It a property of your data. Please check the posts of Giovanni Millo on this topic: [R] R: plm random effect: the estimated variance of the individual effect is negative Millo Giovanni Giovanni_Mil

Re: [R] Beginner’s Question

2017-06-12 Thread Barry Rowlingson
On Mon, Jun 12, 2017 at 2:39 AM, Neil Salkind wrote: > Please excuse the naive question but my first hour with RStudio, resulted in > this… > >> data() >> data(“women”) > Error: unexpected input in "data(�” > > So,that did not work but > >>data(women) > > without the quotes did. > > Would someone

Re: [R] Paths in knitr

2017-06-12 Thread G . Maubach
Hi Yihui, Hi Duncan, I corrected my typo. Unfortunately knitr did not find my plots in the directory where they reside which is different from the Rmd document. The documentation of knitr says: base.dir: (NULL) an absolute directory under which the plots are generate root.dir: (NULL) the root d

Re: [R] Keep only those values in a row in a data frame which occur only once.

2017-06-12 Thread Jim Lemon
Hi Ashim, One way is this, assuming that your data frame is named akdf: akdf<-t(apply(akdf,1,function(x) return(unique(x)[1:length(x)]))) If you want factors instead of strings, more processing will be required. Jim On Mon, Jun 12, 2017 at 3:23 PM, Ashim Kapoor wrote: > Dear All, > > I have a f