[R] Fwd: ERROR - non-conformable arguments

2015-09-20 Thread Alexander Moßbrucker
Hi,

I am using adehabitatHS for habitat selection analysis using widesII(), when
running the script I get the error message: Error in as.vector(X) %*%
t(as.vector(Y)) : non-conformable arguments

Here the script I am using including the data

> #dataset (read from tab deliminated text file)
>
> available
  Riparian Conifer MtShrub1 Aspen RockOutcrop Bitterbrush Windblown MtShrub2
PresBurn
1 0.060.13 0.16  0.150.060.17  0.12 0.04
0.09
  Clearcut
1 0.02
> used
 Riparian Conifer MtShrub1 Aspen RockOutcrop Bitterbrush Windblown
MtShrub2 PresBurn
Ani10   00 2   0  16 5
14   28
Ani20   21 2   2   510
10   35
Ani30   12 1   0  14 9
8   40
Ani40   13 7   5   3 6
9   31
Ani50   02 2   5  1810
6   25
Ani60   21 4   2   7 6
15   19
 Clearcut
Ani18
Ani29
Ani34
Ani49
Ani50
Ani6   19
>
> #analysis
>
> widesII(used, available, avknown = TRUE, alpha = 0.05)
Error in as.vector(X) %*% t(as.vector(Y)) : non-conformable arguments

Note: I am using an example dataset to test out a script I want to use to
analyse my own dataset, for this I exported the example dataset to excel,
converted it to tab deliminated text file, then imported it.

All worked well when using the example dataset provided by adehabitatHS,
thus I suspect that somhow my test dataset is not correctly read in or
something similar.

I am quite new to R, thus apologize for any shortcomings in reporting etc..

Many thanks, best, Alex



--
View this message in context:
http://r.789695.n4.nabble.com/ERROR-non-conformable-arguments-tp4712516.html
Sent from the R help mailing list archive at Nabble.com.

[[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] How to coerce a parameter in nls?

2015-09-20 Thread Jianling Fan
no, I am doing a regression with 6 group data with 2 shared parameters
and 1 different parameter for each group data. the parameter I want to
coerce is for one group. I don't know how to do it. Any suggestion?

Thanks!

On 19 September 2015 at 13:33, Jeff Newmiller  wrote:
> Why not rewrite the function so that value is not a parameter?
> ---
> 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 September 18, 2015 9:54:54 PM PDT, Jianling Fan  
> wrote:
>>Hello, everyone,
>>
>>I am using a nls regression with 6 groups data. I am trying to coerce
>>a parameter to 1 by using a upper and lower statement. but I always
>>get an error like below:
>>
>>Error in ifelse(internalPars < upper, 1, -1) :
>>  (list) object cannot be coerced to type 'double'
>>
>>does anyone know how to fix it?
>>
>>thanks in advance!
>>
>>My code is below:
>>
>>
>>
>>> dproot
>>   depth   den ref
>>1 20 0.573   1
>>2 40 0.780   1
>>3 60 0.947   1
>>4 80 0.990   1
>>5100 1.000   1
>>6 10 0.600   2
>>7 20 0.820   2
>>8 30 0.930   2
>>9 40 1.000   2
>>1020 0.480   3
>>1140 0.734   3
>>1260 0.961   3
>>1380 0.998   3
>>14   100 1.000   3
>>1520 3.2083491   4
>>1640 4.9683383   4
>>1760 6.2381133   4
>>1880 6.5322348   4
>>19   100 6.5780660   4
>>20   120 6.6032064   4
>>2120 0.614   5
>>2240 0.827   5
>>2360 0.950   5
>>2480 0.995   5
>>25   100 1.000   5
>>2620 0.4345774   6
>>2740 0.6654726   6
>>2860 0.8480684   6
>>2980 0.9268951   6
>>30   100 0.9723207   6
>>31   120 0.9939966   6
>>32   140 0.9992400   6
>>
>>> fitdp<-nls(den~Rm[ref]/(1+(depth/d50)^c),data=dproot,
>>+ start = list(Rm=c(1.01, 1.01, 1.01, 6.65,1.01,1), d50=20, c=-1))
>>> summary(fitdp)
>>
>>Formula: den ~ Rm[ref]/(1 + (depth/d50)^c)
>>
>>Parameters:
>>Estimate Std. Error t value Pr(>|t|)
>>Rm1  1.125600.07156   15.73 3.84e-14 ***
>>Rm2  1.576430.11722   13.45 1.14e-12 ***
>>Rm3  1.106970.07130   15.53 5.11e-14 ***
>>Rm4  7.239250.20788   34.83  < 2e-16 ***
>>Rm5  1.145160.07184   15.94 2.87e-14 ***
>>Rm6  1.036580.05664   18.30 1.33e-15 ***
>>d50 22.694261.03855   21.85  < 2e-16 ***
>>c   -1.597960.15589  -10.25 3.02e-10 ***
>>---
>>Signif. codes:  0 ?**?0.001 ?*?0.01 ??0.05 ??0.1 ??1
>>
>>Residual standard error: 0.1094 on 24 degrees of freedom
>>
>>Number of iterations to convergence: 8
>>Achieved convergence tolerance: 9.374e-06
>>
>>> fitdp1<-nls(den~Rm[ref]/(1+(depth/d50)^c),data=dproot,
>>algorithm="port",
>>+ start = list(Rm=c(1.01, 1.01, 1.01, 6.65, 1.01, 1), d50=20, c=-1),
>>+ lower = list(Rm=c(1.01, 1.01, 1.01, 6.65, 1.01, 1), d50=20, c=-1),
>>+ upper = list(Rm=c(2.1, 2.2, 2.12, 12.5, 2.3, 1), d50=50, c=1))
>>
>>Error in ifelse(internalPars < upper, 1, -1) :
>>  (list) object cannot be coerced to type 'double'
>>
>>__
>>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.
>



-- 
Jianling Fan
樊建凌

__
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] Fwd: ERROR - non-conformable arguments

2015-09-20 Thread Jeff Newmiller
To debug this kind of problem you really need to use dput() to provide the data 
in your email. [1]

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---
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 September 20, 2015 12:03:54 AM PDT, "Alexander Moßbrucker" 
 wrote:
>Hi,
>
>I am using adehabitatHS for habitat selection analysis using widesII(),
>when
>running the script I get the error message: Error in as.vector(X) %*%
>t(as.vector(Y)) : non-conformable arguments
>
>Here the script I am using including the data
>
>> #dataset (read from tab deliminated text file)
>>
>> available
>Riparian Conifer MtShrub1 Aspen RockOutcrop Bitterbrush Windblown
>MtShrub2
>PresBurn
>1 0.060.13 0.16  0.150.060.17  0.12
>0.04
>0.09
>  Clearcut
>1 0.02
>> used
> Riparian Conifer MtShrub1 Aspen RockOutcrop Bitterbrush Windblown
>MtShrub2 PresBurn
>Ani10   00 2   0  16 5
>14   28
>Ani20   21 2   2   510
>10   35
>Ani30   12 1   0  14 9
>8   40
>Ani40   13 7   5   3 6
>9   31
>Ani50   02 2   5  1810
>6   25
>Ani60   21 4   2   7 6
>15   19
> Clearcut
>Ani18
>Ani29
>Ani34
>Ani49
>Ani50
>Ani6   19
>>
>> #analysis
>>
>> widesII(used, available, avknown = TRUE, alpha = 0.05)
>Error in as.vector(X) %*% t(as.vector(Y)) : non-conformable arguments
>
>Note: I am using an example dataset to test out a script I want to use
>to
>analyse my own dataset, for this I exported the example dataset to
>excel,
>converted it to tab deliminated text file, then imported it.
>
>All worked well when using the example dataset provided by
>adehabitatHS,
>thus I suspect that somhow my test dataset is not correctly read in or
>something similar.
>
>I am quite new to R, thus apologize for any shortcomings in reporting
>etc..
>
>Many thanks, best, Alex
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/ERROR-non-conformable-arguments-tp4712516.html
>Sent from the R help mailing list archive at Nabble.com.
>
>   [[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-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] what is the effective method to apply the below logic for ~1.2 million records in R

2015-09-20 Thread Ista Zahn
Hi Ravi,

Did you try fixing the problem? What did you try and what went wrong?

The answer is probably

A <- as.data.table(A)
A[ , g15 := cumsum(ifelse(is.na(Time_Diff > 12), 0, Time_Diff > 12))]
A[ , flag_1 := 1:.N, by = c("customer", "g15")]
A[ , g15 := NULL]

but you would have learned more if you had at least tried getting
there yourself.

Best,
Ista

On Sun, Sep 20, 2015 at 6:19 AM, Ravi Teja  wrote:
> Hi Ista.
>
> Thanks a ton for the response and your assumptions were right.
>
> f the Time_Diff is missing then flag_1 value should be 1
> if the Time_Diff is > 12 then flag_1 value should be 1
> if the Time_Diff is < 12 the flag_1 value should be (if the current row is i
> then flag_1 value should be (flag_1[i-1] + 1) )
>
> When I tried to apply the logic you had shared, the results are deviating
> from the expected results.
>
> I think the logic you had shared will not function if there are two
> successive rows with Time_Diff values > 12
>
> I have attached a sample of my original data set and the expected flag_1
> column to this mail.
>
> Please help in tweaking your code to generate the attached result.
>
> Awaiting for your reply
>
> Thanks,
> Ravi
>
> On Sun, Sep 20, 2015 at 8:18 AM, Ista Zahn  wrote:
>>
>> This assumes that the data are sorted by customer, and that only the
>> first value of Time_Diff is missing for each customer (and that the
>> first value is always missing for each customer). If those assumptions
>> hold you can do something like
>>
>> A <- read.table(text = "customer   Time_Diffflag_1
>> 1   NA   1
>> 1   10   2
>> 18   3
>> 1   15   1
>> 19   2
>> 1   10   3
>> 2   NA   1
>> 22   2
>> 25   3",
>> header = TRUE)
>>
>> A$flag_1 <- NULL
>>
>> library(data.table)
>>
>> A <- as.data.table(A)
>> A[ , g15 := cumsum(c(0, ifelse(is.na(diff(Time_Diff > 12)), 0,
>> diff(Time_Diff > 12) > 0)))]
>> ## I'm not proud of the previous line, probably there is a cleaner way
>> A[ , flag_1 := 1:.N, by = c("customer", "g15")]
>> A[ , g15 := NULL]
>>
>> Best,
>> Ista
>>
>> On Sat, Sep 19, 2015 at 5:09 PM, Ravi Teja  wrote:
>> > Hi,
>> >
>> > I am trying to apply the below logic to generate flag_1 column on a data
>> > set consisting of ~1.2 million records in R.
>> >
>> > Code :
>> >
>> > for(i in 1: nrows)
>> >   {
>> >   if(A$customer[i]==A$customer[i+1])
>> > {
>> >
>> >   if(is.na(A$Time_Diff[i]))
>> >  A$flag_1[i] <- 1
>> >  else if (A$Time_Diff[i] > 12)
>> >  A$flag_1[i] <- 1
>> >  else
>> >  A$flag_1[i] <- A$flag_1[i-1]+1
>> >
>> >}
>> >
>> > else
>> > {
>> >
>> >   if(is.na(A$Time_Diff[i]))
>> >  A$flag_1[i] <- 1
>> >  else if (A$Time_Diff[i] > 12)
>> >  A$flag_1[i] <- 1
>> >  else
>> >  A$flag_1[i] <- A$flag_1[i-1]+1
>> >
>> >}
>> > }
>> >
>> >
>> > Resultant dataset should look like
>> >
>> > Customer   Time_diffflag_1
>> > 1   NA   1
>> > 1   10 2
>> > 18  3
>> > 1151
>> > 19   2
>> > 110  3
>> > 2 NA1
>> > 2  2   2
>> > 2  5   3
>> >
>> > The above logic will take approximately 60 hours to generate the flag_1
>> > column on a dataset consisting of ~1.2 million records. Is there any
>> > effective way in R to implement this logic in R ?
>> >
>> > Appreciate your help.
>> >
>> > Thanks,
>> > Ravi
>> >
>> > [[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.
>
>
>
>
> --
> raviteja

__
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] Problemas con rmarkdown

2015-09-20 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal?

Yo creo que el problema no está en R. Aparentemente, ya has generado el
fichero .md que pandoc "traduce" a pdf.

¿Puedes ver el fichero .md correctamente? ¿Lo has generado a partir de un
Rmd? ¿Puedes generar el pdf directamente desde RStudio a partir del Rmd (si
es que lo hay)?

Un saludo,

Carlos J. Gil Bellosta
http://www.datanalytics.com

El 19 de septiembre de 2015, 22:41, Conney Marulanda 
escribió:

> Buenas noches,
> Escribo este mail porque tengo un problema con rmarkdown, estoy creando un
> informe y me iba bien al generarlo como pdf, de repente me sale el
> siguiente error y no sé como solucionarlo:
> pandoc.exe: Error producing PDF from TeX sourceError: pandoc document
> conversion failed with error 43Además: Warning message:comando ejecutado
> '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS
> Evolución_de_los_Mercados_.utf8.md --to latex --from
> markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures
> --output Evolución_de_los_Mercados_.pdf --template
> "C:\Users\CONNY\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex"
> --highlight-style tango --latex-engine pdflatex --variable
> "geometry:margin=1in"' tiene estatus 43 Ejecución interrumpida
> Asimismo, si lo quiero generar como html sería para publicarlo en mi sitio
> web, le dí en la opción publicar y salió que requería instalar ciertos
> paquetes...pero luego me salió el siguiente error:
> "Error occurred while executing method"
> Agradezco su colaboración, pues la idea de mi informe es publicarlo en mi
> sitio web ya sea como pdf o directamente en formato html.
> Muchas gracias!
> Conney Paola Marulanda López
> Profesional en Finanzas y Relaciones Internacionales
> www.finanzaszone.com
>
>
>
>
>
> [[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] Unexpected/undocumented behavior of 'within': dropping variable names that start with '.'

2015-09-20 Thread Brian
Dear List,

Somewhere I missed something, and now I'm really missing something!
 
> d.f <- data.frame(.id = c(TRUE, FALSE, TRUE), dummy = c(1, 2, 3), a =
c(1, 2, 3), b = c(1, 2, 3) + 1)
 > within(d.f, {d = a + b})
   dummy a b d
 1 1 1 2 3
 2 2 2 3 5
 3 3 3 4 7
 > d.f <- data.frame(.id = c(TRUE, FALSE, TRUE), .dummy = c(1, 2, 3), a
= c(1, 2, 3), b = c(1, 2, 3) + 1)
 > within(d.f, {d = a + b})
   a b d
 1 1 2 3
 2 2 3 5
 3 3 4 7

Could somebody please explain to me why this does this? I think could be
considered a feature (for lots of calculations within a data frame you
don't have to remove all extra variables at the end).  I just wish it
was documented.

Cheers,
Brian


sessionInfo()
 R version 3.1.0 (2014-04-10)
 Platform: x86_64-pc-linux-gnu (64-bit)

 locale:
  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
  [9] LC_ADDRESS=C   LC_TELEPHONE=C
 [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

 attached base packages:
 [1] splines   grid  stats graphics  grDevices utils datasets
 [8] methods   base

 other attached packages:
  [1] scales_0.2.4   plyr_1.8.3 reshape2_1.4  
ccchDataProc_0.7
  [5] ccchTools_0.6  xtable_1.7-4   tables_0.7.79  Hmisc_3.14-5
  [9] Formula_1.1-2  survival_2.37-7ggplot2_1.0.1 
IDPmisc_1.1.17
 [13] lattice_0.20-29myRplots_1.1   myRtools_1.2   meteoconv_0.1
 [17] pixmap_0.4-11  RColorBrewer_1.0-5 maptools_0.8-30sp_1.1-1
 [21] mapdata_2.2-3  mapproj_1.2-2  maps_2.3-9 chron_2.3-45
 [25] MASS_7.3-35

 loaded via a namespace (and not attached):
  [1] acepack_1.3-3.3 cluster_1.15.2  colorspace_1.2-4
  [4] compiler_3.1.0  data.table_1.9.4digest_0.6.4
  [7] foreign_0.8-61  gtable_0.1.2labeling_0.3
 [10] latticeExtra_0.6-26 munsell_0.4.2   nnet_7.3-8
 [13] proto_0.3-10Rcpp_0.12.0 rpart_4.1-8
 [16] stringr_0.6.2   tools_3.1.0
 > within
 function (data, expr, ...)
 UseMethod("within")
 
 

__
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] HELP IN GRAPHS - slip screen (URGENT)

2015-09-20 Thread Rosa Oliveira
Dear Jim,


I’ve tried till today, but I could not solve the problems.

1. despite the scales are the same (equal: lambda ={0.70, 0.75, 0.80, 0.85, 
0.90, 0.95, 0.98}), the "matrix" is not equal. If you see, for n = 250 the 
column is narrower than for n = 1000, and "lambda" has the same values.

2. the first 2 columns relate to alpha 1 and the second two columns alpha2. Is 
it possible to place a title above nsample that concerns the first 2 columns 
and other over the last 2?

something like:

alpha1  
   alpha2
nsample=250  nsample=1000   nsample=250  nsample=1000


3. Notice that have 4 separate drawings and must place the 4 "groups" together.

Can you help?

It's really important.

Best,
RO





library(ggplot2)
library(reshape)
library(lattice)


# read in what looks like half of the data

bias.alpha2<-read.csv("graphs_bias_alpha2.csv")
SE.alpha2<-read.csv("graphs_SE_alpha2.csv")
bias.alpha1<-read.csv("graphs_bias_alpha1.csv")
SE.alpha1<-read.csv("graphs_SE_alpha1.csv")



quartz(width=10,height=6)

# do the first split, to get the rightmost screen for the legend
split.screen(figs=matrix(c(0,0.84,0,1,0.84,1,0,1),nrow=2,byrow=TRUE))
# now split the first screen to get your eight screens (numbered 3 to 10) for 
the plots
split.screen(figs=matrix(c(0,0.25,0.5,1,
   0.25,0.5,0.5,1,
   0.5,0.75,0.5,1,
   0.75,1,0.5,1,
   0,0.25,0,0.5,
   0.25,0.5,0,0.5,
   0.5,0.75,0,0.5,
   0.75,1,0,0.5),
 ncol=4,byrow=TRUE),screen=1)



#split.screen(figs=matrix(c(0,0.5,0.5,1,#primeira linha primeira coluna
#   0.5,1,0.5,1,#primeira linha segunda coluna
#   0,0.5,0,0.5,#segunda linha primeira coluna
#   0.5,1,0,0.5),#segunda linha segunda coluna
# ncol=4,byrow=TRUE),screen=1)


# this produces seven screens numbered like this:
#   3   4   5   6 
#2
#   7   8   9   10 
# select the upper left screen



screen(3)
par(mar=c(0,3.5,3,0))
# now the second set
n250<-bias.alpha1$nsample==250
matplot(x=bias.alpha1$lambda[n250],y=bias.alpha1[n250,3:5],
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(-.1, 
.6),main="nsample=250",ylab="", cex.main=1)
abline(h = 0, col = "gray60")
mtext(expression(paste("Bias av. for  ",alpha[1])),side=2,line=2, cex.main=1)

screen(4)
par(mar=c(0,0,3,0))
# now the second set
n1000<-bias.alpha1$nsample==1000
matplot(x=bias.alpha1$lambda[n1000],y=bias.alpha1[n1000,3:5],
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1, 
.6),main="nsample=1000",ylab="")
abline(h = 0, col = "gray60")



screen(5)
par(mar=c(0,3.5,3,0))
# now the second set
par(mar=c(3,3.5,0,0))
# now the second set
n250<-bias.alpha2$nsample==250
matplot(x=bias.alpha2$lambda[n250],y=bias.alpha2[n250,3:5],
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1, 
.6),main="nsample=250",ylab="")
abline(h = 0, col = "gray60")


screen(6)
par(mar=c(3,0,0,0))
# now the second set
n1000<-bias.alpha2$nsample==1000
matplot(x=bias.alpha2$lambda[n1000],y=bias.alpha2[n1000,3:5],
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1, 
.6),main="nsample=1000",ylab="")
abline(h = 0, col = "gray60")




screen(7)
par(mar=c(0,3.5,3,0))
# now the second set
n250<-SE.alpha1$nsample==250
matplot(x=SE.alpha1$lambda[n250],y=SE.alpha1[n250,3:5],
type="l",pch=1:3,col=c(4,2,3),ylim=c(0, 
1.1),main="nsample=250",ylab="", cex.main=1)
abline(h = -1, col = "gray60")
mtext(expression(paste("SE av. for  ",alpha[1])),side=2,line=2, cex.main=1)
mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)


screen(8)
par(mar=c(0,0,3,0))
# now the second set
n1000<-SE.alpha1$nsample==1000
matplot(x=SE.alpha1$lambda[n1000],y=SE.alpha1[n1000,3:5],
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0, 
1.1),main="nsample=1000",ylab="")
abline(h = -1, col = "gray60")




screen(9)
par(mar=c(3,3.5,0,0))
# now the second set
n250<-SE.alpha2$nsample==250
matplot(x=SE.alpha2$lambda[n250],y=SE.alpha2[n250,3:5],
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0, 1.1),ylab="")
abline(h = -.5, col = "gray60")
mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)


screen(10)
par(mar=c(3,0,0,0))
# now the second set
n1000<-SE.alpha2$nsample==1000
matplot(x=SE.alpha2$lambda[n1000],y=SE.alpha2[n1000,3:5],
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0, 1.1),ylab="")
abline(h = -1, col = "gray60")
mtext(expression(paste(lambda)),side=1,line=2, , cex.main=1.5)



screen(2)
par(mar=c(0,0,0,0))
# plot an empty plot to get the coordinates
plot(0:1,0:1,type="n",axes=FALSE)
legend(0,0.6,c("OLS", "GLS", "Reg. Cal.", "0"),bty = "n", 
lty=1:3,col=c(4,2,3,"gray60"),xpd=TRUE)


close.screen(all=TRUE)



Atenciosamente,

Re: [R] Unexpected/undocumented behavior of 'within': dropping variable names that start with '.'

2015-09-20 Thread Hadley Wickham
The problem is that within.data.frame calls as.list.environment with
the default value of all.names = FALSE. I doubt this is a deliberate
feature, and is more likely to be a minor oversight.

Hadley

On Sun, Sep 20, 2015 at 11:49 AM, Brian  wrote:
> Dear List,
>
> Somewhere I missed something, and now I'm really missing something!
>
>> d.f <- data.frame(.id = c(TRUE, FALSE, TRUE), dummy = c(1, 2, 3), a =
> c(1, 2, 3), b = c(1, 2, 3) + 1)
>  > within(d.f, {d = a + b})
>dummy a b d
>  1 1 1 2 3
>  2 2 2 3 5
>  3 3 3 4 7
>  > d.f <- data.frame(.id = c(TRUE, FALSE, TRUE), .dummy = c(1, 2, 3), a
> = c(1, 2, 3), b = c(1, 2, 3) + 1)
>  > within(d.f, {d = a + b})
>a b d
>  1 1 2 3
>  2 2 3 5
>  3 3 4 7
>
> Could somebody please explain to me why this does this? I think could be
> considered a feature (for lots of calculations within a data frame you
> don't have to remove all extra variables at the end).  I just wish it
> was documented.
>
> Cheers,
> Brian
>
>
> sessionInfo()
>  R version 3.1.0 (2014-04-10)
>  Platform: x86_64-pc-linux-gnu (64-bit)
>
>  locale:
>   [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>   [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
>   [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
>   [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
>   [9] LC_ADDRESS=C   LC_TELEPHONE=C
>  [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
>  attached base packages:
>  [1] splines   grid  stats graphics  grDevices utils datasets
>  [8] methods   base
>
>  other attached packages:
>   [1] scales_0.2.4   plyr_1.8.3 reshape2_1.4
> ccchDataProc_0.7
>   [5] ccchTools_0.6  xtable_1.7-4   tables_0.7.79  Hmisc_3.14-5
>   [9] Formula_1.1-2  survival_2.37-7ggplot2_1.0.1
> IDPmisc_1.1.17
>  [13] lattice_0.20-29myRplots_1.1   myRtools_1.2   meteoconv_0.1
>  [17] pixmap_0.4-11  RColorBrewer_1.0-5 maptools_0.8-30sp_1.1-1
>  [21] mapdata_2.2-3  mapproj_1.2-2  maps_2.3-9 chron_2.3-45
>  [25] MASS_7.3-35
>
>  loaded via a namespace (and not attached):
>   [1] acepack_1.3-3.3 cluster_1.15.2  colorspace_1.2-4
>   [4] compiler_3.1.0  data.table_1.9.4digest_0.6.4
>   [7] foreign_0.8-61  gtable_0.1.2labeling_0.3
>  [10] latticeExtra_0.6-26 munsell_0.4.2   nnet_7.3-8
>  [13] proto_0.3-10Rcpp_0.12.0 rpart_4.1-8
>  [16] stringr_0.6.2   tools_3.1.0
>  > within
>  function (data, expr, ...)
>  UseMethod("within")
>  
>  
>
> __
> 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.



-- 
http://had.co.nz/

__
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] Problemas con rmarkdown

2015-09-20 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal?

¿Puedes probar a ejecutar los "chunks" del documento original uno a uno?
¿Funcionan todos? ¿Tienes errores en alguno?

(En RStudio puedes ejecutar todos los "chunks" desde los menús; también los
puedes ejecutar uno a uno si ves algo raro).

Un saludo,

Carlos J. Gil Bellosta
http://www.datanalytics.com

El 20 de septiembre de 2015, 21:46, Conney Marulanda 
escribió:

> Hola,
>
> Muchas gracias por tu ayuda... tengo el fichero Rmd pero no me deja
> visualizarlo como pdf, cuando lo intento me genera ese error.
>
> Gracias.
>
> Saludos,
>
> *Conney Paola Marulanda López *
> Profesional en Finanzas y Relaciones Internacionales
> *www.finanzaszone.com  *
>
>
>
>
>
>
> --
> Date: Sun, 20 Sep 2015 17:23:10 +0200
> Subject: Re: [R-es] Problemas con rmarkdown
> From: c...@datanalytics.com
> To: cpm...@hotmail.com
> CC: r-help-es@r-project.org
>
>
> Hola, ¿qué tal?
>
> Yo creo que el problema no está en R. Aparentemente, ya has generado el
> fichero .md que pandoc "traduce" a pdf.
>
> ¿Puedes ver el fichero .md correctamente? ¿Lo has generado a partir de un
> Rmd? ¿Puedes generar el pdf directamente desde RStudio a partir del Rmd (si
> es que lo hay)?
>
> Un saludo,
>
> Carlos J. Gil Bellosta
> http://www.datanalytics.com
>
> El 19 de septiembre de 2015, 22:41, Conney Marulanda 
> escribió:
>
> Buenas noches,
> Escribo este mail porque tengo un problema con rmarkdown, estoy creando un
> informe y me iba bien al generarlo como pdf, de repente me sale el
> siguiente error y no sé como solucionarlo:
> pandoc.exe: Error producing PDF from TeX sourceError: pandoc document
> conversion failed with error 43Además: Warning message:comando ejecutado
> '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS
> Evolución_de_los_Mercados_.utf8.md --to latex --from
> markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures
> --output Evolución_de_los_Mercados_.pdf --template
> "C:\Users\CONNY\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex"
> --highlight-style tango --latex-engine pdflatex --variable
> "geometry:margin=1in"' tiene estatus 43 Ejecución interrumpida
> Asimismo, si lo quiero generar como html sería para publicarlo en mi sitio
> web, le dí en la opción publicar y salió que requería instalar ciertos
> paquetes...pero luego me salió el siguiente error:
> "Error occurred while executing method"
> Agradezco su colaboración, pues la idea de mi informe es publicarlo en mi
> sitio web ya sea como pdf o directamente en formato html.
> Muchas gracias!
> Conney Paola Marulanda López
> Profesional en Finanzas y Relaciones Internacionales
> www.finanzaszone.com
>
>
>
>
>
> [[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