Re: [R] conditionally disable evaluation of chunks in Rmarkdown...

2015-11-10 Thread Yihui Xie
The short answer is you cannot. Inline R code is always evaluated.
When it is not evaluated, I doubt if your output still makes sense,
e.g. "The value of x is `r x`." becomes "The value of x is ." That
sounds odd to me.

If you want to disable the evaluate of inline code anyway, you may use
a custom function to do it. e.g.

cond_eval = function(x) {
  if (isTRUE(knitr::opts_chunk$get('eval'))) x
}

Then `r cond_eval(x)` instead of `r x`.

Regards,
Yihui
--
Yihui Xie 
Web: http://yihui.name


On Tue, Nov 10, 2015 at 4:40 AM, Witold E Wolski  wrote:
> I do have an Rmd where I would like to conditionally evaluate the second part.
>
> So far I am working with :
>
> ```{r}
> if(length(specLibrary@ionlibrary) ==0){
>   library(knitr)
>   opts_chunk$set(eval=FALSE, message=FALSE, echo=FALSE)
> }
> ```
>
> Which disables the evaluation of subsequent chunks.
>
> However my RMD file contains also these kind of snippets : `r `
>
> How do I disable them?
>
> regards
>
>
>
> --
> Witold Eryk Wolski

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] conditionally disable evaluation of chunks in Rmarkdown...

2015-11-10 Thread Jeff Newmiller
Well, strictly speaking knitr and rmarkdown are a contributed packages and the 
official contact for any contributed package is found via the maintainer() 
function. The Posting Guide indicates that R-help should only be used as a 
backup if that avenue is a dead end.

To be fair to the OP, there are a lot of useful contributed packages that get 
discussed here anyway. But Bert is right that if there is a forum more 
appropriate for a contributed package then it should be preferred and any 
question posed here should mention any dead ends encountered and good 
netiquette would be to link to any publicly-visible record of those attempts.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On November 10, 2015 6:44:16 AM PST, Bert Gunter  wrote:
>Strictly speaking, wrong email list.
>
>Markdown is R Studio software, and you should post on their support
>site.
>
>Cheers,
>Bert
>
>
>Bert Gunter
>
>"Data is not information. Information is not knowledge. And knowledge
>is certainly not wisdom."
>   -- Clifford Stoll
>
>
>On Tue, Nov 10, 2015 at 2:40 AM, Witold E Wolski 
>wrote:
>> I do have an Rmd where I would like to conditionally evaluate the
>second part.
>>
>> So far I am working with :
>>
>> ```{r}
>> if(length(specLibrary@ionlibrary) ==0){
>>   library(knitr)
>>   opts_chunk$set(eval=FALSE, message=FALSE, echo=FALSE)
>> }
>> ```
>>
>> Which disables the evaluation of subsequent chunks.
>>
>> However my RMD file contains also these kind of snippets : `r `
>>
>> How do I disable them?
>>
>> regards
>>
>>
>>
>> --
>> Witold Eryk Wolski
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ts.intersect() not working

2015-11-10 Thread Giorgio Garziano
It appears to be a numerical precision issue introduced while computing the 
"end" value of a time series,
if not already specified at ts() input parameter level.

You may want to download the R source code:

  https://cran.r-project.org/src/base/R-3/R-3.2.2.tar.gz

and look into R-3.2.2\src\library\stats\R\ts.R, specifically at code block 
lines 52..64,
where "end" is handled.

Then look at block code 140-142 ts.R, where a comparison is performed in order 
to determine if
the time series are overlapping.

In your second scenario (b2, b3) it happens that:

> tsps
   [,1]   [,2]
[1,] 2009.58333 2009.7
[2,] 2009.5 2009.7
[3,]   12.0   12.0
> st <- max(tsps[1,])
> en <- min(tsps[2,])
> st
[1] 2009.7
> en
[1] 2009.5

And (st > en) triggers the "non-intersecting series" warning.

That issue has origin inside the ts() function in the "end" computation based 
on start, ndata and frequency.

What basically happens can be so replicated:

start = c(2009, 8)
end = c(2009,9)
frequency=12
ndata=2

start <- start[1L] + (start[2L] - 1)/frequency
start
[1] 2009.58333

end <- end[1L] + (end[2L] - 1)/frequency
end
[1] 2009.7

end <- start + (ndata - 1)/frequency
end
[1] 2009.5

Note the difference between the two "end" values above.

As workaround, you can specify the "end" parameter in the ts() call.


> b2 <- ts(data = c(10, 20), start = c(2009, 8), end = c(2009,9), frequency = 
> 12);
> b2
 Aug Sep
2009  10  20
>
> b3 <- ts(data = matrix(data = 4:6, nrow = 1), start = c(2009, 9), end = 
> c(2009,9), frequency = 12);
> b3
 Series 1 Series 2 Series 3
Sep 2009456
>
> bb <- ts.intersect(b2, b3);
> bb
 b2 b3.Series 1 b3.Series 2 b3.Series 3
Sep 2009 20   4   5   6


Hope this helps

--
GG

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] alignments in random points

2015-11-10 Thread Denis Francisci
Dear forum,
I have a number of random point in a polygon. I would like to find those
points lying on the same lines.
Is there an R function to find alignments in points (something like this:
https://en.wikipedia.org/wiki/Alignments_of_random_points)?
And is it possible to do the same thing but changing the width of lines?

If it could be useful, I attached an example of R code that I'm using.

Thank's in advance,

DF


CODE:

library(sp)
poly<-matrix(c(16,17,25,22,16,58,55,55,61,58),ncol=2,nrow=5)

> poly
 [,1] [,2]
[1,]   16   58
[2,]   17   55
[3,]   25   55
[4,]   22   61
[5,]   16   58

p=Polygon(poly)
ps=Polygons(list(p),1)
sps=SpatialPolygons(list(ps))

p.rd=spsample(sps,n=150,"random")
plot(sps)
points(p.rd,pch=16, col='blue',cex=0.3)

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] MAc-pakcage, on OS-X 10.11.1: Warning Message In sqrt(var.T.agg.tau) : NaNs produced

2015-11-10 Thread Kostadin Kushlev
Hi there, 

I am trying to run a mini meta-analysis for three studies within one of my 
papers. I am using the Mac package for meta-analyzing correlation coefficients. 

I am using the following command: omni(es = z, var = var.z, data = dat, 
type="weighted", method = "fixed", ztor = TRUE)

This produces the expected values, but also a warning message: In 
sqrt(var.T.agg.tau) : NaNs produced

This message is repeated twice.

I am wondering how to interpret this error message. Is this because the program 
can’t estimate certain parameters due to the small number of correlation 
coefficients I am trying to analyze (only 3)? 

Most importantly, can I report and interpret the output despite those messages? 

Kosta 
 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] [GGplot] Geom_smooth with formula "power"?

2015-11-10 Thread David Winsemius

> On Nov 9, 2015, at 7:19 AM, Catarina Silva 
>  wrote:
> 
> I've tried others initial solutions and the adjustement was done to power 
> model in ggplot - geom_smooth.
> But, with "nls" I can't do the confidence interval with ggplot - geom_smooth? 
> I read that with "nls" we have to force "se=FALSE". Is this true?

Well, sort of. Setting `se = FALSE` prevents the ggplot2 functions from trying 
to force nls and nls.predict to do something that is not in their design.

> How can I draw confidence interval in the plot?
> 
> I've done this:
>> ggplot(data,aes(x = idade,y = v_mt)) +
> +   geom_point(alpha=2/10, shape=21,fill="darkgray", colour="black", size=3) 
> + 
> +   geom_smooth(method = 'nls', formula = y ~ a * x^b, start = 
> list(a=1,b=2),se=FALSE) 
>> 
> And then I don't have the confidence interval.
> 
> If I do:
>> ggplot(data,aes(x = idade,y = v_mt)) +
> +   geom_point(alpha=2/10, shape=21,fill="darkgray", colour="black", size=3) 
> + 
> +   geom_smooth(method = 'nls', formula = y ~ a * x^b, start = list(a=1,b=2)) 
> Error in pred$fit : $ operator is invalid for atomic vectors
>> 
> 
> Return error…
> 
Read the help page for nls. The ‘se.fit' parameter is set to FALSE and efforts 
to make it TRUE will be ignored. So `predict.nls` simply does not return 
std-error estimates in the typical manner of other predict.* functions. I 
believe this is because the authors of `nls` did not think there was a clear 
answer to the question of what confidence bounds should be returned. 

 If you want to add confidence bounds to an nls, then you need to decide what 
bounds to add, and then use the ggplot2 line-drawing functions to overlay them 
on your own. I found posts in Rhelp that pointed me to the ‘nls2' package, but 
when I tried to run the code I got messages saying that the `as.lm` function 
could not be found. 

http://markmail.org/message/7kvolf5zzpqyb7l2?q=list:org%2Er-project%2Er-help+as%2Elm+is+a+linear+model+between+the+response+variable+and+the+gradient

> require(nls2)
Loading required package: nls2
Loading required package: proto
> fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
> predict(as.lm(fm), interval = "confidence")
Error in predict(as.lm(fm), interval = "confidence") : 
  could not find function "as.lm"
> getAnywhere(as.lm)
no object named ‘as.lm’ was found


I also found a couple of posts on R-bloggers pointing me to the ‘propagate' 
package which has two different methods for constructing confidence intervals.

http://rmazing.wordpress.com/2013/08/14/predictnls-part-1-monte-carlo-simulation-confidence-intervals-for-nls-models/
http://rmazing.wordpress.com/2013/08/26/predictnls-part-2-taylor-approximation-confidence-intervals-for-nls-models/



— 
David.

> Ty,
> Catarina Silva  
> 
> -Original Message-
> From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] 
> Sent: sábado, 7 de Novembro de 2015 01:09
> To: bolseiro.raiz.csi...@portucelsoporcel.com; R mailling list
> Subject: Re: [R] [GGplot] Geom_smooth with formula "power"?
> 
> Does  [1] help? 
> 
> [1] 
> http://stackoverflow.com/questions/10528631/add-exp-power-trend-line-to-a-ggplot
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live Go...
>  Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> ---
> Sent from my phone. Please excuse my brevity.
> 
> On November 6, 2015 2:41:18 AM PST, Catarina Silva 
>  wrote:
>> Hi,
>> 
>> It's possible to use ggplot and geom_smooth to adjust a power curve to 
>> the data?
>> 
>> Initially i have done the adjustement with nls and the formula 'a*x^b', 
>> but resulted the singular matrix error for start solution. 
>> Alternatively I used the log transformation and i had correct results, 
>> but I can't draw a power curve on the graphic.
>> 
>> Someone know how to solve this problem?
>> 
>> 

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] [GGplot] Geom_smooth with formula "power"?

2015-11-10 Thread Bert Gunter
See section 8.4-8.5 of MASS 4th Ed. (the book) and the use of
profile.nls() and friends for profiling the log likelihhood surface.

Warning: standard F,t approximations may be poor if the log likelihood
is not nearly enough quadratic. The whole issue of what df to use is
also contentious/unresolved.

-- Bert

Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Tue, Nov 10, 2015 at 9:47 AM, David Winsemius  wrote:
>
>> On Nov 9, 2015, at 7:19 AM, Catarina Silva 
>>  wrote:
>>
>> I've tried others initial solutions and the adjustement was done to power 
>> model in ggplot - geom_smooth.
>> But, with "nls" I can't do the confidence interval with ggplot - 
>> geom_smooth? I read that with "nls" we have to force "se=FALSE". Is this 
>> true?
>
> Well, sort of. Setting `se = FALSE` prevents the ggplot2 functions from 
> trying to force nls and nls.predict to do something that is not in their 
> design.
>
>> How can I draw confidence interval in the plot?
>>
>> I've done this:
>>> ggplot(data,aes(x = idade,y = v_mt)) +
>> +   geom_point(alpha=2/10, shape=21,fill="darkgray", colour="black", size=3) 
>> +
>> +   geom_smooth(method = 'nls', formula = y ~ a * x^b, start = 
>> list(a=1,b=2),se=FALSE)
>>>
>> And then I don't have the confidence interval.
>>
>> If I do:
>>> ggplot(data,aes(x = idade,y = v_mt)) +
>> +   geom_point(alpha=2/10, shape=21,fill="darkgray", colour="black", size=3) 
>> +
>> +   geom_smooth(method = 'nls', formula = y ~ a * x^b, start = list(a=1,b=2))
>> Error in pred$fit : $ operator is invalid for atomic vectors
>>>
>>
>> Return error…
>>
> Read the help page for nls. The ‘se.fit' parameter is set to FALSE and 
> efforts to make it TRUE will be ignored. So `predict.nls` simply does not 
> return std-error estimates in the typical manner of other predict.* 
> functions. I believe this is because the authors of `nls` did not think there 
> was a clear answer to the question of what confidence bounds should be 
> returned.
>
>  If you want to add confidence bounds to an nls, then you need to decide what 
> bounds to add, and then use the ggplot2 line-drawing functions to overlay 
> them on your own. I found posts in Rhelp that pointed me to the ‘nls2' 
> package, but when I tried to run the code I got messages saying that the 
> `as.lm` function could not be found.
>
> http://markmail.org/message/7kvolf5zzpqyb7l2?q=list:org%2Er-project%2Er-help+as%2Elm+is+a+linear+model+between+the+response+variable+and+the+gradient
>
>> require(nls2)
> Loading required package: nls2
> Loading required package: proto
>> fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
>> predict(as.lm(fm), interval = "confidence")
> Error in predict(as.lm(fm), interval = "confidence") :
>   could not find function "as.lm"
>> getAnywhere(as.lm)
> no object named ‘as.lm’ was found
>
>
> I also found a couple of posts on R-bloggers pointing me to the ‘propagate' 
> package which has two different methods for constructing confidence intervals.
>
> http://rmazing.wordpress.com/2013/08/14/predictnls-part-1-monte-carlo-simulation-confidence-intervals-for-nls-models/
> http://rmazing.wordpress.com/2013/08/26/predictnls-part-2-taylor-approximation-confidence-intervals-for-nls-models/
>
>
>
> —
> David.
>
>> Ty,
>> Catarina Silva
>>
>> -Original Message-
>> From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
>> Sent: sábado, 7 de Novembro de 2015 01:09
>> To: bolseiro.raiz.csi...@portucelsoporcel.com; R mailling list
>> Subject: Re: [R] [GGplot] Geom_smooth with formula "power"?
>>
>> Does  [1] help?
>>
>> [1] 
>> http://stackoverflow.com/questions/10528631/add-exp-power-trend-line-to-a-ggplot
>> ---
>> Jeff NewmillerThe .   .  Go Live...
>> DCN:Basics: ##.#.   ##.#.  Live Go...
>>  Live:   OO#.. Dead: OO#..  Playing
>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
>> ---
>> Sent from my phone. Please excuse my brevity.
>>
>> On November 6, 2015 2:41:18 AM PST, Catarina Silva 
>>  wrote:
>>> Hi,
>>>
>>> It's possible to use ggplot and geom_smooth to adjust a power curve to
>>> the data?
>>>
>>> Initially i have done the adjustement with nls and the formula 'a*x^b',
>>> but resulted the singular matrix error for start solution.
>>> Alternatively I used the log transformation and i had correct results,
>>> but I can't draw a power curve on the graphic.
>>>
>>> Someone know how to solve this problem?
>>>
>>>
>
> David Winsemius
> Alameda, CA, USA
>
> 

Re: [R-es] Problema con la lectura de datos

2015-11-10 Thread Javier Rubén Marcuzzi
Estimada Valentina Aguilera

Intenta lo siguiente:

Rstudio, import data set, busca tu variables2.csv

¿funciona? Si esto funciona mira el código que Rstudio escribe por usted.

Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario



De: Valentina Aguilera
Enviado: martes, 10 de noviembre de 2015 16:04
Para: r help
Asunto: [R-es] Problema con la lectura de datos


Hola, 
Estoy tratando de leer una base de datos: tengo 39 columnas, de las cuales 38 
son variables y una es el nombre de las empresas. Por lo que escribo el 
siguiente codigo:
Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, 
sep=";", comment.char="" ,  
colClasses=c(Empresas="character", rep("numeric",38)), strip.white=FALSE, dec = 
",")
Pero genera este error (y no se a que se deba, esto es, porque necesito 
calcular la matriz de correlaciones y me dice que los valores no son numericos):
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :   
scan() expected 'a real', got 'ND'
Gracias mil.  
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es



[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R-es] problema as.numeric

2015-11-10 Thread Javier Rubén Marcuzzi
Estimados

Hay un problema, miren lo que sale en b$Edad, esos valores son correctos, pero 
luego realizo str$Edad, aparecen 24, 24, 24, 5 …. , convierto a números con 
b$Edad <- as.numeric(b$Edad) y los valores son 24, 24, 25 … (valores que no son 
reales).

Es fácil, lo realice muchas veces pero ahora estoy confundido. ¿Alguna ayuda? 
Gracias

> b$Edad
  [1] 5   5   5   0,5 0,5 5   5   2   9   9   9   9   9   9   9   9   9  
 [18] 7   7   5   16  16  0,3 2   5   5   5   5   7   7   7   4   4   4  
 [35] 4   13  5   5   5   0,3 0,3 0,3 6   6   7   10  10  10  3   0,9 0,9
 [52] 0,9 10  8   8   8   8   3   3   3   10  10  10  1   15  15  15  3  
 [69] 3   2   2   8   8   11  11  11  0,1 0,1 0,1 0,1 3   12  10  10  10 
 [86] 3   3   3   4   2   0,3 0,3 0,3 10  0,8 0,8 0,8 8   8   8   1   1  
[103] 1   1   1   8   7   5   3   6   4   16  17  11  9   10 
[120] 1   2   2   2   3   13  14  5   5   3   3   6   4   7   1,4 0,4
[137] 6   2   3   4   10  9   7   9   8   8   8   8   8   10  13  13  0,8
[154] 1,8 6   7   1   1   5   8   8   10  9   8   2   2   2   7   10  9  
[171] 8   10  10  10  0,4 4   6   5   3   2   2   10  8   9   4   4   11 
[188] 11  6   5   7   4   5   4   0,5 0,5 0,7 12  12  14  14 
[205] 16  15  8   8   4   0,4 1,4 0,4 2,4 0,4 5   6   4   2   3   2   2  
[222] 4   4   4   4   1   2   3   6   7   1   2   7   7  
28 Levels:  0,1 0,3 0,4 0,5 0,7 0,8 0,9 1 1,4 1,8 10 11 12 13 14 15 ... 9
> str(b$Edad)
 Factor w/ 28 levels "","0,1","0,3",..: 24 24 24 5 5 24 24 20 28 28 ...
> b$Edad <- as.numeric(b$Edad)
> str(b$Edad)
 num [1:234] 24 24 24 5 5 24 24 20 28 28 ...


Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R] MAc-pakcage, on OS-X 10.11.1: Warning Message In sqrt(var.T.agg.tau) : NaNs produced

2015-11-10 Thread Michael Dewey

Dear Kostadin

You could give us the data (after all there are only three studies) so 
we can run it through a different package or you could look at the code 
for omni and see where it is computing sqrt(var.T.agg.tau) and how it 
computed that in the first place.


And you could turn off HTML in your mailer as otherwise your mail can 
get corrupted.


On 10/11/2015 08:14, Kostadin Kushlev wrote:

Hi there,

I am trying to run a mini meta-analysis for three studies within one of my 
papers. I am using the Mac package for meta-analyzing correlation coefficients.

I am using the following command: omni(es = z, var = var.z, data = dat, type="weighted", 
method = "fixed", ztor = TRUE)

This produces the expected values, but also a warning message: In 
sqrt(var.T.agg.tau) : NaNs produced

This message is repeated twice.

I am wondering how to interpret this error message. Is this because the program 
can’t estimate certain parameters due to the small number of correlation 
coefficients I am trying to analyze (only 3)?

Most importantly, can I report and interpret the output despite those messages?

Kosta



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R-es] Problema con la lectura de datos

2015-11-10 Thread Valentina Aguilera
Hola, 
Estoy tratando de leer una base de datos: tengo 39 columnas, de las cuales 38 
son variables y una es el nombre de las empresas. Por lo que escribo el 
siguiente codigo:
Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, 
sep=";", comment.char="" ,  
colClasses=c(Empresas="character", rep("numeric",38)), strip.white=FALSE, dec = 
",")
Pero genera este error (y no se a que se deba, esto es, porque necesito 
calcular la matriz de correlaciones y me dice que los valores no son numericos):
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :   
scan() expected 'a real', got 'ND'
Gracias mil.  
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R-es] Problema con la lectura de datos

2015-11-10 Thread Carlos Ortega
Hola,

Prueba a seleccionar dos de las columnas y calcular la correlación.
O incluso antes de esto, ver su clase:

class(Variables[, numero_de_la_columna_1])
class(Variables[, numero_de_la_columna_2])

Si son numeric, entonces puedes calcular la correlación
cor(Variables[, col1], Variables[, col2] )

Si obtienes un error, es que en alguna de las dos variables, hay algún
"NA".

(Ayuda si compartes el fichero de entrada) para avanzar más rápido...).

Saludos,
Carlos Ortega
www.qualityexcellence.es




El 10 de noviembre de 2015, 20:56, Valentina Aguilera 
escribió:

> con as.numeric tampoco me van los cálculos y no conozco otra manera, pues
> son alrededor de 40 variables las que tiene la tabla.
>
> To: valea...@outlook.es; c...@qualityexcellence.es; r-help-es@r-project.org
> From: javier.ruben.marcu...@gmail.com
> Subject: RE: [R-es] Problema con la lectura de datos
> Date: Tue, 10 Nov 2015 16:43:05 -0300
>
> Estimada Valentina
>
> as.numeric(...)
>
> Mira mi correo (de hace minutos) donde pregunto justo por eso, pero sobre
> un error.
>
>
> Javier Rubén Marcuzzi
> Técnico en Industrias Lácteas
> Veterinario
>
>
>
> De: Valentina Aguilera
> Enviado: martes, 10 de noviembre de 2015 16:40
> Para: Carlos Ortega;r help
> Asunto: Re: [R-es] Problema con la lectura de datos  Hola, sin indicar los
> tipos de variables si los lee, pero el problema est� en que necesito
> calcular una matriz de correlaciones y genera el siguiente error:Error in
> cor(Variables) : 'x' must be numeric Date: Tue, 10 Nov 2015 20:35:40
> +0100Subject: Re: [R-es] Problema con la lectura de datosFrom:
> c...@qualityexcellence.esto: valea...@outlook.escc: r-help-es@r-project.org
> Hola, Prueba a leer el fichero sin indicar los tipos de las variables.
> Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv",
> header=TRUE, sep=";", comment.char="" , strip.white=FALSE, dec = ",")
> Saludos,Carlos Ortegawww.qualityexcellence.es  El 10 de noviembre de
> 2015, 20:04, Valentina Aguilera  escribi�:Hola,
> Estoy tratando de leer una base de datos: tengo 39 columnas, de las cuales
> 38 son variables y una es el nombre de las empresas. Por lo que escribo el
> siguiente codigo: Variables <-
> read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, sep=";",
> comment.char="" ,
> colClasses=c(Empresas="character", rep("numeric",38)), strip.white=FALSE,
> dec = ",") Pero genera este error (y no se a que se deba, esto es, porque
> necesito calcular la matriz de correlaciones y me dice que los valores no
> son numericos): Error in scan(file, what, nmax, sep, dec, quote, skip,
> nlines, na.strings,  :   scan() expected 'a real', got 'ND' Gracias mil.
>  [[alternative HTML version deleted]]
>  ___ R-help-es mailing list
> R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
>  -- Saludos,Carlos Ortegawww.qualityexcellence.es
>
> [[alternative HTML version deleted]]
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R-es] Problema con la lectura de datos

2015-11-10 Thread Javier Rubén Marcuzzi
Estimado Valentina Aguilera

Prueba algo como:
b$Edad <- as.vector(b$Edad)
o
b$Edad <- as.numeric(b$Edad)

Claro, por cada variable que debas convertir. Yo para saber cuales escribo 
str(mi data frame).

Uno de los dos tendría que funcionar

Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario



De: Valentina Aguilera
Enviado: martes, 10 de noviembre de 2015 16:56
Para: Javier Rubén Marcuzzi;r help
Asunto: RE: [R-es] Problema con la lectura de datos


con as.numeric tampoco me van los cálculos y no conozco otra manera, pues son 
alrededor de 40 variables las que tiene la tabla.

To: valea...@outlook.es; c...@qualityexcellence.es; r-help-es@r-project.org
From: javier.ruben.marcu...@gmail.com
Subject: RE: [R-es] Problema con la lectura de datos
Date: Tue, 10 Nov 2015 16:43:05 -0300
Estimada Valentina
 
as.numeric(...)
 
Mira mi correo (de hace minutos) donde pregunto justo por eso, pero sobre un 
error.
 
 
Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario
 
 

De: Valentina Aguilera
Enviado: martes, 10 de noviembre de 2015 16:40
Para: Carlos Ortega;r help
Asunto: Re: [R-es] Problema con la lectura de datos
 
 
Hola, sin indicar los tipos de variables si los lee, pero el problema est� en 
que necesito calcular una matriz de correlaciones y genera el siguiente error:
Error in cor(Variables) : 'x' must be numeric
 
Date: Tue, 10 Nov 2015 20:35:40 +0100
Subject: Re: [R-es] Problema con la lectura de datos
From: c...@qualityexcellence.es
To: valea...@outlook.es
CC: r-help-es@r-project.org
 
Hola,
 
Prueba a leer el fichero sin indicar los tipos de las variables.
 
Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, 
sep=";", comment.char="" , strip.white=FALSE, dec = ",")
 
Saludos,
Carlos Ortega
www.qualityexcellence.es
 
 
El 10 de noviembre de 2015, 20:04, Valentina Aguilera  
escribi�:
Hola,
 
Estoy tratando de leer una base de datos: tengo 39 columnas, de las cuales 38 
son variables y una es el nombre de las empresas. Por lo que escribo el 
siguiente codigo:
 
Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, 
sep=";", comment.char="" ,  
colClasses=c(Empresas="character", rep("numeric",38)), strip.white=FALSE, dec = 
",")
 
Pero genera este error (y no se a que se deba, esto es, porque necesito 
calcular la matriz de correlaciones y me dice que los valores no son numericos):
 
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :   
scan() expected 'a real', got 'ND'
 
Gracias mil.
 
    [[alternative HTML version deleted]]
 
 
 
___
 
R-help-es mailing list
 
R-help-es@r-project.org
 
https://stat.ethz.ch/mailman/listinfo/r-help-es
 
 
 
-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es
           
    [[alternative HTML version deleted]]
 
 
 


___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R-es] Problema con la lectura de datos

2015-11-10 Thread Valentina Aguilera
Hola, sin indicar los tipos de variables si los lee, pero el problema est� en 
que necesito calcular una matriz de correlaciones y genera el siguiente error:
Error in cor(Variables) : 'x' must be numeric

Date: Tue, 10 Nov 2015 20:35:40 +0100
Subject: Re: [R-es] Problema con la lectura de datos
From: c...@qualityexcellence.es
To: valea...@outlook.es
CC: r-help-es@r-project.org

Hola,

Prueba a leer el fichero sin indicar los tipos de las variables.

Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, 
sep=";", comment.char="" , strip.white=FALSE, dec = ",")

Saludos,
Carlos Ortega
www.qualityexcellence.es


El 10 de noviembre de 2015, 20:04, Valentina Aguilera  
escribi�:
Hola,

Estoy tratando de leer una base de datos: tengo 39 columnas, de las cuales 38 
son variables y una es el nombre de las empresas. Por lo que escribo el 
siguiente codigo:

Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, 
sep=";", comment.char="" ,  
colClasses=c(Empresas="character", rep("numeric",38)), strip.white=FALSE, dec = 
",")

Pero genera este error (y no se a que se deba, esto es, porque necesito 
calcular la matriz de correlaciones y me dice que los valores no son numericos):

Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :   
scan() expected 'a real', got 'ND'

Gracias mil.

[[alternative HTML version deleted]]



___

R-help-es mailing list

R-help-es@r-project.org

https://stat.ethz.ch/mailman/listinfo/r-help-es



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es
  
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R-es] problema as.numeric

2015-11-10 Thread Javier Rubén Marcuzzi
Gracias Carlos

Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario



De: Carlos Ortega
Enviado: martes, 10 de noviembre de 2015 16:43
Para: Javier Rubén Marcuzzi
CC: r-help-es@r-project.org
Asunto: Re: [R-es] problema as.numeric


Hola,
b$Edad es un "factor".
En vez de convertir a "numeric", convierte a "vector"
b$Edad <- as.vector(b$Edad)
Saludos,
Carlos Ortega
www.qualityexcellence.es

El 10 de noviembre de 2015, 20:31, Javier Rubén Marcuzzi 
 escribió:
Estimados

Hay un problema, miren lo que sale en b$Edad, esos valores son correctos, pero 
luego realizo str$Edad, aparecen 24, 24, 24, 5 …. , convierto a números con 
b$Edad <- as.numeric(b$Edad) y los valores son 24, 24, 25 … (valores que no son 
reales).

Es fácil, lo realice muchas veces pero ahora estoy confundido. ¿Alguna ayuda? 
Gracias

> b$Edad
  [1] 5   5   5   0,5 0,5 5   5   2   9   9   9   9   9   9   9   9   9
 [18] 7   7   5   16  16  0,3 2   5   5   5   5   7   7   7   4   4   4
 [35] 4   13  5   5   5   0,3 0,3 0,3 6   6   7   10  10  10  3   0,9 0,9
 [52] 0,9 10  8   8   8   8   3   3   3   10  10  10  1   15  15  15  3
 [69] 3   2   2   8   8   11  11  11  0,1 0,1 0,1 0,1 3   12  10  10  10
 [86] 3   3   3   4   2   0,3 0,3 0,3 10  0,8 0,8 0,8 8   8   8   1   1
[103] 1   1   1   8   7   5   3   6   4   16  17  11  9   10
[120]     1   2   2   2   3   13  14  5   5   3   3   6   4   7   1,4 0,4
[137] 6   2   3   4   10  9   7   9   8   8   8   8   8   10  13  13  0,8
[154] 1,8 6   7   1   1   5   8   8   10  9   8   2   2   2   7   10  9
[171] 8   10  10  10  0,4 4   6   5   3   2   2   10  8   9   4   4   11
[188] 11  6   5   7   4   5               4   0,5 0,5 0,7 12  12  14  14
[205] 16  15  8   8   4   0,4 1,4 0,4 2,4 0,4 5   6   4   2   3   2   2
[222] 4   4   4   4   1   2   3   6   7   1   2   7   7
28 Levels:  0,1 0,3 0,4 0,5 0,7 0,8 0,9 1 1,4 1,8 10 11 12 13 14 15 ... 9
> str(b$Edad)
 Factor w/ 28 levels "","0,1","0,3",..: 24 24 24 5 5 24 24 20 28 28 ...
> b$Edad <- as.numeric(b$Edad)
> str(b$Edad)
 num [1:234] 24 24 24 5 5 24 24 20 28 28 ...


Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario

        [[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es



[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R-es] Problema con la lectura de datos

2015-11-10 Thread Valentina Aguilera
con as.numeric tampoco me van los cálculos y no conozco otra manera, pues son 
alrededor de 40 variables las que tiene la tabla.

To: valea...@outlook.es; c...@qualityexcellence.es; r-help-es@r-project.org
From: javier.ruben.marcu...@gmail.com
Subject: RE: [R-es] Problema con la lectura de datos
Date: Tue, 10 Nov 2015 16:43:05 -0300

Estimada Valentina
 
as.numeric(...)
 
Mira mi correo (de hace minutos) donde pregunto justo por eso, pero sobre un 
error.
 
 
Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario
 
 

De: Valentina Aguilera
Enviado: martes, 10 de noviembre de 2015 16:40
Para: Carlos Ortega;r help
Asunto: Re: [R-es] Problema con la lectura de datos  Hola, sin indicar los 
tipos de variables si los lee, pero el problema est� en que necesito calcular 
una matriz de correlaciones y genera el siguiente error:Error in cor(Variables) 
: 'x' must be numeric Date: Tue, 10 Nov 2015 20:35:40 +0100Subject: Re: [R-es] 
Problema con la lectura de datosFrom: c...@qualityexcellence.esto: 
valea...@outlook.escc: r-help-es@r-project.org Hola, Prueba a leer el fichero 
sin indicar los tipos de las variables. Variables <- 
read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, sep=";", 
comment.char="" , strip.white=FALSE, dec = ",") Saludos,Carlos 
Ortegawww.qualityexcellence.es  El 10 de noviembre de 2015, 20:04, Valentina 
Aguilera  escribi�:Hola, Estoy tratando de leer una base 
de datos: tengo 39 columnas, de las cuales 38 son variables y una es el nombre 
de las empresas. Por lo que escribo el siguiente codigo: Variables <- 
read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, sep=";", 
comment.char="" ,  colClasses=c(Empresas="character", 
rep("numeric",38)), strip.white=FALSE, dec = ",") Pero genera este error (y no 
se a que se deba, esto es, porque necesito calcular la matriz de correlaciones 
y me dice que los valores no son numericos): Error in scan(file, what, nmax, 
sep, dec, quote, skip, nlines, na.strings,  :   scan() expected 'a real', got 
'ND' Gracias mil. [[alternative HTML version deleted]]   
___ R-help-es mailing list 
R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es   -- 
Saludos,Carlos Ortegawww.qualityexcellence.es   
 [[alternative HTML 
version deleted]]
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R-es] Problema con la lectura de datos

2015-11-10 Thread Javier Rubén Marcuzzi
Estimada Valentina

as.numeric(...)

Mira mi correo (de hace minutos) donde pregunto justo por eso, pero sobre un 
error.


Javier Rubén Marcuzzi
Técnico en Industrias Lácteas
Veterinario



De: Valentina Aguilera
Enviado: martes, 10 de noviembre de 2015 16:40
Para: Carlos Ortega;r help
Asunto: Re: [R-es] Problema con la lectura de datos


Hola, sin indicar los tipos de variables si los lee, pero el problema est� en 
que necesito calcular una matriz de correlaciones y genera el siguiente error:
Error in cor(Variables) : 'x' must be numeric

Date: Tue, 10 Nov 2015 20:35:40 +0100
Subject: Re: [R-es] Problema con la lectura de datos
From: c...@qualityexcellence.es
To: valea...@outlook.es
CC: r-help-es@r-project.org

Hola,

Prueba a leer el fichero sin indicar los tipos de las variables.

Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, 
sep=";", comment.char="" , strip.white=FALSE, dec = ",")

Saludos,
Carlos Ortega
www.qualityexcellence.es


El 10 de noviembre de 2015, 20:04, Valentina Aguilera  
escribi�:
Hola,

Estoy tratando de leer una base de datos: tengo 39 columnas, de las cuales 38 
son variables y una es el nombre de las empresas. Por lo que escribo el 
siguiente codigo:

Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv", header=TRUE, 
sep=";", comment.char="" ,  
colClasses=c(Empresas="character", rep("numeric",38)), strip.white=FALSE, dec = 
",")

Pero genera este error (y no se a que se deba, esto es, porque necesito 
calcular la matriz de correlaciones y me dice que los valores no son numericos):

Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :   
scan() expected 'a real', got 'ND'

Gracias mil.

[[alternative HTML version deleted]]



___

R-help-es mailing list

R-help-es@r-project.org

https://stat.ethz.ch/mailman/listinfo/r-help-es



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es
  
[[alternative HTML version deleted]]




[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R] MAc-package, on OS-X 10.11.1: Warning Message In sqrt(var.T.agg.tau) : NaNs produced

2015-11-10 Thread Roebuck,Paul L
Maybe change the warnings to errors temporarily, and decide for yourself about 
the problem.

...
R> options(warn=2)# Turn warnings into errors
R> omni(es=z, var=var.z, data=dat, type="weighted", method="fixed", ztor=TRUE)
R> traceback()



From: R-help [r-help-boun...@r-project.org] on behalf of Kostadin Kushlev 
[kushl...@gmail.com]
Sent: Tuesday, November 10, 2015 2:14 AM
To: r-help@r-project.org
Subject: [R] MAc-pakcage,   on OS-X 10.11.1: Warning Message In 
sqrt(var.T.agg.tau) : NaNs  produced

I am trying to run a mini meta-analysis for three studies within one of my 
papers. I am using the Mac package for meta-analyzing correlation coefficients.

I am using the following command: omni(es = z, var = var.z, data = dat, 
type="weighted", method = "fixed", ztor = TRUE)

This produces the expected values, but also a warning message: In 
sqrt(var.T.agg.tau) : NaNs produced

This message is repeated twice.

I am wondering how to interpret this error message. Is this because the program 
can’t estimate certain parameters due to the small number of correlation 
coefficients I am trying to analyze (only 3)?

Most importantly, can I report and interpret the output despite those messages?
The information contained in this e-mail message may be privileged, 
confidential, and/or protected from disclosure. This e-mail message may contain 
protected health information (PHI); dissemination of PHI should comply with 
applicable federal and state laws. If you are not the intended recipient, or an 
authorized representative of the intended recipient, any further review, 
disclosure, use, dissemination, distribution, or copying of this message or any 
attachment (or the information contained therein) is strictly prohibited. If 
you think that you have received this e-mail message in error, please notify 
the sender by return e-mail and delete all references to it and its contents 
from your systems.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R-es] Problema con la lectura de datos

2015-11-10 Thread Carlos Ortega
Hola,

Prueba a leer el fichero sin indicar los tipos de las variables.

Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv",
header=TRUE, sep=";", comment.char="" , strip.white=FALSE, dec = ",")

Saludos,
Carlos Ortega
www.qualityexcellence.es


El 10 de noviembre de 2015, 20:04, Valentina Aguilera 
escribió:

> Hola,
> Estoy tratando de leer una base de datos: tengo 39 columnas, de las cuales
> 38 son variables y una es el nombre de las empresas. Por lo que escribo el
> siguiente codigo:
> Variables <- read.csv("C:/Users/usuario/Documents/variables2.csv",
> header=TRUE, sep=";", comment.char="" ,
> colClasses=c(Empresas="character", rep("numeric",38)), strip.white=FALSE,
> dec = ",")
> Pero genera este error (y no se a que se deba, esto es, porque necesito
> calcular la matriz de correlaciones y me dice que los valores no son
> numericos):
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,
> na.strings,  :   scan() expected 'a real', got 'ND'
> Gracias mil.
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] conditionally disable evaluation of chunks in Rmarkdown...

2015-11-10 Thread Henrik Bengtsson
On Tue, Nov 10, 2015 at 9:00 AM, Yihui Xie  wrote:
> The short answer is you cannot. Inline R code is always evaluated.
> When it is not evaluated, I doubt if your output still makes sense,
> e.g. "The value of x is `r x`." becomes "The value of x is ." That
> sounds odd to me.
>
> If you want to disable the evaluate of inline code anyway, you may use
> a custom function to do it. e.g.
>
> cond_eval = function(x) {
>   if (isTRUE(knitr::opts_chunk$get('eval'))) x
> }
>
> Then `r cond_eval(x)` instead of `r x`.
>
> Regards,
> Yihui
> --
> Yihui Xie 
> Web: http://yihui.name
>
>
> On Tue, Nov 10, 2015 at 4:40 AM, Witold E Wolski  wrote:
>> I do have an Rmd where I would like to conditionally evaluate the second 
>> part.
>>
>> So far I am working with :
>>
>> ```{r}
>> if(length(specLibrary@ionlibrary) ==0){
>>   library(knitr)
>>   opts_chunk$set(eval=FALSE, message=FALSE, echo=FALSE)
>> }
>> ```
>>
>> Which disables the evaluation of subsequent chunks.
>>
>> However my RMD file contains also these kind of snippets : `r `
>>
>> How do I disable them?

Just a FYI and maybe/maybe not a option for you; this is one of the
use cases where RSP (https://cran.r-project.org/package=R.rsp) is
handy because it does not require that code snippets (aka "code
chunks" as originally defined by weave/tangle literate programming) to
contain complete expressions.  With RSP-embedded documents, you can do
things such

<% if (length(specLibrary@ionlibrary) > 0) { %>

[... code and text blocks to conditionally include ...]

<% } # if (length(specLibrary@ionlibrary) > 0) %>

or include from a separate file, e.g.

<% if (length(specLibrary@ionlibrary) > 0) { %> <%@include
file="extras.md.rsp"%> <% } %>

You can also use loops over a mixture of code and text blocks etc.

Depending on when 'specLibrary@ionlibrary' gets assigned, you could
preprocess you R Markdown file with RSP, but for this to work out of
the box you basically need to know the value
length(specLibrary@ionlibrary) before your R Markdown code is
evaluated, i.e. before you compile the Rmd file.  Your build pipeline
would then look something like:

rmd <- R.rsp::rfile("report.rmd.rsp")
rmarkdown::render(rmd)

/Henrik
(author of R.rsp)

>>
>> regards
>>
>>
>>
>> --
>> Witold Eryk Wolski
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Revolutions blog: October 2015 roundup

2015-11-10 Thread David Smith
Since 2008, Revolution Analytics (and now Microsoft) staff and guests have 
written about R every weekday at the
Revolutions blog:
http://blog.revolutionanalytics.com
and every month I post a summary of articles from the previous month of 
particular interest to readers of r-help.

In case you missed them, here are some articles related to R from the month of 
October:

A way of dealing with confounding variables in experiments: instrumental 
variable analysis with the ivmodel package for
R: http://blog.revolutionanalytics.com/2015/10/instrumental-variables.html

The new dplyrXdf package 
http://blog.revolutionanalytics.com/2015/10/the-dplyrxdf-package.html allows 
you to manipulate
large, out-of-memory data sets in the XDF format (used by the RevoScaleR 
package) using dplyr syntax:
http://blog.revolutionanalytics.com/2015/10/using-the-dplyrxdf-package.html

Some guidelines for using explicit parallel programming (e.g. the parallel 
package) with the implicit multithreading
provided by Revolution R Open:
http://blog.revolutionanalytics.com/2015/10/edge-cases-in-using-the-intel-mkl-and-parallel-programming.html

Ross Ihaka was featured in a full-page advertisement for the University of 
Auckland in The Economist:
http://blog.revolutionanalytics.com/2015/10/ross-ihaka-in-the-economist.html

A video from the PASS 2015 conference in Seattle shows R running within SQL 
Server 2016:
http://blog.revolutionanalytics.com/215/10/demo-r-in-sql-server-2016.html . The 
preview for SQL Server 2016 includes
Revolution R Enterprise (as SQL Server R Services)
http://blog.revolutionanalytics.com/2015/10/revolution-r-now-available-with-sql-server-community-preview.html

A comparison of fitting decision trees in R with the party and rpart packages:
http://blog.revolutionanalytics.com/2015/10/party-with-the-first-tribe.html

The foreach suite of packages for parallel programming in R has been updated, 
and now includes support for progress bars
when using doSNOW: 
http://blog.revolutionanalytics.com/2015/10/updates-to-the-foreach-package-and-its-friends.html

The "reach" package allows you to call Matlab functions directly from R:
http://blog.revolutionanalytics.com/2015/10/reach-for-your-matlab-data-with-r.html

A review of support vector machines (SVMs) in R:
http://blog.revolutionanalytics.com/2015/10/the-5th-tribe-support-vector-machines-and-caret.html

A presentation (with sample code) shows how to call Revolution R Enterprise 
from SQL Server 2016:
http://blog.revolutionanalytics.com/2015/10/previewing-using-revolution-r-enterprise-inside-sql-server.html

A tutorial on using the miniCRAN package to set up packages for use with R in 
Azure ML:
http://blog.revolutionanalytics.com/2015/10/using-minicran-in-azure-ml.html

Asif Salam shows how to use the RDCOMClient package to construct interactive 
Powerpoint slide shows with R:
http://blog.revolutionanalytics.com/2015/10/programmatically-create-interactive-powerpoint-slides-with-r.html

A directory of online R courses for all skill levels:
http://blog.revolutionanalytics.com/2015/10/learning-r-oct-2015.html

Using R's nls() optimizer to solve a problem in Bayesian inference:
http://blog.revolutionanalytics.com/2015/10/parameters-and-percentiles-the-gamma-distribution.html

A professor uses the miniCRAN package to deliver R packages to offline 
facilities in Turkey and Iran:
http://blog.revolutionanalytics.com/2015/10/using-minicran-on-site-in-iran.html

Amanda Cox, graphics editor at the New York Times, calls R "the greatest 
software on Earth" in a podcast:
http://blog.revolutionanalytics.com/2015/10/amanda-cox-on-using-r-at-the-nyt.html

Hadley Wickham answered many questions in a Reddit "Ask Me Anything" session:
http://blog.revolutionanalytics.com/2015/10/hadley-wickhams-ask-me-anything-on-reddit.html

A roundup of several talks given at R user group meetings around the world:
http://blog.revolutionanalytics.com/2015/10/r-user-groups-highlight-r-creativity.html

General interest stories (not related to R) in the past month included: 
visualizing the movements of chess pieces
(http://blog.revolutionanalytics.com/2015/10/chess-piece-moves.html), real-time 
face replication
(http://blog.revolutionanalytics.com/2015/10/because-its-friday-faceon.html), a 
world map of antineutrinos
(http://blog.revolutionanalytics.com/2015/10/because-its-friday-mapping-antineutrinos.html),
 a transformation
(http://blog.revolutionanalytics.com/2015/10/because-its-friday-a-transformation.html),
 and a warning about "big data"
applications 
(http://blog.revolutionanalytics.com/2015/10/because-its-friday-are-we-selling-radium-underpants.html).

Meeting times for local R user groups 
(http://blog.revolutionanalytics.com/local-r-groups.html) can be found on the
updated R Community Calendar at: 
http://blog.revolutionanalytics.com/calendar.html

If you're looking for more articles about R, you can find summaries from 
previous months at
http://blog.revolutionanalytics.com/roundups/. You can 

[R] no results

2015-11-10 Thread Alaa Sindi
Hi All,

I am not getting any summary results and I do not have any error. what would be 
the problem? 



sem=mlogit.optim ( LL  , Start, method = 'nr', iterlim = 2000, tol = 1E-05, 
ftol = 1e-08, steptol = 1e-10, print.level = 0)
summary(sem)

thanks

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Subsetting dataframe by the nearest values of a vector elements

2015-11-10 Thread Harun Rashid via R-help
HI Jean,
Here is part of my data. As you can see, I have cross-section point and 
corresponding elevation of a river. Now I want to select cross-section 
points by 50m interval. But the real cross-section data might not have 
exact points say 0, 50, 100,…and so on. Therefore, I need to take points 
closest to those values.

cross_section elevation
1: 5.608 12.765
2: 11.694 10.919
3: 14.784 10.274
4: 20.437 7.949
5: 22.406 7.180
101: 594.255 7.710
102: 595.957 7.717
103: 597.144 7.495
104: 615.925 7.513
105: 615.890 7.751

I checked for some suggestions [particularly here 
]
 
and finally did like this.

intervals <- c(5,50,100,150,200,250,300,350,400,450,500,550,600)
dt = data.table(real.val = w$cross_section, w)
setattr(dt,’sorted’,’cross_section’)
dt[J(intervals), roll = “nearest”]

And it gave me what I wanted.

dt[J(intervals), roll = “nearest”]
cross_section real.val elevation
1: 5 5.608 12.765
2: 50 49.535 6.744
3: 100 115.614 8.026
4: 150 152.029 7.206
5: 200 198.201 6.417
6: 250 247.855 4.497
7: 300 298.450 11.299
8: 350 352.473 11.534
9: 400 401.287 10.550
10: 450 447.768 9.371
11: 500 501.284 8.984
12: 550 550.650 16.488
13: 600 597.144 7.495

I don’t know whether there is a smarter to accomplish this!
Thanks in advance.
Regards,
Harun

On 11/10/15 11:17 AM, David Winsemius wrote:

>> On Nov 9, 2015, at 9:19 AM, Adams, Jean  wrote:
>>
>> Harun,
>>
>> Can you give a simple example?
>>
>> If your cross_section looked like this
>> c(144, 179, 214, 39, 284, 109, 74, 4, 249)
>> and your other vector looked like this
>> c(0, 50, 100, 150, 200, 250, 300, 350)
>> what would you want your subset to look like?
>>
>> Jean
>>
>> On Mon, Nov 9, 2015 at 7:26 AM, Harun Rashid via R-help <
>> r-help@r-project.org> wrote:
>>
>>> Hello,
>>> I have a dataset with two columns 1. cross_section (range: 0~635), and
>>> 2. elevation. The dataset has more than 100 rows. Now I want to make a
>>> subset on the condition that the 'cross_section' column will pick up the
>>> nearest cell from another vector (say 0, 50,100,150,200,.,650).
>>> How can I do this? I would really appreciate a solution.
> If you what the "other vector" to define the “cell” boundaries, and using 
> Jean’s example, it is a simple application of `findInterval`:
>
>> inp <- c(144, 179, 214, 39, 284, 109, 74, 4, 249)
>> mids <- c(0, 50, 100, 150, 200, 250, 300, 350)
>> findInterval( inp, c(mids) )
> [1] 3 4 5 1 6 3 2 1 5
>
> On the other hand ...
>
> To find the number of "closest point", this might help:
>
>
>> findInterval(inp, c( mids[1]-.001, head(mids,-1)+diff(mids)/2, 
>> tail(mids,1)+.001 ) )
> [1] 4 5 5 2 7 3 2 1 6
>
>
>
> —
> David Winsemius
> Alameda, CA, USA
>
​

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] R units of margins, text and points in a figure

2015-11-10 Thread Gygli, Gudrun
Dear R-help,


I am trying to plot some data in a plot where I leave a big margin free to add 
other information, namely text and points.

I am now struggling with keeping the size of the margin, text and points in a 
fixed ratio. I want this so that the layout of the figure does not change every 
time I plot new data.

I have:

a<-8
counter<-1
spacing<-a/(3*a)
adding<-a/(3*a)
start<-a*(a/3)

alphabet<-c("A","A","A","A","A","A","A","A")
x<-c(1,2,3,4,5,6,7,8)
y<-c(10,20,30,40,50,60,70,80)
png(file="TESTING.png", units="in", width=a, height=a, res=a*100)
par(xpd=NA,mar=c(0,0,0,0),oma=c(0,0,0,(3*a))) #bottom, left,top, right

plot.new()
plot(x,y)
points(pch=20,10, 10, cex=5)
text(10,10, alphabet, cex=5, col="blue")

What I do not understand is why the size of the point and the text is not the 
same and why the margin can be "bigger" than the width of the figure.

BASICALLY, the units of the margins, the points and the text are not the same...

What I need is a way to make the size of the point and text AND the margin 
independent of the data I plot so that the figure always looks the same 
although there is more data in it in some cases (for example 10 or 20 points 
with text in the margin).

This could be done by setting the units of points, text and margin to inches so 
that a is the same for all of them... Or to know the ratio between the 
different units used by R for margin, points and text...

Any ideas on how to solve that?

Please let me know if clarifications are needed!


Gudrun







Gudrun Gygli, MSc

PhD candidate

Wageningen University
Laboratory of Biochemistry
Dreijenlaan 3
6703 HA Wageningen
The Netherlands

Phone  31 317483387
e-mail: gudrun.gy...@wur.nl

- - - - - - - - - - - - - - - - - -

Project information: 
http://www.wageningenur.nl/en/show/Bioinformatics-structural-biology-and-molecular-modeling-of-Vanillyl-Alcohol-Oxidases-VAOs.htm

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R units of margins, text and points in a figure

2015-11-10 Thread Jim Lemon
Hi Gudrun,
Let's see. First, the "cex" argument means character _expansion_, not an
absolute size. So as the symbols and letters start out different sizes,
that proportional difference remains as they are expanded. The size of text
depends a bit upon the font that is being used. Perhaps if you determine
the expansions necessary to get the "A" the same size as the pch=20 symbol
(I get about two and one half times the expansion for the symbol as for the
letter) you can write this into your code.

Margins are another unit, the number of lines (vertical space required for
a line of text). This is somewhat larger than the actual vertical extent of
the letters as there is a space left between lines. If you change the
device (eg from PNG to PDF) you will probably encounter yet another change
in the apparent size of things. I suggest using the eyeball method to work
out the proportions for the device you want to use and be prepared to
change things if you move to another graphics device.

Jim


On Tue, Nov 10, 2015 at 7:15 PM, Gygli, Gudrun  wrote:

> Dear R-help,
>
>
> I am trying to plot some data in a plot where I leave a big margin free to
> add other information, namely text and points.
>
> I am now struggling with keeping the size of the margin, text and points
> in a fixed ratio. I want this so that the layout of the figure does not
> change every time I plot new data.
>
> I have:
>
> a<-8
> counter<-1
> spacing<-a/(3*a)
> adding<-a/(3*a)
> start<-a*(a/3)
>
> alphabet<-c("A","A","A","A","A","A","A","A")
> x<-c(1,2,3,4,5,6,7,8)
> y<-c(10,20,30,40,50,60,70,80)
> png(file="TESTING.png", units="in", width=a, height=a, res=a*100)
> par(xpd=NA,mar=c(0,0,0,0),oma=c(0,0,0,(3*a))) #bottom, left,top, right
>
> plot.new()
> plot(x,y)
> points(pch=20,10, 10, cex=5)
> text(10,10, alphabet, cex=5, col="blue")
>
> What I do not understand is why the size of the point and the text is not
> the same and why the margin can be "bigger" than the width of the figure.
>
> BASICALLY, the units of the margins, the points and the text are not the
> same...
>
> What I need is a way to make the size of the point and text AND the margin
> independent of the data I plot so that the figure always looks the same
> although there is more data in it in some cases (for example 10 or 20
> points with text in the margin).
>
> This could be done by setting the units of points, text and margin to
> inches so that a is the same for all of them... Or to know the ratio
> between the different units used by R for margin, points and text...
>
> Any ideas on how to solve that?
>
> Please let me know if clarifications are needed!
>
>
> Gudrun
>
>
>
>
>
>
>
> Gudrun Gygli, MSc
>
> PhD candidate
>
> Wageningen University
> Laboratory of Biochemistry
> Dreijenlaan 3
> 6703 HA Wageningen
> The Netherlands
>
> Phone  31 317483387
> e-mail: gudrun.gy...@wur.nl
>
> - - - - - - - - - - - - - - - - - -
>
> Project information:
> http://www.wageningenur.nl/en/show/Bioinformatics-structural-biology-and-molecular-modeling-of-Vanillyl-Alcohol-Oxidases-VAOs.htm
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R-es] función par dentro de bucles, representar gráficas en bucle

2015-11-10 Thread Carlos Ortega
Hola,

Como estás usando el paquete "lattice" la función para parametrizar el área
gráfica no es "par()".
Tienes que hacerlo como se comenta aquí:

http://www.quantumforest.com/2011/10/setting-plots-side-by-side/

Y lo que puedes hacer es llamar a una función "png()", "jpeg()"... para
guardar el gráfico en cada iteración.
Y a la hora de guardar decir que haga un append al fichero existente. Así
tendrás en un único fichero todas las parejas una tras otra.

Por otro lado, porqué no pintas todas juntas vía la función "splom()" de
"lattice".

Saludos,
Carlos Ortega
www.qualiytexcellence.es

El 10 de noviembre de 2015, 10:55, Albert Montolio <
albert.monto...@gmail.com> escribió:

> Hola chic@s,
>
> querría construir mi primera función, y tengo una duda respecto al comando
> par( mfrow =c(3,3)). Primero de todo, tengo una tabla con 10 variables,
> para cada variable, unos 145 datos. Quiero representar para cada variable
> su gráfica de dispersión respecto a las demás. Es decir, coger la primera
> variable y la segunda, y hacer gráfica, coger la primera variable y la
> tercera, y hacer gráfica, y así hasta acabar con la primera variable, y
> coger la segunda, y lo mismo. Coger la segunda variable y la tercera, y
> gráfica, coger la segunda variable y la cuarta, y gráfica. Quiero hacer una
> función con dos whiles, para automatizar el proceso. El problema radica en
> el comando par( mfrow =c(3,3)).
>
> Tal y como lo conozco, se escribirlo, y después colocar dos gráficas, por
> ejemplo
>
> par( mfrow =c(2,1)).
> indexplot bla bla bla
> indexplot bla bla bla.
>
> Pero ahora con el while, no puedo poner "dos" gráficas, sinó que es un
> bucle. Entonces no se si para mi caso tengo que utilizar el comando par y
> adaptarlo un poco, o con el comando par no puedo hacer lo que yo quiero y
> hay otro comando en R que desconzco.
>
> Os adjunto el codigo base que he pensado (tengo que pensar aun los
> argumentos y que resultado poner, porque el resultado seria la
> representación de las gráficas, así que tampoco lo tengo muy claro)
>
> Muchas gracias!
>
>
>
>
>
> //PAC2
> sudo R
> library(Rcmdr)
> setwd("/home/albert/Documentos/UOC/PAC2/R")
> dir()
> wb <- read.table("Dades_PAC1Des96_Des08_PUNTS.csv", header=T, as.is=T,
> sep=",")
> head(wb)
> tail(wb)
>
> genGraphics <- function(arguments){
>
> i=1
> j=2
>
>   while i<=10 {
>
>   while j<=10 {
>
> par( mfrow =c(3,3))??
> xyplot(wb[i] ~ wb[j], type="p", pch=16,
> auto.key=list(border=TRUE),
> par.settings=simpleTheme(pch=16),
> scales=list(x=list(relation='sliced'),
> y=list(relation='sliced')),
> data=comma)
> j=j+1
> }
>   i=i+1
>
>   }
>
> return(resultat)
> }
>
>
> --
>
>
> *Albert Montolio Aguado*
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R-es] función par dentro de bucles, representar gráficas en bucle

2015-11-10 Thread Albert Montolio
Hola chic@s,

querría construir mi primera función, y tengo una duda respecto al comando
par( mfrow =c(3,3)). Primero de todo, tengo una tabla con 10 variables,
para cada variable, unos 145 datos. Quiero representar para cada variable
su gráfica de dispersión respecto a las demás. Es decir, coger la primera
variable y la segunda, y hacer gráfica, coger la primera variable y la
tercera, y hacer gráfica, y así hasta acabar con la primera variable, y
coger la segunda, y lo mismo. Coger la segunda variable y la tercera, y
gráfica, coger la segunda variable y la cuarta, y gráfica. Quiero hacer una
función con dos whiles, para automatizar el proceso. El problema radica en
el comando par( mfrow =c(3,3)).

Tal y como lo conozco, se escribirlo, y después colocar dos gráficas, por
ejemplo

par( mfrow =c(2,1)).
indexplot bla bla bla
indexplot bla bla bla.

Pero ahora con el while, no puedo poner "dos" gráficas, sinó que es un
bucle. Entonces no se si para mi caso tengo que utilizar el comando par y
adaptarlo un poco, o con el comando par no puedo hacer lo que yo quiero y
hay otro comando en R que desconzco.

Os adjunto el codigo base que he pensado (tengo que pensar aun los
argumentos y que resultado poner, porque el resultado seria la
representación de las gráficas, así que tampoco lo tengo muy claro)

Muchas gracias!





//PAC2
sudo R
library(Rcmdr)
setwd("/home/albert/Documentos/UOC/PAC2/R")
dir()
wb <- read.table("Dades_PAC1Des96_Des08_PUNTS.csv", header=T, as.is=T,
sep=",")
head(wb)
tail(wb)

genGraphics <- function(arguments){

i=1
j=2

  while i<=10 {

  while j<=10 {

par( mfrow =c(3,3))??
xyplot(wb[i] ~ wb[j], type="p", pch=16,
auto.key=list(border=TRUE),
par.settings=simpleTheme(pch=16),
scales=list(x=list(relation='sliced'),
y=list(relation='sliced')),
data=comma)
j=j+1
}
  i=i+1

  }

return(resultat)
}


-- 


*Albert Montolio Aguado*
Núm. sèrie,Sèrie 00,Serie01,Serie02,Serie03,Serie04,Serie05,Serie06,Serie07,Serie08,Serie09,Serie10,Serie11,Serie12,Serie13,Serie14,Serie15
desembre-96,1996,0,39669394,41.55,19.2,0.1,2949,10376,21819000,110041,526,1.6,32875,22.4308,40878,15.6559
gener-97,1996.08,0,39673740.1601,41.4902560686,19.3954379283,0.414553485687,2958.49,10593.8832662585,22598455.4362982,110957,591.542776598863,1.79705384383192,32923.4175843921,22.2871,40.9041342345895,15.6674946481208
febrer-97,1996.17,0,39678092.5164,41.4308160785,19.5921162233,0.729545286659,2967.1,10811.0826192475,23365261.369231,112052,654.768442558181,1.98528615013108,32991.0550950275,22.1581,40.9236177932369,15.679643310151
març-97,1996.25,0,39682457.2647,41.3719839707,19.7912752515,1.0454137182,2973.94,11026.9141456973,24106768.295433,113507,713.359887238408,2.1558753813647,33097.132458149,22.0584,40.92979,15.6929
abril-97,1996.33,0,39686840.6013,41.3140636864,19.9941553797,1.36259709561,2978.12,11240.6939323383,24810326.7115387,115500,765,2.29,33260.8696,22,40.9206512252491,15.707109162112
maig-97,1996.42,0,39691248.7223,41.2573591668,20.2019969744,1.68153373415,2978.77,11451.738065901,25463287.1141829,118212,808.360655842956,2.41297250603698,33488.3649237053,21.9842,40.9126260246048,15.719276963072
juny-97,1996.5,0,39695687.8236,41.202174353,20.4160404024,2.00266194913,2975,11659.3626331157,26052999.999,121823,846.069672325457,2.50664154960673,33733.2307399175,22.0097,40.9268,15.72569
juliol-97,1996.58,0,39700164.1014,41.1488131864,20.6375260302,2.32642005582,2965.92,11862.8837207129,26576608.8875085,126495,881.74385264523,2.59698981837312,33935.9578361709,22.0751,40.9745016051544,15.7251612960235
agost-97,1996.67,0,39704683.7517,41.0975796079,20.8676942246,2.65324636951,2950.65,12061.6174154229,27070429.3827628,132328,919,2.7,34037037,22.1796,41.0280707009362,15.7263895783013
setembre-97,1996.75,0,39709252.9706,41.0487775589,21.1077853521,2.98357920549,2928.31,12254.8798039762,27580570.1137009,139404,960.733350029313,2.82761863202014,33998.8601676615,22.3222,41.0501,15.7406
octubre-97,1996.83,0,39713877.9543,41.0027109805,21.3590397794,3.31785687904,2898.01,12441.9869731032,28153139.708261,147805,1006.95286813999,2.97564765144196,33871.4238703025,22.4878,41.0167942059847,15.7750419500902
novembre-97,1996.92,0,39718564.8987,40.9596838138,21.6226978732,3.65651770545,2858.87,12622.2550095343,28834246.7943813,157614,1056.94595218067,3.1358528451428,33726.6257877921,22.6044,40.9588059864651,15.8211017607596
desembre-97,1997,0.48,39723320,40.92,21.9,4,2810,12795,2967,168913,1110,3.29,33636.3636,22.5857,40.92039,15.86619
gener-98,1997.08,1.28454014431,39728186.8953,40.8839083818,22.1914669933,4.34865098492,2750.99,12959.7531945001,30689030.3099638,181650,1165.76844403979,3.46249046588245,33653.6501837734,22.3867,40.9315252746103,15.9012005332452

[R-es] Fwd: Profesor Lenguaje de programación R

2015-11-10 Thread Francisco Rodriguez Sanchez

Buenos días,

Están buscando un profesor para un curso de estadística con R a celebrar 
en Madrid y Barcelona (info abajo). Los interesados por favor que se 
pongan en contacto con José Manuel Pérez 
(jm.pe...@chipsandgeraniums.com), no conmigo.


Gracias

Paco

Objetivos

El curso pretende dar una base de conocimientos de probabilidad y 
estadística más puros, para poderlos aplicar de manera eficiente en el 
análisis de bases de datos, de modo que los alumnos acaben el mismo con 
la capacidad de extraer información de las mismas, demás de hacer 
predicciones e inferencias, concluyendo resultados útiles para tomar 
decisiones en la gestión.


El curso tendrá una fuerte orientación hacia el aprendizaje y manejo del 
lenguaje de programación R, se aprenderá a desarrollar el trabajo 
estadístico en la aplicación libre Rstudio.


El contenido del curso será a su vez adaptado a las necesidades 
planteadas por los alumnos una vez se hayan dado los conceptos 
centrales, constando claramente de una sección más teórica y otra 
fuertemente aplicada.


Contenido

1.

   Teoría de conjuntos y cálculo de probabilidades.

2.

   Estadística: variables aleatorias discretas y contínuas fundamentales.

3.

   La variable aleatoria normal.

4.

   Regresión.

5.

   Inferencia estadística, series temporales, predicción.

6.

   El lenguaje de programación R y Rstudio.


--

Un saludo, José Manuel.



Chips & Geraniums Group 



José Manuel Pérez Rubio
SOCIO DIRECTOR
jm.pe...@chipsandgeraniums.com 
Tel. 677 78 31 24

Chips & Geraniums Group
C/ Leonardo da Vinci nº 18
41092 Sevilla
www.chipsandgeraniums.com 


De conformidad con la Ley Orgánica 15/1.999, de 13 de Diciembre, de 
Protección de Datos de Carácter Personal, le comunicamos que sus datos 
de contacto, facilitados por usted o por la entidad en la que presta 
servicios, son incorporados en ficheros de titularidad de CHIPS AND 
GERANIUMS S.L., con la finalidad de servir de directorio de contactos, 
así como para facilitar la gestión administrativa y comercial 
desarrollada por la empresa. Asimismo, sus datos serán cedidos en todos 
aquellos casos en que sea necesario para el desarrollo, cumplimiento y 
control de la relación con nuestra entidad o en los supuesto que lo 
autorice una norma con rango de ley.


En todo caso, puede usted ejercer los derechos de acceso, rectificación, 
cancelación y oposición, recogidos en la Ley Orgánica 15/1.999 ante 
CHIPS AND GERANIUMS S.L., con dirección en Avda. Leonardo Da Vinci 18, 
CP 41092 Sevilla (Sevilla), adjuntando fotocopia de su DNI.


El contenido de esta comunicación, así como el de toda la documentación 
anexa, está sujeta al debar de secreto y va dirigida únicamente a su 
destinatario. En el supuesto de que usted no fuera el destinatario, le 
solicitamos que nos lo indique y no comunique su contenido a terceros, 
procediendo a su destrucción.


Antes de imprimir este correo electrónico piense bien si es necesario 
hacerlo. Preservar el medio ambiente es cosa de todos.







--
Dr Francisco Rodriguez-Sanchez
Integrative Ecology Group
Estacion Biologica de Doñana - CSIC
Avda. Americo Vespucio s/n
41092 Sevilla (Spain)
http://bit.ly/frod_san

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

[R] Identifying attributes of specific foreach task on error.

2015-11-10 Thread nevil amos
I am running foreach to reclassify a large number of rasters.

I am getting the Error in { : task 1359 failed - "cannot open the
connection"

How do I get the attributes ( in this case files being read and written)
for that specific task?


It runs fine until that point presumably there is a problem with the input
or output file name, but I cannot determine which file it refers to.

cheers

Nevil Amos

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] conditionally disable evaluation of chunks in Rmarkdown...

2015-11-10 Thread Witold E Wolski
I do have an Rmd where I would like to conditionally evaluate the second part.

So far I am working with :

```{r}
if(length(specLibrary@ionlibrary) ==0){
  library(knitr)
  opts_chunk$set(eval=FALSE, message=FALSE, echo=FALSE)
}
```

Which disables the evaluation of subsequent chunks.

However my RMD file contains also these kind of snippets : `r `

How do I disable them?

regards



-- 
Witold Eryk Wolski

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] conditionally disable evaluation of chunks in Rmarkdown...

2015-11-10 Thread Bert Gunter
Strictly speaking, wrong email list.

Markdown is R Studio software, and you should post on their support site.

Cheers,
Bert


Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Tue, Nov 10, 2015 at 2:40 AM, Witold E Wolski  wrote:
> I do have an Rmd where I would like to conditionally evaluate the second part.
>
> So far I am working with :
>
> ```{r}
> if(length(specLibrary@ionlibrary) ==0){
>   library(knitr)
>   opts_chunk$set(eval=FALSE, message=FALSE, echo=FALSE)
> }
> ```
>
> Which disables the evaluation of subsequent chunks.
>
> However my RMD file contains also these kind of snippets : `r `
>
> How do I disable them?
>
> regards
>
>
>
> --
> Witold Eryk Wolski
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R-es] función par dentro de bucles, representar gráficas en bucle

2015-11-10 Thread Albert Montolio
Al final me he decidido por la libreria (lattice), aunque las dos son
parecidas.

He implementado este trozo de código:

*-
//PAC2
sudo R
library(Rcmdr)
library(lattice)
data(mtcars)

setwd("/home/albert/Documentos/UOC/PAC2/R")
dir()

wb <- read.table("Dades_PAC1Des96_Des08_PUNTS.csv", header=T, as.is=T,
sep=",")
head(wb)
tail(wb)

i=1
j=2
t=1

while i<=10 {

  while j<=10 {
p[i,t] = xyplot(wb[i] ~ wb[j], type="p", pch=16,
auto.key=list(border=TRUE),
par.settings=simpleTheme(pch=16),
scales=list(x=list(relation='sliced'),
y=list(relation='sliced')),
data=comma)
j=j+1
t=t+1
  }
  i=i+1
}

print(p[1,1], position = c(0, 0, 0.5, 1), more = TRUE)
print(p[1,2] position = c(0.5, 0, 1, 1))
print(p[2,3], position = c(0.5, 0, 1, 1))
*-

He ido guardando las gráficas en una tabla p. Como puedo llamar a los
componentes de la tabla? si pongo p[1,1] o lo que sea no me hace nada.



El 10 de noviembre de 2015, 12:36, Reverté Calvet, Gerard <
greve...@ajmataro.cat> escribió:

> Puedes usar la función pairs(datos), o también ggpairs (datos) del paquete
> GGally. Más fácil y rápido.
>
>
>
>
>
> Gerard Reverté
>
>
>
> *De:* R-help-es [mailto:r-help-es-boun...@r-project.org] *En nombre de *Albert
> Montolio
> *Enviado el:* martes, 10 de noviembre de 2015 10:55
> *Para:* R-help-es@r-project.org
> *Asunto:* [R-es] función par dentro de bucles, representar gráficas en
> bucle
>
>
>
> Hola chic@s,
>
> querría construir mi primera función, y tengo una duda respecto al comando
> par( mfrow =c(3,3)). Primero de todo, tengo una tabla con 10 variables,
> para cada variable, unos 145 datos. Quiero representar para cada variable
> su gráfica de dispersión respecto a las demás. Es decir, coger la primera
> variable y la segunda, y hacer gráfica, coger la primera variable y la
> tercera, y hacer gráfica, y así hasta acabar con la primera variable, y
> coger la segunda, y lo mismo. Coger la segunda variable y la tercera, y
> gráfica, coger la segunda variable y la cuarta, y gráfica. Quiero hacer una
> función con dos whiles, para automatizar el proceso. El problema radica en
> el comando par( mfrow =c(3,3)).
>
> Tal y como lo conozco, se escribirlo, y después colocar dos gráficas, por
> ejemplo
>
> par( mfrow =c(2,1)).
>
> indexplot bla bla bla
>
> indexplot bla bla bla.
>
> Pero ahora con el while, no puedo poner "dos" gráficas, sinó que es un
> bucle. Entonces no se si para mi caso tengo que utilizar el comando par y
> adaptarlo un poco, o con el comando par no puedo hacer lo que yo quiero y
> hay otro comando en R que desconzco.
>
> Os adjunto el codigo base que he pensado (tengo que pensar aun los
> argumentos y que resultado poner, porque el resultado seria la
> representación de las gráficas, así que tampoco lo tengo muy claro)
>
> Muchas gracias!
>
>
>
>
>
>
> //PAC2
> sudo R
> library(Rcmdr)
> setwd("/home/albert/Documentos/UOC/PAC2/R")
> dir()
> wb <- read.table("Dades_PAC1Des96_Des08_PUNTS.csv", header=T, as.is=T,
> sep=",")
> head(wb)
> tail(wb)
>
> genGraphics <- function(arguments){
>
> i=1
> j=2
>
>   while i<=10 {
>
>   while j<=10 {
>
> par( mfrow =c(3,3))??
> xyplot(wb[i] ~ wb[j], type="p", pch=16,
> auto.key=list(border=TRUE),
> par.settings=simpleTheme(pch=16),
> scales=list(x=list(relation='sliced'),
> y=list(relation='sliced')),
> data=comma)
> j=j+1
> }
>   i=i+1
>
>   }
>
> return(resultat)
> }
>
>
> --
>
>
>
>
>
> *Albert Montolio Aguado*
>
>
>
> *Avís legal/Aviso legal*
> La present informació s'envia únicament a la persona a la que va dirigida
> i pot contenir informació privilegiada o de caràcter confidencial.
> Qualsevol modificació, retransmissió, difusió o altre ús d'aquesta
> informació per persones o entitats diferents a la persona a la que va
> dirigida està prohibida. Si vostè l'ha rebut per error, si us plau contacti
> amb el remitent i esborri el missatge de qualsevol ordinador. En el cas que
> aquest missatge vagi a ser contestat per la mateixa via, ha de saber-se que
> la seva resposta podria ser coneguda per tercers a l'entrar a la xarxa. Per
> això, si el missatge inclou contrasenyes, números de targetes de crèdit o
> qualsevol altra informació que vostè consideri confidencial, seria més
> segur contestar per una altra via i cancel·lar la seva transmissió.
> L'Ajuntament de Mataró i els seus organismes dependents no poden assumir la
> responsabilitat derivada del fet de què terceres persones puguin arribar 

Re: [R] no results

2015-11-10 Thread Johannes Huesing

Alaa Sindi  [Tue, Nov 10, 2015 at 08:47:23PM CET]:

Hi All,

I am not getting any summary results and I do not have any error. what would be 
the problem?







sem=mlogit.optim ( LL  , Start, method = 'nr', iterlim = 2000, tol = 1E-05, 
ftol = 1e-08, steptol = 1e-10, print.level = 0)


I see some expressions which are undefined. For instance mlogit.optim, LL, Start. 


This causes the code not to run on my machine.


R.Version()

$platform
[1] "i686-pc-linux-gnu"

$arch
[1] "i686"

$os
[1] "linux-gnu"

$system
[1] "i686, linux-gnu"

$status
[1] ""

$major
[1] "3"

$minor
[1] "0.2"

$year
[1] "2013"

$month
[1] "09"

$day
[1] "25"

$`svn rev`
[1] "63987"

$language
[1] "R"

$version.string
[1] "R version 3.0.2 (2013-09-25)"

$nickname
[1] "Frisbee Sailing"
--
Johannes Hüsing   
http://derwisch.wikidot.com

Threema-ID: VHVJYH3H

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.