Re: [R] Excluding "small data" from plot.

2016-02-17 Thread PIKAL Petr
Hi

Please cc your mails to r help. Users are around the world and you could have 
response oslo from others.

You need to put NA in a missing good or bad letter. I would probably do merging 
instead of do.call but there may be other options.

Something like that.

> l1<-sample(letters[1:10], 5)
> l2<-sample(letters[1:10], 5)
> x1<-data.frame(l1, x=rnorm(5))
> x2<-data.frame(l2)
> x1
  l1  x
1  d  0.7948186
2  b  1.3076922
3  j  1.8305538
4  i -0.1934532
5  e -1.5182885
> x2
  l2
1  f
2  j
3  h
4  a
5  i
> merge(x1, x2, by.x="l1",by.y="l2", all=TRUE)
  l1  x
1  b  1.3076922
2  d  0.7948186
3  e -1.5182885
4  i -0.1934532
5  j  1.8305538
6  a NA
7  f NA
8  h NA

Or you can use some clever combination of intersect and setdiff

?intersect

to find which letters are missing in each group.

Cheers
Petr


> -Original Message-
> From: Kieran [mailto:kroberts...@gmail.com]
> Sent: Wednesday, February 17, 2016 7:37 PM
> To: PIKAL Petr
> Subject: Re: [R] Excluding "small data" from plot.
>
> Hi Petr,
>
> Thanks for you reply. This almost does what I need but there is one
> problem.
>
> Before running
>
> lll <- do.call(rbind, lll),
>
> lll is a list with two data sets: the top 8 most frequently used
> letters of bad type [e,n,a,t,o,i,h,r] and the top 8 mostly frequently
> used letters of good type [e,t,i,a,s,o,r,h]. These two groups of
> letters are almost the same (as one would expect). They differ in two
> places: n (is bad) and s (is good).
>
> After running the do.call function with rbind I get a union of these
> rows. But then when I run
>
> ggplot(lll,aes(x=Group.1,y=x, fill=Group.2), color=Group.2) +
> stat_summary(fun.y=sum,position=position_dodge(),geom="bar")
>
> For n on the x-axis I get two bars of the same colour red (=bad) For s
> on the x-axis I get two bars of the same colour blue (=good)
>
> But I really want is the 'good' value for n next to the bad value for
> 'n'.  And the same for 's'. This task seems more complicated.
>
> Best,
> Kieran.
>
> On 17 February 2016 at 13:49, PIKAL Petr 
> wrote:
> > Hi
> >
> > There is probably better solution but I would aggregate
> >
> > lll <- aggregate(ltrfreq$letterfreq, list(ltrfreq$letter,
> > ltrfreq$type), sum)
> >
> > order
> >
> > ooo<-order(lll$x, decreasing=T)
> >
> > split and sapply
> > lll<- lll[ooo,]
> > lll <- lapply(split(lll, lll$Group.2), head, 8)
> >
> > and do.call rbind to get 8 letters for good and bad plotting.
> >
> > lll<-do.call(rbind, lll)
> > library(ggplot2)
> > ggplot(lll,aes(x=Group.1,y=x, fill=Group.2), color=Group.2) +
> > +  stat_summary(fun.y=sum,position=position_dodge(),geom="bar")
> >
> >
> > Cheers
> > Petr
> >
> >
> >> -Original Message-
> >> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
> >> Kieran
> >> Sent: Wednesday, February 17, 2016 10:20 AM
> >> To: R-help@r-project.org
> >> Subject: [R] Excluding "small data" from plot.
> >>
> >> To R-help users:
> >>
> >> I want to use ggplot two plot summary statistics on the frequency of
> >> letters from a page of text. My data frame has four columns:
> >>
> >> (1) The line number [1 to 30]
> >> (2) The letter [a to z]
> >> (3) The frequency of the letter [assuming there is 80 letters per
> >> line]
> >> (4) The factor 'type': bad or good (purely artificial factor)
> >>
> >> I want to achieve the following plot:
> >>
> >> (a) Bar plot with an x-axis to be the letters and the y-axis the sum
> >> of 30 letter frequencies from each line of each letter.
> >> (b) Split each bar (for a letter) into two bars for 'good' and 'bad'
> >> types.
> >> (c) Display the union of the top 8 most frequency used letters for
> >> both types 'good' and 'bad'.
> >>
> >> By point (c) I mean: if a,e,f,h,i,t,s,r are the most frequent letter
> >> of type 'good' and a,e,f,h,i,m,l,p are the most frequent letter of
> >> type 'bad'.
> >> Then
> >> I would like my plot to feature the letters a,e,f,h,i,t,s,r,m,l,p.
> >>
> >> Here is my code:
> >>
> >> # There will be 30 lines and we want to record the frequency of each
> >> letter # on each line.
> >>
> >> lines <- c(rep(1:30, each=26))
> >> letter <- c(rep(letters, times=30))
> >>
> >> # We have taken the letter frequencies from #
> >> http://www.math.cornell.edu/~mec/2003-
> >> 2004/cryptography/subs/frequencies.html
> >>
> >> freq <- c(8.12, 1.49, 2.71, 4.32, 12.02, 2.30, 2.03, 5.92, 7.31,
> >> 0.10, 0.69, 3.98, 2.61, 6.95, 7.68, 1.82, 0.11, 6.02, 6.28, 9.10,
> >> 2.88, 1.11, 2.09, 0.17, 2.11, 0.07) freq <- freq/100
> >>
> >>
> >> # We assume each line contains 80 letters and change the seed for
> >> each line # for variability.
> >>
> >> letterfreq <- integer()
> >> for (i in 1:30) {
> >> set.seed(i)
> >> s<-data.frame(sample(letters, size = 80, replace = TRUE, prob =
> >> freq))
> >> names(s) <- "ltr"
> >> s$ltr <- factor(s$ltr, levels = letters)
> >> frq<-as.data.frame(table(s))
> >> letterfreq <- append(letterfreq, frq$Freq) }
> 

Re: [R] regression coefficients

2016-02-17 Thread William Dunlap via R-help
> mod_c <- aov(dv ~ myfactor_c + Error(subject/myfactor_c), data=mydata_c)
>
> summary.lm(mod_c)
> Error in if (p == 0) { : argument is of length zero>

You called the lm method for summary() on an object of class c("aovlist",
"listof").   You should not expect a method for one class to work on an
object of a different class.

coefficients(mod_c) will give you the coefficients of the 3 linear models
(including the intercept-only model) that aov fits.  Since an aovlist
object is a list of c("aov","lm") objects you can get the summaries of its
components with lapply(mod_c, summary).



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Feb 17, 2016 at 5:54 PM, Cristiano Alessandro <
cri.alessan...@gmail.com> wrote:

> Dear all,
>
> I am trying to visualize the regression coefficients of the linear model
> that the function aov() implicitly fits. Unfortunately the function
> summary.lm() throws an error I do not understand. Here is a toy example:
>
> dv <- c(1,3,4,2,2,3,2,5,6,3,4,4,3,5,6);
> subject <-
> factor(c("s1","s1","s1","s2","s2","s2","s3","s3","s3","s4","s4","s4","s5","s5","s5"));
> myfactor_c <-
> factor(c("f1","f2","f3","f1","f2","f3","f1","f2","f3","f1","f2","f3","f1","f2","f3"))
>
> mydata_c <- data.frame(dv, subject, myfactor)
>
> mod_c <- aov(dv ~ myfactor_c + Error(subject/myfactor_c), data=mydata_c)
>
> > summary.lm(mod_c)
> Error in if (p == 0) { : argument is of length zero
>
> Please note that the example is a within-subject design with factor
> myfactor_c.
>
> Any help is greatly appreciated.
>
> Best
> Cristiano
>
> PS. If this is a stupid question, I apologize. I am very new to R.
>
> __
> 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] regression coefficients

2016-02-17 Thread Jim Lemon
Hi Cristiano,
Might be the data you have for "dv". I don't seem to get the problem.

dv<-sample(1:6,15,TRUE)
subject<-factor(rep(paste("s",1:5,sep=""),each=3))
myfactor_c<-factor(rep(paste("f",1:3,sep=""),5))
mydata_c<-data.frame(dv,subject,myfactor_c)
mod_c<-aov(dv~myfactor_c+Error(subject/myfactor_c),data=mydata_c)
mod_c

Call:
aov(formula = dv ~ myfactor_c + Error(subject/myfactor_c),
...

summary(mod_c)

Error: subject
  Df Sum Sq Mean Sq F value Pr(>F)
Residuals  4   13.6 3.4

Error: subject:myfactor_c
 Df Sum Sq Mean Sq F value Pr(>F)
myfactor_c  2  8.133   4.067   1.196  0.351
Residuals   8 27.200   3.400

Jim



On Thu, Feb 18, 2016 at 12:54 PM, Cristiano Alessandro <
cri.alessan...@gmail.com> wrote:

> Dear all,
>
> I am trying to visualize the regression coefficients of the linear model
> that the function aov() implicitly fits. Unfortunately the function
> summary.lm() throws an error I do not understand. Here is a toy example:
>
> dv <- c(1,3,4,2,2,3,2,5,6,3,4,4,3,5,6);
> subject <-
> factor(c("s1","s1","s1","s2","s2","s2","s3","s3","s3","s4","s4","s4","s5","s5","s5"));
> myfactor_c <-
> factor(c("f1","f2","f3","f1","f2","f3","f1","f2","f3","f1","f2","f3","f1","f2","f3"))
>
> mydata_c <- data.frame(dv, subject, myfactor)
>
> mod_c <- aov(dv ~ myfactor_c + Error(subject/myfactor_c), data=mydata_c)
>
> > summary.lm(mod_c)
> Error in if (p == 0) { : argument is of length zero
>
> Please note that the example is a within-subject design with factor
> myfactor_c.
>
> Any help is greatly appreciated.
>
> Best
> Cristiano
>
> PS. If this is a stupid question, I apologize. I am very new to R.
>
> __
> 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.


[R] regression coefficients

2016-02-17 Thread Cristiano Alessandro

Dear all,

I am trying to visualize the regression coefficients of the linear model 
that the function aov() implicitly fits. Unfortunately the function 
summary.lm() throws an error I do not understand. Here is a toy example:


dv <- c(1,3,4,2,2,3,2,5,6,3,4,4,3,5,6);
subject <- 
factor(c("s1","s1","s1","s2","s2","s2","s3","s3","s3","s4","s4","s4","s5","s5","s5"));
myfactor_c <- 
factor(c("f1","f2","f3","f1","f2","f3","f1","f2","f3","f1","f2","f3","f1","f2","f3")) 


mydata_c <- data.frame(dv, subject, myfactor)

mod_c <- aov(dv ~ myfactor_c + Error(subject/myfactor_c), data=mydata_c)

> summary.lm(mod_c)
Error in if (p == 0) { : argument is of length zero

Please note that the example is a within-subject design with factor 
myfactor_c.


Any help is greatly appreciated.

Best
Cristiano

PS. If this is a stupid question, I apologize. I am very new to R.

__
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] How to plot gaps in chartSeries

2016-02-17 Thread Jeff Trefftzs
In hopes of isolating parts of a time series where my indicator is
above zero I have filled those rows where the indicator is <= 0  with
NAs.  I was hoping this would leave blank gaps when I plotted using
chartSeries(blanked, theme = 'white'), but chartSeries closes up the
gaps.  ggplot, however, leaves nice gaps in the output.

Is there a way to make chartSeries leave space for each value of the
time index of an xts object whether or not there is data for it?

-- 
Jeff Trefftzs
http://www.trefftzs.org

__
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-pkgs] announcing maps version 3.1.0

2016-02-17 Thread Alex Deckmyn
Hi, 

I am pleased to announce version 3.1.0 of the 'maps' package which has a few 
important changes and additions. 

CHANGES: 
- The 'world' map has been adapted: it now doesn't contain any lakes anymore. 
Most visible effect is the Great Lakes on the Canada/USA border. 
- Major lakes are now available in a separate database 'lakes', so they can 
still be added to a plot if desired. 
- As a result, plotting without interior borders now gives much cleaner 
results. 
- The 'world2' database has been cleaned up a bit to look better at the 
boundaries. 

ADDITIONS: 
- map() now accepts spatial objects of types SpatialPolygon[DataFrame] and 
SpatialLines[DataFrame] as database. The support is limited to the actual 
polygon co-ordinates and names. Any other information (plotting order, 
projection etc) is lost. So one can now for instance read shapefile data (e.g. 
readShapePoly() from the maptools package) and pass the result to map(). 

FIXES: 
- map(...,fill=TRUE) will no longer apply thinning to the map. The thinning 
caused polygons to have non-matching borders. For large databases (e.g. the 
complete worldHires database) this may have a noticable effect on speed. 

Alex Deckmyn 


--- 
Dr. Alex Deckmyn e-mail: alex.deck...@meteo.be 
Royal Meteorological Institute http://www.meteo.be 
Ringlaan 3, 1180 Ukkel, Belgium tel. (32)(2)3730646 


[[alternative HTML version deleted]]

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

__
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] Error in cut.default(a, breaks = 100) : 'breaks' are not unique

2016-02-17 Thread Jeff Newmiller
Range of values is a standard mathematical concept, unrelated to the number of 
values in your data set.  Consider using the summary function to learn about 
the range of your data. 

Also, read the Posting Guide (which warns you to use pain text in formulating 
your emails to the list to avoid corruption of your email). Always try to 
supply self-contained examples of code that conveys what you understand so far. 
Read 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 for advice on communicating examples clearly. 
-- 
Sent from my phone. Please excuse my brevity.

On February 17, 2016 7:06:19 AM PST, "/ty放仔兽/yl"  wrote:
>Dear R users,
>as my first post for this mailing list, I'd like to ask questions about
>'break' in cut.default.
>
>
>I am using pheatmap in RStudio. Pheatmap is a function to draw
>clustered heatmap in R. 
>
>
>According to the manual, breaks is 'a sequence of numbers that covers
>the range of values in data matrix and is one element longer than color
>vector. Used for mapping values to colors. Useful, if needed to map
>certain values to certain colors, to certain values. If value is NA
>then the breaks are calculated automatically.' 
>
>
>I left it NA but received an error message. I then assigned a seq to it
>by typing breaks=c(0,1,2,3,4,5,6,7,8,9), which didn't work as well (my
>col.pal has 9 elements so I made a breaks with 10 elements).
>
>
>One thing I felt confused was that it said breaks should cover the
>range of values in data matrix. My data has 20 obs. of 23 variables.
>Which number would cover it? And how should I understand 'cover' in
>this context.
>
>
>Sorry to bother you guys. I am quite a rookie to R.
>
>
>Kind. Sebastian
>   [[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.

Re: [R] Error in cut.default(a, breaks = 100) : 'breaks' are not unique

2016-02-17 Thread Sarah Goslee
It should cover the range of values - from below the minimum to above
the maximum of your data.
One break would do it, or 10, or whatever. It doesn't matter how many
breaks you have, it matters that they have a sufficient range.
So you might make breaks like
seq(floor(min(x)), ceiling(max(x)), length.out = 10)
if you want equal lengths.

Sarah



On Wed, Feb 17, 2016 at 10:06 AM, /ty放仔兽/yl  wrote:
> Dear R users,
> as my first post for this mailing list, I'd like to ask questions about 
> 'break' in cut.default.
>
>
> I am using pheatmap in RStudio. Pheatmap is a function to draw clustered 
> heatmap in R.
>
>
> According to the manual, breaks is 'a sequence of numbers that covers the 
> range of values in data matrix and is one element longer than color vector. 
> Used for mapping values to colors. Useful, if needed to map certain values to 
> certain colors, to certain values. If value is NA then the breaks are 
> calculated automatically.'
>
>
> I left it NA but received an error message. I then assigned a seq to it by 
> typing breaks=c(0,1,2,3,4,5,6,7,8,9), which didn't work as well (my col.pal 
> has 9 elements so I made a breaks with 10 elements).
>
>
> One thing I felt confused was that it said breaks should cover the range of 
> values in data matrix. My data has 20 obs. of 23 variables. Which number 
> would cover it? And how should I understand 'cover' in this context.
>
>
> Sorry to bother you guys. I am quite a rookie to R.
>

__
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] Error in cut.default(a, breaks = 100) : 'breaks' are not unique

2016-02-17 Thread /ty??????/yl
Dear R users,
as my first post for this mailing list, I'd like to ask questions about 'break' 
in cut.default.


I am using pheatmap in RStudio. Pheatmap is a function to draw clustered 
heatmap in R. 


According to the manual, breaks is 'a sequence of numbers that covers the range 
of values in data matrix and is one element longer than color vector. Used for 
mapping values to colors. Useful, if needed to map certain values to certain 
colors, to certain values. If value is NA then the breaks are calculated 
automatically.' 


I left it NA but received an error message. I then assigned a seq to it by 
typing breaks=c(0,1,2,3,4,5,6,7,8,9), which didn't work as well (my col.pal has 
9 elements so I made a breaks with 10 elements).


One thing I felt confused was that it said breaks should cover the range of 
values in data matrix. My data has 20 obs. of 23 variables. Which number would 
cover it? And how should I understand 'cover' in this context.


Sorry to bother you guys. I am quite a rookie to R.


Kind. Sebastian
[[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] Manejo de ficheros Linux desde R

2016-02-17 Thread Proyecto R-UCA
Hola.

Pedro, ¿has valorado la posibilidad de que el script se ejecute con la
recepción del correo y no a intervalos periódicos?

La utilidad procmail se puede configurar para que lance un ejecutable
con la llegada de un correo. De esta forma no harías ejecuciones en
vacío (sin nada que procesar) y los resultados estarían al mismo
tiempo, casi, que llega el correo.

Saludos.

El dom, 14-02-2016 a las 18:05 +0100, Pedro Herrero Petisco escribió:
> Hola a todos.
> Tengo un proyecto entre manos que consiste en lo siguiente:
> Un suario manda a un correo electrónico un mail con un fichero
> adjunto,
> este fichero se descarga de forma automática en una carpeta de un
> sistema
> que corre bajo Linux (Ubuntu), una vez descargado quisiera generar un
> script de R de forma automática seleccionase el último fichero
> descargado e
> hiciese con él una serie de acciones que estén recogidas en un
> script.
> 
> Tanto la descarga de fichero como la ejecución del script se haría de
> forma
> periódica... pero lo que me preocupa es que no sé como hacer que R
> distinga
> el fichero a usar (que sería siempre el último recibido) ya que cada
> fichero tendrá un nombre distinto.
> 
> ¿Alguna idea?
> 
> Como dato adicional decir que soy absolutamente novato en el manejo
> de
> linux desde terminal, pero que estoy empezando a aprender ahora, y si
> la
> solución viniese por ejecutar comandos de Linux en lugar de R también
> me
> valdría.
> 
> Muchas gracias a todos
> 
>   [[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-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] this is not a list, not a data frame, but what ?

2016-02-17 Thread Bert Gunter
Better:

mom["PC_Q_m3","value"]

Read about indexing in R .

Bert




On Tuesday, February 16, 2016, MAURICE Jean - externe <
jean-externe.maur...@edf.fr> wrote:

> I went further !
>
> I could give a name to each row based on column 2 in the read.table
> command and then access to the value by :
>
> mom["PC_Q_m3",]$value
>
> It’s great
> Jean
>
>
>
> Ce message et toutes les pièces jointes (ci-après le 'Message') sont
> établis à l'intention exclusive des destinataires et les informations qui y
> figurent sont strictement confidentielles. Toute utilisation de ce Message
> non conforme à sa destination, toute diffusion ou toute publication totale
> ou partielle, est interdite sauf autorisation expresse.
>
> Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de
> le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou
> partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de
> votre système, ainsi que toutes ses copies, et de n'en garder aucune trace
> sur quelque support que ce soit. Nous vous remercions également d'en
> avertir immédiatement l'expéditeur par retour du message.
>
> Il est impossible de garantir que les communications par messagerie
> électronique arrivent en temps utile, sont sécurisées ou dénuées de toute
> erreur ou virus.
> 
>
> This message and any attachments (the 'Message') are intended solely for
> the addressees. The information contained in this Message is confidential.
> Any use of information contained in this Message not in accord with its
> purpose, any dissemination or disclosure, either whole or partial, is
> prohibited except formal approval.
>
> If you are not the addressee, you may not copy, forward, disclose or use
> any part of it. If you have received this message in error, please delete
> it and all copies from your system and notify the sender immediately by
> return message.
>
> E-mail communication cannot be guaranteed to be timely secure, error or
> virus-free.
>
> [[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.



-- 
Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

[[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] missing values in csv file

2016-02-17 Thread William Dunlap via R-help
You can add the argument na.print=" " to print() to make
the missing values print as " " instead of as NA.  Some,
but not all print methods support this.  E.g.,
 > print(c(1,2,NA,4,5,NA), na.print="-")
 [1] 1 2 - 4 5 -
 > print(matrix(c(1,2,NA,4,5,NA),2), na.print="-")
  [,1] [,2] [,3]
 [1,]1-5
 [2,]24-
 > # print.data.frame use na.print for factor/character data only
 > print(data.frame(X=c(1,NA,3), Y=LETTERS[c(NA,2,3)]), na.print="-")
> print(data.frame(X=c(1,NA,3), Y=LETTERS[c(NA,2,3)], Z=c(NA,TRUE,FALSE)),
na.print="-")
X Y Z
 1  1 -NA
 2 NA B  TRUE
 3  3 C FALSE

In write.table (& write.csv) the argument na=" " does the trick.
 > write.csv(data.frame(X=c(1,NA,3), Y=LETTERS[c(NA,2,3)],
Z=c(NA,TRUE,FALSE)), na="-")
 "","X","Y","Z"
 "1",1,-,-
 "2",-,"B",TRUE
 "3",3,"C",FALSE


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Feb 17, 2016 at 2:04 AM, Jan Kacaba  wrote:

> In my original data a csv file I have missing values. If I use read.table
> the missing values are replaced by NAs.
>
> Is it possible to get object where missing values aren't replaced with NAs?
> Is it possible to replace NAs with empty space?
>
> [[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.


Re: [R] data merging

2016-02-17 Thread Shane Carey
Hi,

I found the error.

Thanks in advance

On Wed, Feb 17, 2016 at 4:01 PM, Shane Carey  wrote:

> Hi,
>
> Im trying to append rows to a data frame using smartbind
>
> I have 3 dataframes:
>
> > dim(DATA_WH)[1] 235  24> dim(DATA_GW)[1] 3037   41> dim(DATA_NFGWS)[1] 2485 
> >   62
>
> B<-smartbind(DATA_NFGWS,DATA_WH)
>
>
> However I get the following error:
>
>  Error in `[.data.frame`(block, , col) : undefined columns selected
>
>
> Any advice on this would be greatly appreciated!! Driving me nuts!!
> Thanks
> --
> Shane
>



-- 
Shane

[[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] data merging

2016-02-17 Thread Shane Carey
Hi,

Im trying to append rows to a data frame using smartbind

I have 3 dataframes:

> dim(DATA_WH)[1] 235  24> dim(DATA_GW)[1] 3037   41> dim(DATA_NFGWS)[1] 2485   
> 62

B<-smartbind(DATA_NFGWS,DATA_WH)


However I get the following error:

 Error in `[.data.frame`(block, , col) : undefined columns selected


Any advice on this would be greatly appreciated!! Driving me nuts!!
Thanks
-- 
Shane

[[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] problema en el manejo con fechas

2016-02-17 Thread Luisfo
Buenas,

El a�o en formato 4 cifras, tiene que ir con may�scula:
 lluv[,1] <- as.Date(lluv[,1], format="%m/%d/%Y")

Prueba a ver si te funciona ahora.

Un saludo,
Luisfo

On 02/17/2016 03:27 PM, eric wrote:
> buenas tardes comunidad, tengo un problema al transformar fechas que 
> estaban dentro de una hoja excel, fueron exportadas a .csv, importadas 
> en R mediante read.csv(), transformadas a caracter y luego a fecha, 
> este es el codigo que use:
>
> lluv <- read.csv("lluviasrelevantes1a�o.csv")
> lluv[,1] <- as.character(lluv[,1])
> lluv[,2] <- as.numeric(lluv[,2])
> lluv[,1] <- as.Date(lluv[,1], format="%m/%d/%y")
> summary(lluv)
>
> al mirar en los data.frames todos los a�os aparecen como 2020.
>
> Alguna idea como evitar esto ?
>
> Estoy interesado en calcular la diferencia en dias entre dos fechas y 
> algunas de ellas abarcan mas de un a�o, asi es que eso me produce 
> problemas.
>
> Que estoy haciendo mal ?
> como se hace correctamente ?
>
> Saludos y gracias.
>
> Eric.
>
>
> pd. adjunto archivo de datos
>
>
>
>
>
>
> ___
> 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] R 3.2.4 and 3.3.0

2016-02-17 Thread Peter Dalgaard
R 3.2.4 "Very Secure Dishes", the wrap-up release of R-3.2.x is now scheduled 
for March 10 
R 3.3.0 "Supposedly Educational", is scheduled for April 14.

Detailed schedules are published on developer.r-project.org.

For the Core Team 

Peter D.
-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

___
r-annou...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce

__
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 read DiCOM images using R?

2016-02-17 Thread Sarah Goslee
Searching for DICOM at www.rseek.org turns up a few options for
working with that image format.

But with no idea of what you want to do with them, we can't help with
the analysis. You will need to develop some clear objectives, do some
reading in how you might use R to accomplish those objectives, and
then if you get stuck you could come back here with clear ideas and
reproducible examples.

Best,
Sarah

On Tue, Feb 16, 2016 at 11:33 PM, vidu pranam  wrote:
> Hai,
>
>   I have some DICOM format images for my project. Can you please help me
> how can I read it by using R and how to analyse the images?
>
> Regards
> Vidu
>

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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] missing values in csv file

2016-02-17 Thread S Ellison
> Is it possible to get object where missing values aren't replaced with NAs?
Not with read.table, if they are really missing. But you can replace them later 
- see below - and if they are marked you can change what read.table considers 
to be 'missing'.

> Is it possible to replace NAs with empty space?
NA _is_ an 'empty space', in the sense of a correctly recorded missing value.

If you mean some other kind of empty space - perhaps the string "" - that's not 
missing, just empty (!).

But with a vector containing NA's, like
(  x <- c(NA, NA, letters[1:5]) )

you can do things like 

x[is.na(x)] <- "Empty Space"
x

or
x[is.na(x)] <- ""

S Ellison


***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] this is not a list, not a data frame, but what ?

2016-02-17 Thread PIKAL Petr
Hi

Seems to me that it is time for you to go through R intro. I do not remember 
myself using such weird construction.

mom["PC_Q_m3",]$value

You are lucky that you do not have duplicated values in your second column as 
in this case you would get error

Error in `row.names<-.data.frame`(`*tmp*`, value = value) :
  duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘adi’, ‘cg100’, ‘cg100mod’

I consider those preferable

mom["PC_Q_m3","value"]
mom[mom[,2]=="PC_Q_m3","value"]

but others may have different opinion.

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of MAURICE
> Jean - externe
> Sent: Wednesday, February 17, 2016 10:11 AM
> To: r-help@r-project.org
> Subject: Re: [R] this is not a list, not a data frame, but what ?
>
> I went further !
>
> I could give a name to each row based on column 2 in the read.table
> command and then access to the value by :
>
> mom["PC_Q_m3",]$value
>
> It’s great
> Jean
>
>
>
> Ce message et toutes les pièces jointes (ci-après le 'Message') sont
> établis à l'intention exclusive des destinataires et les informations
> qui y figurent sont strictement confidentielles. Toute utilisation de
> ce Message non conforme à sa destination, toute diffusion ou toute
> publication totale ou partielle, est interdite sauf autorisation
> expresse.
>
> Si vous n'êtes pas le destinataire de ce Message, il vous est interdit
> de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout
> ou partie. Si vous avez reçu ce Message par erreur, merci de le
> supprimer de votre système, ainsi que toutes ses copies, et de n'en
> garder aucune trace sur quelque support que ce soit. Nous vous
> remercions également d'en avertir immédiatement l'expéditeur par retour
> du message.
>
> Il est impossible de garantir que les communications par messagerie
> électronique arrivent en temps utile, sont sécurisées ou dénuées de
> toute erreur ou virus.
> 
>
> This message and any attachments (the 'Message') are intended solely
> for the addressees. The information contained in this Message is
> confidential. Any use of information contained in this Message not in
> accord with its purpose, any dissemination or disclosure, either whole
> or partial, is prohibited except formal approval.
>
> If you are not the addressee, you may not copy, forward, disclose or
> use any part of it. If you have received this message in error, please
> delete it and all copies from your system and notify the sender
> immediately by return message.
>
> E-mail communication cannot be guaranteed to be timely secure, error or
> virus-free.
>
>   [[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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused 

Re: [R] R Memory Issue

2016-02-17 Thread Sandeep Rana
Hi,
May be its reading your file and taking time which depends on size of the file 
that you are reading.
Please explore ‘data.table’ library to read big files in few seconds.

If you attempt to close the application while execution had been in progress 
for sometime it would take time most of the times.
Instead, end the r_session process from task manager which is immediate. 

Regards,
Sandeep S. Rana


> On 17-Feb-2016, at 2:46 PM, SHIVI BHATIA  wrote:
> 
> Dear Team,
> 
> 
> 
> Every now and then I face some weird issues with R. For instance it would
> not read my csv file or any other read.table command and once I would close
> the session and reopen again it works fine. 
> 
> 
> 
> It have tried using rm(list=ls()) & gc() to free some memory and restart R
> 
> 
> 
> 
> Also today while closing the R session it took more than 10 minutes. I am
> not sure as to what is leading to this. Kindly throw some light on this. Not
> sure if I have provided enough information.  
> 
> 
> 
> Thanks, Shivi
> 
> Mb: 9891002021
> 
> 
> 
> This e-mail is confidential. It may also be legally privileged. If you are 
> not the addressee you may not copy, forward, disclose or use any part of it. 
> If you have received this message in error, please delete it and all copies 
> from your system and notify the sender immediately by return e-mail. Internet 
> communications cannot be guaranteed to be timely, secure, error or 
> virus-free. The sender does not accept liability for any errors or omissions.
> __
> 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] missing values in csv file

2016-02-17 Thread Michael Dewey

Assuming it is a character variable

test <- c("a", NA, "b")
> test
[1] "a" NA  "b"
> test[is.na(test)] <- " "
> test
[1] "a" " " "b"

but if it is numeric this as, as others have said, almost certainly not 
what you really wanted to do


On 17/02/2016 10:04, Jan Kacaba wrote:

In my original data a csv file I have missing values. If I use read.table
the missing values are replaced by NAs.

Is it possible to get object where missing values aren't replaced with NAs?
Is it possible to replace NAs with empty space?

[[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.


Re: [R] R Memory Issue

2016-02-17 Thread PIKAL Petr
Hi

I have this enhanced ls function, which evaluates size of objects generated by 
myself or by other functions sitting in my environment.

ls.objects <- function (pos = 1, pattern, order.by)
{
napply <- function(names, fn) sapply(names, function(x) fn(get(x,
pos = pos)))
names <- ls(pos = pos, pattern = pattern)
obj.class <- napply(names, function(x) as.character(class(x))[1])
obj.mode <- napply(names, mode)
obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class)
obj.size <- napply(names, object.size)
obj.dim <- t(napply(names, function(x) as.numeric(dim(x))[1:2]))
vec <- is.na(obj.dim)[, 1] & (obj.type != "function")
obj.dim[vec, 1] <- napply(names, length)[vec]
out <- data.frame(obj.type, obj.size, obj.dim)
names(out) <- c("Type", "Size", "Rows", "Columns")
if (!missing(order.by))
out <- out[order(out[[order.by]]), ]
out
}

Lengthy R closing can be due to such big objects e.g. generated by strucchange 
functions.

However it may have another resons. Without more information from your side it 
would be difficult to bring definite answer.

Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of SHIVI
> BHATIA
> Sent: Wednesday, February 17, 2016 10:16 AM
> To: r-help@r-project.org
> Subject: [R] R Memory Issue
>
> Dear Team,
>
>
>
> Every now and then I face some weird issues with R. For instance it
> would not read my csv file or any other read.table command and once I
> would close the session and reopen again it works fine.
>
>
>
> It have tried using rm(list=ls()) & gc() to free some memory and
> restart R 
>
>
>
> Also today while closing the R session it took more than 10 minutes. I
> am not sure as to what is leading to this. Kindly throw some light on
> this. Not
> sure if I have provided enough information.
>
>
>
> Thanks, Shivi
>
> Mb: 9891002021
>
>



Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] missing values in csv file

2016-02-17 Thread PIKAL Petr
Beside of Adrian's answer, R can simply manage NAs but you need to deal with 
"empty space" on your own.

See

?is.na
?na.omit

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Adrian
> Du?a
> Sent: Wednesday, February 17, 2016 2:01 PM
> To: Jan Kacaba
> Cc: r-help@r-project.org
> Subject: Re: [R] missing values in csv file
>
> On Wed, Feb 17, 2016 at 12:04 PM, Jan Kacaba 
> wrote:
>
> > In my original data a csv file I have missing values. If I use
> > read.table the missing values are replaced by NAs.
> >
>
> That is the normal way of dealing with missing values, in R.
>
>
> Is it possible to get object where missing values aren't replaced with
> NAs?
> > Is it possible to replace NAs with empty space?
> >
>
> It is possible to replace the NAs with empty space, but nobody would
> recommend that because your variable will be coerced to a character
> mode.
> If the other values are numbers, you won't be able to compute any
> numerical measures.
> Try to accept that NA is there for a reason, in R.
>
> I hope this helps,
> Adrian
>
> --
> Adrian Dusa
> University of Bucharest
> Romanian Social Data Archive
> Soseaua Panduri nr.90
> 050663 Bucharest sector 5
> Romania
>
>   [[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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
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] Static to interactive map (leaflet spplot)

2016-02-17 Thread Adams, Jean
Deb,

I assume you have already seen the great introduction to leaflet here ...
http://rstudio.github.io/leaflet/

You may find these two answers on stackoverflow helpful ...

http://stackoverflow.com/a/28240058/2140956
http://stackoverflow.com/a/29118680/2140956


Jean

On Tue, Feb 2, 2016 at 5:28 PM, Debasish Pai Mazumder 
wrote:

> Hi ALL,
>
> I have a script to plot hexagonal polygon on a map. Its a static map. I
> used spplot. I would like to convert this plot to interactive plot using "
> *leaflet*". How do I make it interactive plot?
>
> Here is spplot lines:
>
> cl = map("world", xlim = c(-120, 20), ylim = c(-10, 70), plot = TRUE)
> cl = map("world",plot = TRUE)
> clp = map2SpatialLines(cl, proj4string = CRS(ll))
> clp = spTransform(clp, CRS(lcc))
> l2 = list("sp.lines", clp, col = "black", lty = 1, lwd = 3)
>
> cr = colorRampPalette(brewer.pal(9,"YlOrRd"))(100)
>
> require(grid)
> spplot(hspdf, "CDP", col = "white", col.regions = cr,
> sp.layout = list(l2),
> at = seq(0,100,10),
> sub = list("CDP", cex = 1.5, font = 2))
>
> where
> > hspdf
> class   : SpatialPolygonsDataFrame
> features: 95
> extent  : -4141330, 3748528, 1530846, 6914278  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=lcc +lat_1=60 +lat_2=30 +lon_0=-60 +ellps=WGS84
> variables   : 4
> names   : hexid, count, hct,   CDP
> min values  :37, 1,   1, 0.136612021857923
> max values  :   448, 7,   3,  39.4391854927413
>
> CDP values of each hexagonal polygon.
>
> -Deb
>
> [[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.


Re: [R] missing values in csv file

2016-02-17 Thread Adrian Dușa
On Wed, Feb 17, 2016 at 12:04 PM, Jan Kacaba  wrote:

> In my original data a csv file I have missing values. If I use read.table
> the missing values are replaced by NAs.
>

That is the normal way of dealing with missing values, in R.


Is it possible to get object where missing values aren't replaced with NAs?
> Is it possible to replace NAs with empty space?
>

It is possible to replace the NAs with empty space, but nobody would
recommend that because your variable will be coerced to a character mode.
If the other values are numbers, you won't be able to compute any numerical
measures.
Try to accept that NA is there for a reason, in R.

I hope this helps,
Adrian

-- 
Adrian Dusa
University of Bucharest
Romanian Social Data Archive
Soseaua Panduri nr.90
050663 Bucharest sector 5
Romania

[[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] this is not a list, not a data frame, but what ?

2016-02-17 Thread MAURICE Jean - externe
I went further !

I could give a name to each row based on column 2 in the read.table command and 
then access to the value by :

mom["PC_Q_m3",]$value

It’s great
Jean



Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à 
l'intention exclusive des destinataires et les informations qui y figurent sont 
strictement confidentielles. Toute utilisation de ce Message non conforme à sa 
destination, toute diffusion ou toute publication totale ou partielle, est 
interdite sauf autorisation expresse.

Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le 
copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si 
vous avez reçu ce Message par erreur, merci de le supprimer de votre système, 
ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support 
que ce soit. Nous vous remercions également d'en avertir immédiatement 
l'expéditeur par retour du message.

Il est impossible de garantir que les communications par messagerie 
électronique arrivent en temps utile, sont sécurisées ou dénuées de toute 
erreur ou virus.


This message and any attachments (the 'Message') are intended solely for the 
addressees. The information contained in this Message is confidential. Any use 
of information contained in this Message not in accord with its purpose, any 
dissemination or disclosure, either whole or partial, is prohibited except 
formal approval.

If you are not the addressee, you may not copy, forward, disclose or use any 
part of it. If you have received this message in error, please delete it and 
all copies from your system and notify the sender immediately by return message.

E-mail communication cannot be guaranteed to be timely secure, error or 
virus-free.

[[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 Memory Issue

2016-02-17 Thread SHIVI BHATIA
Dear Team,

 

Every now and then I face some weird issues with R. For instance it would
not read my csv file or any other read.table command and once I would close
the session and reopen again it works fine. 

 

It have tried using rm(list=ls()) & gc() to free some memory and restart R


 

Also today while closing the R session it took more than 10 minutes. I am
not sure as to what is leading to this. Kindly throw some light on this. Not
sure if I have provided enough information.  

 

Thanks, Shivi

Mb: 9891002021

 

This e-mail is confidential. It may also be legally privileged. If you are not 
the addressee you may not copy, forward, disclose or use any part of it. If you 
have received this message in error, please delete it and all copies from your 
system and notify the sender immediately by return e-mail. Internet 
communications cannot be guaranteed to be timely, secure, error or virus-free. 
The sender does not accept liability for any errors or omissions.
__
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] missing values in csv file

2016-02-17 Thread Jan Kacaba
In my original data a csv file I have missing values. If I use read.table
the missing values are replaced by NAs.

Is it possible to get object where missing values aren't replaced with NAs?
Is it possible to replace NAs with empty space?

[[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] this is not a list, not a data frame, but what ?

2016-02-17 Thread MAURICE Jean - externe
I need some more help !

Data.frame is working great but for one thing : once the file has been read, I 
can’t modify a ‘string’ column. This is, I suppose, because the column is a 
factor.

But I get an error when I write :
> mim = read.table(file = "GESDYN_COMPLET_parametres.txt", row.names = "clef", 
> stringAsFactors = FALSE)
Error in read.table(file = "GESDYN_COMPLET_parametres.txt", row.names = "clef", 
 :
  unused argument (stringAsFactors = FALSE)



Why ?
Jean





Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à 
l'intention exclusive des destinataires et les informations qui y figurent sont 
strictement confidentielles. Toute utilisation de ce Message non conforme à sa 
destination, toute diffusion ou toute publication totale ou partielle, est 
interdite sauf autorisation expresse.

Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le 
copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si 
vous avez reçu ce Message par erreur, merci de le supprimer de votre système, 
ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support 
que ce soit. Nous vous remercions également d'en avertir immédiatement 
l'expéditeur par retour du message.

Il est impossible de garantir que les communications par messagerie 
électronique arrivent en temps utile, sont sécurisées ou dénuées de toute 
erreur ou virus.


This message and any attachments (the 'Message') are intended solely for the 
addressees. The information contained in this Message is confidential. Any use 
of information contained in this Message not in accord with its purpose, any 
dissemination or disclosure, either whole or partial, is prohibited except 
formal approval.

If you are not the addressee, you may not copy, forward, disclose or use any 
part of it. If you have received this message in error, please delete it and 
all copies from your system and notify the sender immediately by return message.

E-mail communication cannot be guaranteed to be timely secure, error or 
virus-free.

[[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] Excluding "small data" from plot.

2016-02-17 Thread PIKAL Petr
Hi

There is probably better solution but I would aggregate

lll <- aggregate(ltrfreq$letterfreq, list(ltrfreq$letter, ltrfreq$type), sum)

order

ooo<-order(lll$x, decreasing=T)

split and sapply
lll<- lll[ooo,]
lll <- lapply(split(lll, lll$Group.2), head, 8)

and do.call rbind to get 8 letters for good and bad plotting.

lll<-do.call(rbind, lll)
library(ggplot2)
ggplot(lll,aes(x=Group.1,y=x, fill=Group.2), color=Group.2) +
+  stat_summary(fun.y=sum,position=position_dodge(),geom="bar")


Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kieran
> Sent: Wednesday, February 17, 2016 10:20 AM
> To: R-help@r-project.org
> Subject: [R] Excluding "small data" from plot.
>
> To R-help users:
>
> I want to use ggplot two plot summary statistics on the frequency of
> letters from
> a page of text. My data frame has four columns:
>
> (1) The line number [1 to 30]
> (2) The letter [a to z]
> (3) The frequency of the letter [assuming there is 80 letters per line]
> (4) The factor 'type': bad or good (purely artificial factor)
>
> I want to achieve the following plot:
>
> (a) Bar plot with an x-axis to be the letters and the y-axis the sum of
> 30 letter frequencies from each line of each letter.
> (b) Split each bar (for a letter) into two bars for 'good' and 'bad'
> types.
> (c) Display the union of the top 8 most frequency used letters for both
> types
> 'good' and 'bad'.
>
> By point (c) I mean: if a,e,f,h,i,t,s,r are the most frequent letter of
> type
> 'good' and a,e,f,h,i,m,l,p are the most frequent letter of type 'bad'.
> Then
> I would like my plot to feature the letters a,e,f,h,i,t,s,r,m,l,p.
>
> Here is my code:
>
> # There will be 30 lines and we want to record the frequency of each
> letter
> # on each line.
>
> lines <- c(rep(1:30, each=26))
> letter <- c(rep(letters, times=30))
>
> # We have taken the letter frequencies from
> # http://www.math.cornell.edu/~mec/2003-
> 2004/cryptography/subs/frequencies.html
>
> freq <- c(8.12, 1.49, 2.71, 4.32, 12.02, 2.30, 2.03, 5.92, 7.31, 0.10,
> 0.69,
> 3.98, 2.61, 6.95, 7.68, 1.82, 0.11, 6.02, 6.28, 9.10, 2.88, 1.11, 2.09,
> 0.17,
> 2.11, 0.07)
> freq <- freq/100
>
>
> # We assume each line contains 80 letters and change the seed for each
> line
> # for variability.
>
> letterfreq <- integer()
> for (i in 1:30) {
> set.seed(i)
> s<-data.frame(sample(letters, size = 80, replace = TRUE, prob =
> freq))
> names(s) <- "ltr"
> s$ltr <- factor(s$ltr, levels = letters)
> frq<-as.data.frame(table(s))
> letterfreq <- append(letterfreq, frq$Freq)
> }
>
> ltrfreq <- data.frame(lines, letter, letterfreq)
>
> # Add an artificial factor column _type_: good/bad. So each pair
> # (week, letter) has type 'good' or 'bad' with equal probability.
> # Set the seed for reproducibility.
>
> set.seed(999)
> ltrfreq$type <-  factor(sample(c("good","bad"), size = 780, replace =
> TRUE,
> prob = c(0.5,0.5)))
>
>
> # Here is the plot I want but this includes all 26 letters.
>
> ggplot(ltrfreq,aes(x=factor(letter),y=letterfreq, fill=type),
> color=type) +
>   stat_summary(fun.y=sum,position=position_dodge(),geom="bar")
>
> Best regards,
> Kieran.
>
> __
> 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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for 

Re: [R] this is not a list, not a data frame, but what ?

2016-02-17 Thread Ulrik Stervbo
Hi Jean,

the 'unused argument (stringAsFactors = FALSE)' gives you a good clue. It
tells you, that you are passing an unexpected argument to the read.table
function.

In this case the argument is stringsAsFactors (string in plural).

I don't know how you modify the columns, but the factors should not be the
reason why it doesn't work.

If your table have headers as hinted in the data.frame example, you should
include header = TRUE

Hope this helps
Ulrik

On Wed, 17 Feb 2016 at 12:01 MAURICE Jean - externe <
jean-externe.maur...@edf.fr> wrote:

> I need some more help !
>
>
>
> Data.frame is working great but for one thing : once the file has been
> read, I can’t modify a ‘string’ column. This is, I suppose, because the
> column is a factor.
>
>
>
> But I get an error when I write :
>
> > mim = read.table(file = "GESDYN_COMPLET_parametres.txt", row.names =
> "clef", stringAsFactors = FALSE)
>
> Error in read.table(file = "GESDYN_COMPLET_parametres.txt", row.names =
> "clef",  :
>
>   unused argument (stringAsFactors = FALSE)
>
> Why ?
>
> Jean
>
>
>
>
> Ce message et toutes les pièces jointes (ci-après le 'Message') sont
> établis à l'intention exclusive des destinataires et les informations qui y
> figurent sont strictement confidentielles. Toute utilisation de ce Message
> non conforme à sa destination, toute diffusion ou toute publication totale
> ou partielle, est interdite sauf autorisation expresse.
>
> Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de
> le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou
> partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de
> votre système, ainsi que toutes ses copies, et de n'en garder aucune trace
> sur quelque support que ce soit. Nous vous remercions également d'en
> avertir immédiatement l'expéditeur par retour du message.
>
> Il est impossible de garantir que les communications par messagerie
> électronique arrivent en temps utile, sont sécurisées ou dénuées de toute
> erreur ou virus.
> 
>
> This message and any attachments (the 'Message') are intended solely for
> the addressees. The information contained in this Message is confidential.
> Any use of information contained in this Message not in accord with its
> purpose, any dissemination or disclosure, either whole or partial, is
> prohibited except formal approval.
>
> If you are not the addressee, you may not copy, forward, disclose or use
> any part of it. If you have received this message in error, please delete
> it and all copies from your system and notify the sender immediately by
> return message.
>
> E-mail communication cannot be guaranteed to be timely secure, error or
> virus-free.
>

[[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] I Need Help for Location Model, etc

2016-02-17 Thread PIKAL Petr
Hi

You can use either search within CRAN or Task Views. Both can suggest 
appropriate packages. Do not expect that we can decide which function/package 
you shall use for your data.

I found among others:

https://cran.r-project.org/web/packages/mix/mix.pdf

but there are plenty of packages which state they compute location model. The 
same applies with misclassification.

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Moss
> Moss
> Sent: Wednesday, February 17, 2016 9:13 AM
> To: r-help@r-project.org
> Subject: [R] I Need Help for Location Model, etc
>
> I am working on "Discrimination and Classification Using Both Binary
> and Continuous Variables".
>
> Please, how can I use R-programming in running the following:
> (1) Location Model
> (2) Misclassification
> (3) Error Rate
> (4) Etc
>
> I have R i386 3.2.2 installed to in my system. How do I trace
> statistical tool like Location model, etc.
>
> Moses
>
> __
> 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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
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] Presentación y OFERTAS de Empleo

2016-02-17 Thread VICTORIA LOPEZ
Hola a todos,
Soy Victoria López y os escribo como vocal de la comunidad R-Hispano en
relaciones con empresas y empleo.
Me gustaría que todo interesado me enviara su cv a mi dirección de email:
vlo...@fdi.ucm.es o al correo: emp...@r-es.org
De momento, ha sido publicada hoy en el BOAM la convocatoria de la beca
para “metodologías innovadoras de Sistemas de Información en Prevención y
Promoción de la Salud”. El plazo de presentación de solicitudes es de 10
días naturales contados a partir del 12 de Febrero , (12 -22 febrero,
porque el 21 es domingo).

Os animo a contactar tanto a las empresas como a los candidatos.
Saludos


Victoria López
Facultad de Informática
Universidad Complutense de Madrid
www.victorialopez.es
www.ucm.es/victorialopez
vlo...@fdi.ucm.es
Despacho 309-Tel: 913947573
Movil: 629975771
Skype: victoria.juanas
@VictoriadeMates

-- Mensaje reenviado --
De: VICTORIA LOPEZ 
Fecha: 17 de febrero de 2016, 11:17
Asunto: OFERTAS de Empleo
Para: emp...@r-es.org


Hola a todos,
Soy Victoria López y os escribo como vocal de la comunidad R-Hispano en
relaciones con empresas y empleo.
Me gustaría que todo interesado me enviara su cv a mi dirección de email:
vlo...@fdi.ucm.es o al correo

Victoria López
Facultad de Informática
Universidad Complutense de Madrid
www.victorialopez.es
www.ucm.es/victorialopez
vlo...@fdi.ucm.es
Despacho 309-Tel: 913947573
Movil: 629975771
Skype: victoria.juanas
@VictoriadeMates


>

[[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] Updating github R packages

2016-02-17 Thread Hadley Wickham
It will be included in the next version of devtools - it's totally
do-able, but no one has done it yet.

Hadley

On Wed, Feb 17, 2016 at 6:44 PM, Jeff Newmiller
 wrote:
> AFAIK the answer is no. That would be one of the main drawbacks of depending 
> on github for packages. It isn't really a package repository so much as it is 
> a herd of cats.
> --
> Sent from my phone. Please excuse my brevity.
>
> On February 16, 2016 6:43:02 PM PST, "Hoji, Akihiko"  wrote:
>>Hi,
>>
>>Is there a way to update a R package and its dependencies,  installed
>>from the github repo by a simple command equivalent to
>>“update_packages()”?
>>
>>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.
>
> [[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.



-- 
http://hadley.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.

[R] Excluding "small data" from plot.

2016-02-17 Thread Kieran
To R-help users:

I want to use ggplot two plot summary statistics on the frequency of
letters from
a page of text. My data frame has four columns:

(1) The line number [1 to 30]
(2) The letter [a to z]
(3) The frequency of the letter [assuming there is 80 letters per line]
(4) The factor 'type': bad or good (purely artificial factor)

I want to achieve the following plot:

(a) Bar plot with an x-axis to be the letters and the y-axis the sum of
30 letter frequencies from each line of each letter.
(b) Split each bar (for a letter) into two bars for 'good' and 'bad' types.
(c) Display the union of the top 8 most frequency used letters for both types
'good' and 'bad'.

By point (c) I mean: if a,e,f,h,i,t,s,r are the most frequent letter of type
'good' and a,e,f,h,i,m,l,p are the most frequent letter of type 'bad'. Then
I would like my plot to feature the letters a,e,f,h,i,t,s,r,m,l,p.

Here is my code:

# There will be 30 lines and we want to record the frequency of each letter
# on each line.

lines <- c(rep(1:30, each=26))
letter <- c(rep(letters, times=30))

# We have taken the letter frequencies from
# http://www.math.cornell.edu/~mec/2003-2004/cryptography/subs/frequencies.html

freq <- c(8.12, 1.49, 2.71, 4.32, 12.02, 2.30, 2.03, 5.92, 7.31, 0.10, 0.69,
3.98, 2.61, 6.95, 7.68, 1.82, 0.11, 6.02, 6.28, 9.10, 2.88, 1.11, 2.09, 0.17,
2.11, 0.07)
freq <- freq/100


# We assume each line contains 80 letters and change the seed for each line
# for variability.

letterfreq <- integer()
for (i in 1:30) {
set.seed(i)
s<-data.frame(sample(letters, size = 80, replace = TRUE, prob = freq))
names(s) <- "ltr"
s$ltr <- factor(s$ltr, levels = letters)
frq<-as.data.frame(table(s))
letterfreq <- append(letterfreq, frq$Freq)
}

ltrfreq <- data.frame(lines, letter, letterfreq)

# Add an artificial factor column _type_: good/bad. So each pair
# (week, letter) has type 'good' or 'bad' with equal probability.
# Set the seed for reproducibility.

set.seed(999)
ltrfreq$type <-  factor(sample(c("good","bad"), size = 780, replace = TRUE,
prob = c(0.5,0.5)))


# Here is the plot I want but this includes all 26 letters.

ggplot(ltrfreq,aes(x=factor(letter),y=letterfreq, fill=type), color=type) +
  stat_summary(fun.y=sum,position=position_dodge(),geom="bar")

Best regards,
Kieran.

__
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] I Need Help for Location Model,

2016-02-17 Thread Bert Gunter
Pls always respond to the list, which I have cc'ed.

It sounds like you want us to teach you R and statistics. You need to do
this yourself, using local resources or available tutorials and courses on
the web. Some recommendations for this can be found here:

https://www.rstudio.com/resources/training/online-learning/#R

Bert




On Tuesday, February 16, 2016, Moss Moss  wrote:

> I want to generate data from a location model for my thesis.
> Please, what do you mean by "homework policy".
>
> Help me to run R-programming in my system.
>
> On 2/17/16, Bert Gunter > wrote:
> > Pls do not repeat posts. That's spam.
> >
> > This list has a no homework policy. Your query seems to be homework.
> Ergo,
> > you should not expect a response unless you clarify that it is not.
> >
> > Bert
> >
> >
> >
> > On Tuesday, February 16, 2016, Moss Moss  > wrote:
> >
> >> I am working on "Discrimination and Classification Using Both Binary
> >> and Continuous Variables".
> >>
> >> Please, how can I use R-programming in running the following:
> >> (1) Location Model
> >> (2) Misclassification
> >> (3) Error Rate
> >> (4) Etc
> >>
> >> I have R i386 3.2.2 installed to in my system. How do I trace
> >> statistical tool like Location model, etc.
> >>
> >> Moses
> >>
> >> __
> >> 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.
> >>
> >
> >
> > --
> > Bert Gunter
> >
> > "The trouble with having an open mind is that people keep coming along
> and
> > sticking things into it."
> > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> >
>


-- 
Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

[[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] I Need Help for Location Model,

2016-02-17 Thread Bert Gunter
Pls do not repeat posts. That's spam.

This list has a no homework policy. Your query seems to be homework. Ergo,
you should not expect a response unless you clarify that it is not.

Bert



On Tuesday, February 16, 2016, Moss Moss  wrote:

> I am working on "Discrimination and Classification Using Both Binary
> and Continuous Variables".
>
> Please, how can I use R-programming in running the following:
> (1) Location Model
> (2) Misclassification
> (3) Error Rate
> (4) Etc
>
> I have R i386 3.2.2 installed to in my system. How do I trace
> statistical tool like Location model, etc.
>
> Moses
>
> __
> 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.
>


-- 
Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

[[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] "predict" values from object of type "list"

2016-02-17 Thread Steve Ryan
Hi Guys,

I could need some help here. I have a set of 3d points (x,y,v). These
points are not randomly scattered but lie on a surface. This surface can be
taken as a calibration plane for x and y -values. My goal is to quantify
this surface and than predict the v-values for given pairs of x- and
y-coordinates.

This iscode shows how I started to solve this problem. First, I generate
more points between existing points using 3d-splines. That way I
"pre-smooth" my data set. After that I use interp to create even more
points and I end up with an object called "sp" (class "list"). sp is
visualized using surface3d. The surface looks like I wish it to be.

Now, how can I predict a x/y-pair of, say -2, 2 ??
Can somebody help?
Thanks a lot!

library(rgl)
library(akima)

v <- read.table(text="5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6
6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9
9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 11 11 11
11 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 12
12 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14
14 14 14 14 14 14 14", sep=" ")
v <- as.numeric(v)
x <- read.table(text="3.4 3.3 3.4 3.4 3.4 3.4 3.6 3.5 3.5 3.4 3.4 3.4 3.4
3.5 3.5 2.6 2.6 2.6 2.7 2.6 2.7 2.9 2.9 2.8 2.7 2.7 2.7 2.7 2.7 2.8 1.8 1.7
1.7 1.7 1.8 1.9 2.1 2.2 2.0 1.9 1.9 1.9 1.9 1.9 2.0 0.8 0.8 0.8 0.8 0.9 1.1
1.3 1.4 1.2 1.1 1.0 1.0 1.0 1.1 1.1 -0.2 -0.2 -0.2 -0.2 0.0 0.2 0.4 0.6 0.3
0.1 0.1 0.1 0.1 0.1 0.2 -1.2 -1.3 -1.3 -1.3 -1.1 -0.8 -0.5 -0.3 -0.6 -0.9
-0.9 -0.9 -0.9 -1.0 -0.9 -2.4 -2.6 -2.6 -2.5 -2.3 -2.0 -1.1 -1.2 -1.6 -2.0
-2.0 -2.0 -2.1 -2.2 -2.1 -3.9 -4.2 -4.3 -4.2 -3.9 -3.6 -2.5 -2.7 -3.3 -3.7
-3.7 -3.8 -3.8 -4.0 -3.9 -5.8 -6.1 -6.2 -6.1 -5.7 -5.3 -3.9 -4.1 -4.8 -5.3
-5.3 -5.3 -5.4 -5.5 -5.4 -7.5 -7.8 -8.0 -7.8 -7.4 -6.8 -5.1 -5.3 -6.1 -6.6
-6.7 -6.8 -6.9 -6.9 -6.9", sep=" ")
y <- read.table(text="0.5 0.6 0.6 0.7 0.7 0.8 0.8 0.9 0.9 1.0 1.0 1.1 1.1
1.2 1.2 0.5 0.5 0.6 0.7 0.8 0.9 0.9 1.0 1.1 1.1 1.2 1.3 1.4 1.4 1.5 0.4 0.5
0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 0.4 0.5 0.7 0.8 0.9 1.0
1.1 1.2 1.3 1.5 1.6 1.7 1.9 2.0 2.1 0.4 0.5 0.7 0.8 1.0 1.1 1.2 1.3 1.5 1.7
1.8 2.0 2.1 2.3 2.4 0.3 0.5 0.7 0.9 1.0 1.2 1.4 1.5 1.7 1.9 2.1 2.3 2.5 2.7
2.8 0.2 0.4 0.7 0.9 1.1 1.3 1.4 1.6 1.9 2.2 2.4 2.6 2.8 3.1 3.3 0.2 0.4 0.7
1.0 1.3 1.5 1.6 1.8 2.2 2.5 2.7 3.0 3.3 3.6 3.8 0.2 0.5 0.8 1.1 1.4 1.7 1.8
2.0 2.4 2.8 3.1 3.4 3.7 4.1 4.3 0.1 0.4 0.8 1.2 1.5 1.8 1.9 2.2 2.7 3.1 3.5
3.8 4.2 4.5 4.9", sep=" ")
x <- as.numeric(x)
y <- as.numeric(y)
z <- read.table(text="-35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 -35
-30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 -35 -30 -25 -20 -15 -10 -5 0 5
10 15 20 25 30 35 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 -35 -30
-25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 -35 -30 -25 -20 -15 -10 -5 0 5 10
15 20 25 30 35 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 -35 -30 -25
-20 -15 -10 -5 0 5 10 15 20 25 30 35 -35 -30 -25 -20 -15 -10 -5 0 5 10 15
20 25 30 35 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35", sep=" ")
z <- as.numeric(z)

df <- data.frame(x,y,z,v) #hier ist df die originale kali
plot3d(x,y,v)
all_dat <- c()

for (n in seq(min(z), max(z),5))
{
  blubb <- (which(df$z == n)) #hier werden gleiche winkel gesucht
  gleicheWink <- df[(blubb),]
  red_df <- data.frame(t=seq(1,length(gleicheWink[,1]),1), x =
gleicheWink$x, y= gleicheWink$y, v=gleicheWink$v )
  ts <- seq( from = min(red_df$t), max(red_df$t), length=50 )
  d2 <- apply( red_df[,-1], 2, function(u) spline(red_df$t, u, xout = ts
)$y )
  all_dat <- rbind(all_dat, d2)
}

x <- all_dat[,1]
y <- all_dat[,2]
z <- all_dat[,3]

sp <- interp(x,y,z,linear=TRUE, xo=seq(min(x),max(x), length=50),
 yo=seq(min(y),max(y), length=50), duplicate="mean")

open3d(scale=c(1/diff(range(x)),1/diff(range(y)),1/diff(range(z

zlen=5
cols <- heat.colors(zlen)

with(sp,surface3d(x,y,z, color=cols)) #,alpha=.2))
points3d(x,y,z)

title3d(xlab="x",ylab="y",zlab="v")
axes3d()

[[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] I Need Help for Location Model, etc

2016-02-17 Thread Moss Moss
I am working on "Discrimination and Classification Using Both Binary
and Continuous Variables".

Please, how can I use R-programming in running the following:
(1) Location Model
(2) Misclassification
(3) Error Rate
(4) Etc

I have R i386 3.2.2 installed to in my system. How do I trace
statistical tool like Location model, etc.

Moses

__
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] this is not a list, not a data frame, but what ?

2016-02-17 Thread MAURICE Jean - externe
Hi Ulrik and Rui,

Both solutions work but data.frame is the way i’ll go because there is an 
advantage that I was’nt aware at the beginning : we can save the data.frame in 
a text file, modify this file with notepad, …

Thank you very much
Jean



Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à 
l'intention exclusive des destinataires et les informations qui y figurent sont 
strictement confidentielles. Toute utilisation de ce Message non conforme à sa 
destination, toute diffusion ou toute publication totale ou partielle, est 
interdite sauf autorisation expresse.

Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le 
copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si 
vous avez reçu ce Message par erreur, merci de le supprimer de votre système, 
ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support 
que ce soit. Nous vous remercions également d'en avertir immédiatement 
l'expéditeur par retour du message.

Il est impossible de garantir que les communications par messagerie 
électronique arrivent en temps utile, sont sécurisées ou dénuées de toute 
erreur ou virus.


This message and any attachments (the 'Message') are intended solely for the 
addressees. The information contained in this Message is confidential. Any use 
of information contained in this Message not in accord with its purpose, any 
dissemination or disclosure, either whole or partial, is prohibited except 
formal approval.

If you are not the addressee, you may not copy, forward, disclose or use any 
part of it. If you have received this message in error, please delete it and 
all copies from your system and notify the sender immediately by return message.

E-mail communication cannot be guaranteed to be timely secure, error or 
virus-free.

[[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] How to read DiCOM images using R?

2016-02-17 Thread vidu pranam
Hai,

  I have some DICOM format images for my project. Can you please help me
how can I read it by using R and how to analyse the images?

Regards
Vidu

[[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] Constructing a symmetric matrix using library(corpcor)

2016-02-17 Thread Steven Yen
Hello

I am constructing a symmetric matrix with library "corpcor". In the
codes below, I am able to construct a symmetric matrix of order 3 and
4. However, the 5 x 5 matrix does not seem right? Help?

Thanks.


> library(corpcor)> r  <- 1:3> rr <- vec2sm(r, diag = F)> rr <- 
> rr[upper.tri(rr)]> r  <- vec2sm(rr, diag = F); diag(r) <- 1> r [,1] [,2] 
> [,3]
[1,]112
[2,]113
[3,]231> > r  <- 1:6> rr <- vec2sm(r, diag = F)> rr <-
rr[upper.tri(rr)]> r  <- vec2sm(rr, diag = F); diag(r) <- 1> r
[,1] [,2] [,3] [,4]
[1,]1124
[2,]1135
[3,]2316
[4,]4561> > r  <- 1:10> rr <- vec2sm(r, diag = F)> rr
<- rr[upper.tri(rr)]> r  <- vec2sm(rr, diag = F); diag(r) <- 1> r
[,1] [,2] [,3] [,4] [,5]
[1,]11253
[2,]11684
[3,]26179
[4,]5871   10
[5,]349   101

>

[[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] I Need Help for Location Model

2016-02-17 Thread Moss Moss
I am working on "Discrimination and Classification Using Both Binary
and Continuous Variables".

Please, how can I use R-programming in running the following:
(1) Location Model
(2) Misclassification
(3) Error Rate
(4) Etc

I have R i386 3.2.2 installed to in my system. How do I trace
statistical tool like Location model, etc.

Moses

__
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.