Re: [R] [Sweave] doesn't accept unicode?

2014-10-21 Thread Yihui Xie
That blog post is not entirely correct about UTF-8: if you use pdflatex, you have to declare the font encoding \usepackage[T1]{fontenc} when you save the document with UTF-8, e.g. the following minimal example should work with pdflatex + knitr in RStudio with UTF-8: \documentclass{article} \usepac

Re: [R] [Sweave] doesn't accept unicode?

2014-10-21 Thread Marc Girondot
Look at here for an example using an encoding in knitr: http://max2.ese.u-psud.fr/epc/conservation/Girondot/Publications/Blog_r/Entrees/2014/9/4_symbol_in_knitr.html Sincerely Marc Le 22/10/2014 02:45, moon...@posteo.org a écrit : Of course I manage and write my tex-files in unicode (utf-8) (r

[R] add text to the first line of an output file

2014-10-21 Thread YIHSU CHEN
Hi guys; I want to write some text at the first line of an output file. The output file will be used for other software. In particular, the following text "ampl.tab 2 1" needs to be added to the first line of an df output file. As a hypothetic example, the output in text file should be like: a

[R] [Sweave] doesn't accept unicode?

2014-10-21 Thread moonkid
Of course I manage and write my tex-files in unicode (utf-8) (running XeTeX). That is why my R-output need to be in unicode, too. But Sweave doesn't accept unicode files. [R] Sweave("analy.Snw") Fehler: ‘analy.Snw’ is not ASCII and does not declare an encoding [/R] [analy.Snw] <<>>= x <- ü

[R] Socket question about isIncomplete and isOpen

2014-10-21 Thread ce
I am trying to repeat socket example in ?socketConnection Server process : con1 <- socketConnection(port = 6011, server = TRUE) while(TRUE) { writeLines("a",con1 ); Sys.sleep(1) } Client process con2 <- socketConnection(Sys.info()["nodename"], port = 6011) readLines(con2, n = 1 ) while(i

Re: [R] "source" command inside R package scripts

2014-10-21 Thread Hadley Wickham
Your source function will be called when the package is _built_, not when it's loaded/attached. There's almost certainly a better way to solve your problem than using source() inside a package Hadley On Tue, Oct 21, 2014 at 6:24 AM, Enrico Bibbona wrote: > I have built a new package. I would lik

[R] R-code for carrying out step-wise panel regression

2014-10-21 Thread Amarjit Singh
Dear all For one of my empirical research investigation,  I tried to carry out step-wise panel regression analysis by making adaptation in the use of plm package (since stepAIC command does not work with plm). Say, I tried to regress an explained variable (DEP) on 3 explanatory variables (EX1, E

Re: [R] pasteFromExcel

2014-10-21 Thread David Winsemius
To the List; I replied privately with a screenshot and an .xlsx worked example since it seemed the major issue was how Excel handled currency formatting for character strings created n R, ... not really an on-topic subject matter for this list. I know Dan also reads the R-SIG-Insurance list and

[R] MMSB

2014-10-21 Thread Stephanie.Clerc
Hi, I am trying to fit a mixed-membership stochastic blockmodel using mmsb.collapsed.gibbs.sampler. I get an error message: "Error in rep(list(matrix(integer(0), nrow = 2, ncol = 0)), dim(network)[1]) : invalid 'times' argument". Could you explain what is the problem exactly? I am working on

Re: [R] How to clear R memory in a for loop

2014-10-21 Thread Uwe Ligges
On 21.10.2014 19:00, William Dunlap wrote: A few minutes with valgrind showed that output_pos was never initialized, so the output array was not getting filled correctly. The following fixes that problem diff -ru tuneR/src/readmp3.c /homes/bill/packages/tuneR/src/readmp3.c --- tuneR/src/readmp

Re: [R] How to clear R memory in a for loop

2014-10-21 Thread William Dunlap
A few minutes with valgrind showed that output_pos was never initialized, so the output array was not getting filled correctly. The following fixes that problem diff -ru tuneR/src/readmp3.c /homes/bill/packages/tuneR/src/readmp3.c --- tuneR/src/readmp3.c 2014-04-07 04:38:21.0 -0700 +++ /ho

Re: [R] How to clear R memory in a for loop

2014-10-21 Thread Prof Brian Ripley
On 21/10/2014 15:47, Dimitri Liakhovitski wrote: I will try with .wav files and report back. So far, I am not sure I understood what could be done (if anything) to fix it... This is nothing to do with my reply! The posting guide asked you to contact the tuneR maintainer *before posting*. Wha

Re: [R] How to clear R memory in a for loop

2014-10-21 Thread Dimitri Liakhovitski
I will try with .wav files and report back. So far, I am not sure I understood what could be done (if anything) to fix it... On Tue, Oct 21, 2014 at 2:26 AM, Prof Brian Ripley wrote: > On 20/10/2014 17:53, John McKown wrote: >> >> On Mon, Oct 20, 2014 at 10:30 AM, Dimitri Liakhovitski < >> dimitr

Re: [R] {car} outlierTest looses p/q values

2014-10-21 Thread John Fox
Dear Phil, I'll bypass questions about why one would want to do this, why you're using glm() rather than lm(), etc., and just point out that the *studentized* residual for the 11th observation is undefined for your example. Simplifying your code: snip --- > y <- c(1.00,1.00,1.00,

Re: [R] undesirable output for lm( )

2014-10-21 Thread Frederic Ntirenganya
Hi Swapnil, Can you please explain your specific problem. You said it is working well. What is the desirable output? What is your output? What do you want from it? Cheers, Fredo. On Tue, Oct 21, 2014 at 3:07 PM, peter dalgaard wrote: > This is rubbish. We don't know what the output is nor wha

Re: [R] Dealing with NAs in lm or gmm

2014-10-21 Thread Frederic Ntirenganya
I suggest you remove the NAs in your dataset if it does not affect your results. That can be done by using na.omit command. Thanks. On Tue, Oct 21, 2014 at 12:51 PM, ONKELINX, Thierry < thierry.onkel...@inbo.be> wrote: > It looks like gmm is not handling na.exclude correctly. You should contact

Re: [R] pasteFromExcel

2014-10-21 Thread Dan Murphy
Sure, that is one pattern to try to detect, but there are many more (e.g., cannot have multiple '$' or '€'). For speed, I'm looking for a *single* expression to detect valid currency strings in one grep. The one shown for US works. For euros, it might suffice to replace '$' with '€' but I cannot t

Re: [R] undesirable output for lm( )

2014-10-21 Thread peter dalgaard
This is rubbish. We don't know what the output is nor what you perceive is wrong with it. And what is the business of cc-ing "respond-a...@linuxmafia.com" "e...@thyrsus.com" ? (The latter is Eric S. Raymond, who I strongly believe has no interest in your R problems.) This reeks of delibera

[R] "source" command inside R package scripts

2014-10-21 Thread Enrico Bibbona
I have built a new package. I would like to put an R script (let us call it "script.R) into a subdirectory of the /pkg/R/ directory, called /pkg/R/sub/ and I would like that such code is run when the package is installed. My way of doing so was to put an R script into /pkg/R/ with source command l

[R] undesirable output for lm( )

2014-10-21 Thread Swapnil Khobragade
Hi, I have written this code and it is working fine Example 1: >fit <- lm(cpi ~ year + quarter) >(cpi2011 <- fit$coefficients[[1]] + fit$coefficients[[2]]*2011 + >fit$coefficients[[3]]*(1:4)) * Example 2:

Re: [R] Dealing with NAs in lm or gmm

2014-10-21 Thread ONKELINX, Thierry
It looks like gmm is not handling na.exclude correctly. You should contact the package maintainer. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 An

Re: [R] Dealing with NAs in lm or gmm

2014-10-21 Thread jpm miao
I tries "na.action = na.exclude" but it returns a fitted vector with NAs removed. Is there any way to return the fitted vector with NAs (In my case, 94*1 matrix)? > gmm8<-gmm(y~RDR1+xx, xiv, na.action = na.exclude) Warning message: In getDat(object$g, object$x) : There are missing values. Associ

Re: [R] Dealing with NAs in lm or gmm

2014-10-21 Thread ONKELINX, Thierry
You want na.action = na.exclude. Or remove rows with NA values from your dataset. Which is IMHO the safest way to build a model. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assu

[R] Dealing with NAs in lm or gmm

2014-10-21 Thread jpm miao
Hi, My question is about NAs in the function "gmm", but I believe that the same issues occur in the case of "lm". I try to estimate a model by "gmm" function (GMM, generalized method of moments). Each of the variables has 94 rows, but the resulting fitted model has only 89 rows. Then the f

Re: [R] {car} outlierTest looses p/q values

2014-10-21 Thread Phil
Hi all, as John pointed out, there is a way to create settings where the studentized residuals are undefined. However, after cross-checking it seems that the residuals are getting calculated without any error. The problem comes up when I use outlierTest to assign a p,q value,respectively. Be