Re: [R] Polygon

2018-10-21 Thread David L Carlson
I think this does what you want.

z1<- -1
z2<-  2
oldp <- par(mgp=c(3, .5, 0))
curve(dnorm(x,0,1), xlim=c(-5, 5),main="Standard Normal",
xaxt="n", frame=F, xlab="")
jj<-seq(z1,z2,0.01)
cord.x<- jj
cord.y<- dnorm(jj)
polygon(c(-1, cord.x, 2), c(0, cord.y, 0), col="skyblue")
axis(1,at=c(-5,z1,0,z2,5),lab=c(-5,z1,0,z2,5))
abline(v=c(z1,z2))
axis(1, at=c(-5, z1, 0, z2, 5), lab=(c(-5,z1,0,z2,5) + 5)*2, line=2)
par(oldp)

When you assign a vector to an object, you do not need to use c(), e.g. cord.x 
<- jj. I expanded xlim= since you were labeling the axis at -5, and 5, but only 
drawing the plot from -4 to 4.

To get the polygon to work, you need to add points to the baseline at at either 
end.

The line= argument in axis() lets you put an axis line into the margin of the 
plot. I used the mgp= argument in par() to close the space between the 
tickmarks and their values.
--
David L. Carlson
Department of Anthropology
Texas A University

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Steven Yen
Sent: Sunday, October 21, 2018 1:47 PM
To: David Winsemius 
Cc: r-help@r-project.org
Subject: Re: [R] Polygon

David, Rui, and All:
Greetings.
1. I need a helping hand with the polygon statement below so that I can 
have the area under the curve highlighted, between (z1,z2).
2. Is it possible to label the X-axis with in two scale, in the current 
z-scale and another, say x = (z+5)*2?
Thank you.

z1<- -1
z2<-  2
curve(dnorm(x,0,1),xlim=c(-4,4),main="Standard 
Normal",xaxt="n",frame=F,xlab="z")
jj<-seq(z1,z2,0.01)
cord.x<-c(jj)
cord.y<-c(dnorm(jj))
#polygon(cord.x,cord.y,col="skyblue")
axis(1,at=c(-5,z1,0,z2,5),lab=c(-5,z1,0,z2,5))
abline(v=c(z1,z2))

-- 
st...@ntu.edu.tw (S.T. Yen)


[[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] Polygon

2018-10-21 Thread Steven Yen
David, Rui, and All:
Greetings.
1. I need a helping hand with the polygon statement below so that I can 
have the area under the curve highlighted, between (z1,z2).
2. Is it possible to label the X-axis with in two scale, in the current 
z-scale and another, say x = (z+5)*2?
Thank you.

z1<- -1
z2<-  2
curve(dnorm(x,0,1),xlim=c(-4,4),main="Standard 
Normal",xaxt="n",frame=F,xlab="z")
jj<-seq(z1,z2,0.01)
cord.x<-c(jj)
cord.y<-c(dnorm(jj))
#polygon(cord.x,cord.y,col="skyblue")
axis(1,at=c(-5,z1,0,z2,5),lab=c(-5,z1,0,z2,5))
abline(v=c(z1,z2))

-- 
st...@ntu.edu.tw (S.T. Yen)


[[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] Instalar paquetes antiguos R en Windows 10

2018-10-21 Thread Jorge I Velez
Claro.  Lo que ocurre es que

C:\Users\Victoria MartÌn

es diferente a

C:/Users/Victoria Martmn/

No sé qué debes hacer para corregir el problema, pero no debe ser difícil.

Saludos,
Jorge Velez.-



El El dom, 21 de oct. de 2018 a las 10:55 a. m., JOSE MARTIN AREVALO <
martin_j...@gva.es> escribió:

> Hola a todos y gracias por responder.
>
> He seguido la sugerencia de ver si era un problema de permisos, y creo que
> no es el caso. Me da la impresión que R busca archivos en un directorio que
> no existe y, además, no creo haberle configurado. Os pongo la salida que me
> da cuando bajo este archivo del repositorio (es la misma que cuando lo hago
> desde el directorio):
>
> > install.packages("devtools")
> Installing package into ëC:/Users/Victoria
> MartÌn/Documents/R/win-library/3.5í
> (as ëlibí is unspecified)
>
>   There is a binary version available but the source version is later:
>  binary source needs_compilation
> devtools 1.13.6  2.0.0 FALSE
>
> installing the source package ëdevtoolsí
>
> probando la URL '
> https://cran.cnr.berkeley.edu/src/contrib/devtools_2.0.0.tar.gz'
> Content type 'application/x-gzip' length 388238 bytes (379 KB)
> downloaded 379 KB
>
> * installing *source* package 'devtools' ...
> ** package 'devtools' successfully unpacked and MD5 sums checked
> Warning in file(file, if (append) "a" else "w") :
>   cannot open file 'C:/Users/Victoria
> Martmn/Documents/R/win-library/3.5/devtools/DESCRIPTION': No such file or
> directory
> Error in file(file, if (append) "a" else "w") :
>   no se puede abrir la conexiÛn
> ERROR: installing package DESCRIPTION failed for package 'devtools'
> * removing 'C:/Users/Victoria MartÌn/Documents/R/win-library/3.5/devtools'
> In R CMD INSTALL
>
> The downloaded source packages are in
> ëC:\Users\Victoria
> MartÌn\AppData\Local\Temp\Rtmp8SKA07\downloaded_packagesí
> Warning message:
> In install.packages("devtools") :
>   installation of package ëdevtoolsí had non-zero exit status
>
>
> Esto me desconcierta bastante: "Warning in file(file, if (append) "a" else
> "w") :  cannot open file 'C:/Users/Victoria
> Martmn/Documents/R/win-library/3.5/devtools/DESCRIPTION': No such file or
> directory” porque ese directorio no existe y no sé de dónde lo ha sacado R.
> Como veréis, he llegado incluso a instalar la versión 3.5.1, y me sigue
> pasando lo mismo. Cuando he intentado cambiar el directorio, no lo hace.
> Al aplicar getwd(), la salida que da es: C:/Users/Victoria
> MartÌn/Documents/R/win-library/3.5, pero creo que no me deja cambiar el
> directorio con “setwd()”.
>
> Espero que con esto os aporte algo más de información, porque yo llevo una
> semana dándole al tema y no hay manera.
>
> Muchas gracias.
>
> Pepe Martín
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
-- 
Sent from my phone. Please excuse my brevity and misspelling.

[[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] Instalar paquetes antiguos R en Windows 10

2018-10-21 Thread JOSE MARTIN AREVALO
Hola a todos y gracias por responder.

He seguido la sugerencia de ver si era un problema de permisos, y creo que no 
es el caso. Me da la impresión que R busca archivos en un directorio que no 
existe y, además, no creo haberle configurado. Os pongo la salida que me da 
cuando bajo este archivo del repositorio (es la misma que cuando lo hago desde 
el directorio):

> install.packages("devtools")
Installing package into ëC:/Users/Victoria MartÌn/Documents/R/win-library/3.5í
(as ëlibí is unspecified)

  There is a binary version available but the source version is later:
 binary source needs_compilation
devtools 1.13.6  2.0.0 FALSE

installing the source package ëdevtoolsí

probando la URL 
'https://cran.cnr.berkeley.edu/src/contrib/devtools_2.0.0.tar.gz'
Content type 'application/x-gzip' length 388238 bytes (379 KB)
downloaded 379 KB

* installing *source* package 'devtools' ...
** package 'devtools' successfully unpacked and MD5 sums checked
Warning in file(file, if (append) "a" else "w") :
  cannot open file 'C:/Users/Victoria 
Martmn/Documents/R/win-library/3.5/devtools/DESCRIPTION': No such file or 
directory
Error in file(file, if (append) "a" else "w") : 
  no se puede abrir la conexiÛn
ERROR: installing package DESCRIPTION failed for package 'devtools'
* removing 'C:/Users/Victoria MartÌn/Documents/R/win-library/3.5/devtools'
In R CMD INSTALL

The downloaded source packages are in
ëC:\Users\Victoria 
MartÌn\AppData\Local\Temp\Rtmp8SKA07\downloaded_packagesí
Warning message:
In install.packages("devtools") :
  installation of package ëdevtoolsí had non-zero exit status


Esto me desconcierta bastante: "Warning in file(file, if (append) "a" else "w") 
:  cannot open file 'C:/Users/Victoria 
Martmn/Documents/R/win-library/3.5/devtools/DESCRIPTION': No such file or 
directory” porque ese directorio no existe y no sé de dónde lo ha sacado R. 
Como veréis, he llegado incluso a instalar la versión 3.5.1, y me sigue pasando 
lo mismo. Cuando he intentado cambiar el directorio, no lo hace.
Al aplicar getwd(), la salida que da es: C:/Users/Victoria 
MartÌn/Documents/R/win-library/3.5, pero creo que no me deja cambiar el 
directorio con “setwd()”.

Espero que con esto os aporte algo más de información, porque yo llevo una 
semana dándole al tema y no hay manera.

Muchas gracias.

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


Re: [R-es] Instalar paquetes antiguos en Windows 10

2018-10-21 Thread Javier Marcuzzi
Estimado José Martín Arevalo

¿Que posibilidad hay en los directorios diferentes? Uno busca en 3.3.0 y
otro en 3.5.1

Javier Rubén Marcuzzi

El dom., 21 oct. 2018 a las 8:39, Carlos Ortega ()
escribió:

> Hola,
>
> Prueba a instalar primero la versión anterior de la dependencia
> ("optmatch") y luego instalar el paquete "Matchlt".
> Además parece que tienes un problema de permisos en el directorio donde se
> instalan, localiza ese directorio y da permisos completos.
>
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>
> El dom., 21 oct. 2018 a las 9:44, JOSE MARTIN AREVALO ( >)
> escribió:
>
> > Hola a todos! Espero que alguien me pueda echar algo de luz al problema
> > que tengo.
> >
> > Estoy intentando instalar algunos paquetes antiguos en R (3.3.0), como
> > ‘devtools’ en su penúltima versión, y me está resultando imposible.
> Instalé
> > Rtools y R me dice que funciona, pero no consigo hacer que se instale el
> > paquete. He probado bajando el paquete en formato .tar.gz y luego con las
> > instrucciones:
> >
> > filename <- file.choose()
> > install.packages(filename, type=“source”, repos=NULL)
> >
> > Entonces, encuentra el paquete, pero luego me dice que no puede abrir un
> > directorio y no realiza la instalación. También he probado a hacerlo
> > directamente desde el repositorio, y me da el mismo error. Mi problema
> > principal es que necesito instalar el paquete ‘MatchIt’ y cuando empieza
> la
> > instalación me dice que no puede instalar la dependencia ‘optmatch’
> porque
> > en el repositorio hay una versión posterior a la que necesita.
> >
> > ¿Alguien me puede ayudar?
> >
> > Muchas gracias
> >
> > Pepe Martín
> >
> > ___
> > 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
>

[[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] studio server on High SIerra

2018-10-21 Thread Marc Girondot via R-help

I post long time ago a post on my blog about this:
https://max2.ese.u-psud.fr/epc/conservation/Girondot/Publications/Blog_r/Entrees/2014/8/3_Install_RStudio_server_on_Marverick_MacOSX.html

You could try using this base.

Marc

Le 21/10/2018 à 05:12, Fuchs Ira a écrit :

Can I run Rstudio Server on OSX 10.13 (High Sierra). If so, can someone
please point me to install directions? I found an old post that talks about
using homebrew but I can't find the rstudio-server brew to install.

__
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] integral of the fuction for each value

2018-10-21 Thread Tobias Fellinger
Hi, 

I'm not entirely sure what you want to calculate. 

If you want to integrate by u in the interval from 0 to 4 for every value
of x I would suggest something like this:

x <- rnorm(10,0,1)
f <- function(u,x){
  exp((x-u))
}

sapply(x, function(i){
  integrate(f,lower=1,upper=4, x=i)$value
})

You can just pass additional arguments to f to integrate, integrate always
integrates by the first argument of the function passed as its first
argument, see the help entry of integrate for more details.

Best Regards, Tobias

On Sun, 2018-10-21 at 12:02 +, malika yassa via R-help wrote:
> hello
> please you help me i have this functionx<-rnorm(10,0,1)f<-fuction(u,x)  
> {exp((x-u)}I want to calculate the integral of this function for each value 
> of x{for(i in 1:lenght(x)integrate(f,lower=1,upper=4) 
> thinks
> 
>   [[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.


[R] integral of the fuction for each value

2018-10-21 Thread malika yassa via R-help
hello
please you help me i have this functionx<-rnorm(10,0,1)f<-fuction(u,x)  
{exp((x-u)}I want to calculate the integral of this function for each value of 
x{for(i in 1:lenght(x)integrate(f,lower=1,upper=4) 
thinks

[[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] Instalar paquetes antiguos en Windows 10

2018-10-21 Thread Carlos Ortega
Hola,

Prueba a instalar primero la versión anterior de la dependencia
("optmatch") y luego instalar el paquete "Matchlt".
Además parece que tienes un problema de permisos en el directorio donde se
instalan, localiza ese directorio y da permisos completos.

Saludos,
Carlos Ortega
www.qualityexcellence.es

El dom., 21 oct. 2018 a las 9:44, JOSE MARTIN AREVALO ()
escribió:

> Hola a todos! Espero que alguien me pueda echar algo de luz al problema
> que tengo.
>
> Estoy intentando instalar algunos paquetes antiguos en R (3.3.0), como
> ‘devtools’ en su penúltima versión, y me está resultando imposible. Instalé
> Rtools y R me dice que funciona, pero no consigo hacer que se instale el
> paquete. He probado bajando el paquete en formato .tar.gz y luego con las
> instrucciones:
>
> filename <- file.choose()
> install.packages(filename, type=“source”, repos=NULL)
>
> Entonces, encuentra el paquete, pero luego me dice que no puede abrir un
> directorio y no realiza la instalación. También he probado a hacerlo
> directamente desde el repositorio, y me da el mismo error. Mi problema
> principal es que necesito instalar el paquete ‘MatchIt’ y cuando empieza la
> instalación me dice que no puede instalar la dependencia ‘optmatch’ porque
> en el repositorio hay una versión posterior a la que necesita.
>
> ¿Alguien me puede ayudar?
>
> Muchas gracias
>
> Pepe Martín
>
> ___
> 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] Instalar paquetes antiguos en Windows 10

2018-10-21 Thread JOSE MARTIN AREVALO
Hola a todos! Espero que alguien me pueda echar algo de luz al problema que 
tengo.

Estoy intentando instalar algunos paquetes antiguos en R (3.3.0), como 
‘devtools’ en su penúltima versión, y me está resultando imposible. Instalé 
Rtools y R me dice que funciona, pero no consigo hacer que se instale el 
paquete. He probado bajando el paquete en formato .tar.gz y luego con las 
instrucciones:

filename <- file.choose()
install.packages(filename, type=“source”, repos=NULL)

Entonces, encuentra el paquete, pero luego me dice que no puede abrir un 
directorio y no realiza la instalación. También he probado a hacerlo 
directamente desde el repositorio, y me da el mismo error. Mi problema 
principal es que necesito instalar el paquete ‘MatchIt’ y cuando empieza la 
instalación me dice que no puede instalar la dependencia ‘optmatch’ porque en 
el repositorio hay una versión posterior a la que necesita.

¿Alguien me puede ayudar? 

Muchas gracias 

Pepe Martín

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


Re: [R] Need to understand how to troubleshoot below error

2018-10-21 Thread MEENA SUBRAMANIAN via R-help
 Hi Jeff,
im a new learner to R an I am trying to execute the below and my files get 
created except for the last function write.csv(housedata, file 
="housedatacomplete.csv")write where my new file housedatacomplete.csv does not 
get created and no write command works for me. Also I am unable to save any 
files.



setwd("C:\\Users\\Vidyut\\Desktop\\I2R")



getwd()



housesalesdata<-read.csv("housesalesdata.csv")



housefeaturesdata<-read.csv("housefeaturesdata.csv")



housedata<-merge(housesalesdata,housefeaturesdata,by="ID")



write.csv(housedata, file ="housedatacomplete.csv")



Thanks 

Meena 



On ‎Sunday‎, ‎21‎ ‎October‎ ‎2018‎ ‎04‎:‎49‎:‎49‎ ‎AM‎ ‎IST, Jeff Newmiller 
 wrote:  
 
 When you specify a filename such as 'housedatacomplete.csv' which has no 
directory path information, the file is assumed to be in the "current 
directory" which you can identify using the status notation at the top of the 
RStudio console window or using the R getwd() function. Note that we may guess 
something about what may be wrong if you provide that information in your 
request here, but it is more likely that you will need to use the operating 
system to investigate permissions which are really off-topic here. Your best 
bet will be to find a local computer tech or sysadmin to help you solve your 
mystery, since there can be many special configurations we on the mailing list 
won't know about.

One note: since you are using RStudio, be sure to create a Project 
directory/file and do your work with a project open. That way most problems 
with permissions and working in the wrong directory should usually be avoided. 
If you cannot create a project then you definitely need local help.

On October 20, 2018 3:08:28 PM PDT, jim holtman  wrote:
>Can you show the code that was being executed at the time.  Have you
>verified that the path to the file is correct for the directory that
>you
>are using?  Have you validated that you have the correct permissions in
>the
>directory to create the file?  Show the complete path length that you
>were
>using and then follow that path to make sure that there is a directory
>there that you can write into.
>
>Jim Holtman
>*Data Munger Guru*
>
>
>*What is the problem that you are trying to solve?Tell me what you want
>to
>do, not how you want to do it.*
>
>
>On Sat, Oct 20, 2018 at 1:19 PM MEENA SUBRAMANIAN via R-help <
>r-help@r-project.org> wrote:
>
>> Hi
>> Im unable to write or save my R studio files
>> Below error is thrown when the same code works for others
>> Error in file(file, ifelse(append, "a", "w")) :  cannot open the
>> connectionIn addition: Warning message:In file(file, ifelse(append,
>"a",
>> "w")) :  cannot open file 'housedatacomplete.csv': No such file or
>directory
>>
>> Meena
>>        [[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.
>>
>
>    [[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.

-- 
Sent from my phone. Please excuse my brevity.  
[[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.