Re: [R] groups Rank

2015-09-07 Thread PIKAL Petr
Hi

OK, thanks for sending dput result.

I am still not sure what exactly you want. Using ?ave you can get result of 
x/max(x)

dat$prob <- ave(dat$value, paste(dat$id, dat$i), FUN= function(x) x/max(x))

however in case max(x) is zero the result is NA

You can change it to zero

dat$prob[is.nan(dat$prob)] <- 0

and compute rank value by similar process.

dat$rankvalue <- ave(dat$prob, paste(dat$id, dat$i), FUN = rank)

But I am not sure if this is the desired result.

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ragia
> Ibrahim
> Sent: Monday, September 07, 2015 10:12 AM
> To: Sarah Goslee; r-help@r-project.org
> Subject: Re: [R] groups Rank
>
> apology for re sending the Email, I changed the format to plain text as
> I have been advised the data  is as follow
>
> thanks Sarah,
> I used pdut, and here is the data as written on R..I attached the dput
> result structure(list(Measure_id = c(1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3,
> 3, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3,
> 3, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3), i = c(5, 5, 5, 5, 5, 5, 5, 5,
> 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7), j = c(1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
> 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5), id = c(1, 2,
> 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
> 11, 12), value = c(2, 1.5, 0, 0, 1, 0.5, 0, 0, 0, 0, 0.5, 2, 2, 1.5, 0,
> 1, 2, 0, 0.5, 1.44269504088896, 0, 0, 0, 0, 1, 1.5, 0, 0, 1, 0, 0, 0,
> 0, 0, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)), .Names =
> c("Measure_id", "i", "j", "id", "value"), row.names = c(NA, 48L), class
> = "data.frame")
>
> the data  is as follow  :
>
>Measure_id i j id value
> 1   1 5 1  1   2.0
> 2   1 5 2  1   2.0
> 3   1 5 1  2   1.5
> 4   1 5 2  2   1.5
> 5   1 5 1  3   0.0
> 6   1 5 2  3   0.0
> 7   1 5 1  4   0.0
> 8   1 5 2  4   1.0
> 9   1 5 1  5   1.0
> 10  1 5 2  5   2.0
> ..... . . ..   ...
> I want to add a probability column,  the prob column depends on id
> grouped by for each i the rank will be current (value / max value ) for
> the same id for specific i, it would be
>
>  Measure_id i j id valueprob
> 1   1 5 1  1   2.0  2/2
> 2   1 5 2  1   2.0  2/2
> 3   1 5 1  2   1.5  1.5/1.5
> 4   1 5 2  2   1.5  1.5/1.5
> 5   1 5 1  3   0.0  0
> 6   1 5 2  3   0.0  0
> 7   1 5 1  4   0.0  0/1
> 8   1 5 2  4   1.0  1/1
> 9   1 5 1  5   1.0  1/2
> 10  1 5 2  5   2.0  2/3
> ..... . . ..   ...
>
> then I want to add a rank column that rank regarding probability, if
> the probability equal they took the same rank for the same id belongs
> to the same i, otherwize lower probability took higher rank for examole
> if we have three values for i=7 and for the three values the id is 1
> and the probability is ( .2,.4,.5) the rank should be 3,2,1
>
>
>
> I looked at aggregate and dplyr...should I use for loop and subset each
> i and id rows do calculations and then group them again ??
> is there easier way?
>
> replying  highly appreciated
> >
> >
> >
> >> Date: Sun, 6 Sep 2015 19:02:02 -0400
> >> Subject: Re: [R] groups Rank
> >> From: sarah.gos...@gmail.com
> >> To: ragi...@hotmail.com
> >> CC: r-help@r-project.org
> >>
> >> Please use dput() to provide data, rather than expecting people to
> >> open random attachments. Besides, there are multiple options for
> >> getting data into R, and we need to know exactly what you did.
> dput()
> >> is faster and easier.
> >>
> >> What have you tried? Did you look at aggregate() as I suggested?
> >>
> >> Sarah
> >>
> >> On Sat, Sep 5, 2015 at 10:44 AM, Ragia Ibrahim 
> wrote:
> >>> thanks for replying, I attached the data frame for source "i" I
> want
> >>> to sum the values and get the max value then add a new column
> called
> >>> rank . That new column cell value for each source i and for
> specific
> >>> id would be (value/max value) * count of rows that have the same
> >>> criteria "same i and same id"
> >>>
> >>> many thanks
> >>> Ragia
> >>>
>  Date: Fri, 4 Sep 2015 10:19:35 -0400
>  Subject: Re: [R] groups Rank
>  From: sarah.gos...@gmail.com
>  To: ragi...@hotmail.com
>  CC: r-help@r-project.org
> 
>  Hi Ragia,
> 
>  I can't make out your data or desired result, but it sounds like
>  aggregate() might get you started. If you need more help, please
>  repost your data using dput() and do NOT post in HTML so that we
>  can see what your desired result looks like.
> 
>  Sarah
> 
>  On Fri, 

[R] scaling loess curves

2015-09-07 Thread Bogdan Tanasa
Dear all,

please could you advise about a method to scale 2 plots of LOESS curves.
More specifically, we do have 2 sets of 5C data, and the loess plots
reflect the relationship between INTENSITY and DISTANCE (please see the R
code below).

I am looking for a method/formula to scale these 2 LOESS plots and make
them directly comparable.

many thanks,

-- bogdan



-- the R code --



a <- read.delim("a",header=T)
qplot(data=a,distance,intensity)+geom_smooth(method = "loess", size = 1,
span=0.01)+xlab("distance")+ylab("intensity")



b <- read.delim("b",header=T)
qplot(data=b,distance,intensity)+geom_smooth(method = "loess", size = 1,
span=0.01)+xlab("distance")+ylab("intensity")

[[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] dplyr question

2015-09-07 Thread PIKAL Petr
Hi

Why do you post the same question without following Sarah's advice?

You can clearly see that due your HTML posting your data are terrible mess and 
we do not have slightest idea what you really want.

So again. Please copy to next mail result of

dput(head(df, 20))

and explain what shall be the result.

And change your mail client to post in plain text.

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ragia
> Ibrahim
> Sent: Sunday, September 06, 2015 7:41 PM
> To: r-help@r-project.org
> Subject: [R] dplyr question
>
> Dear group,
> I have the following data frame df
>
>Measure_id i j id value1   1 5 1  1   2.02   1 5 2
> 1   2.03   1 5 1  2   1.54   1 5 2  2   1.55
> 1 5 1  3   0.06   1 5 2  3   0.07   1 5 1  4   0.08
> 1 5 2  4   1.09   1 5 1  5   1.010  1 5 2  5   2.0..
> ... . . ..   ...I want to add a probability column,  the prob column
> depends on id grouped by for each ithe rank will be current (value /
> max value ) for the same id for specific i, it would be
>  Measure_id i j id valueprob1   1 5 1  1   2.0  2/2
> 2   1 5 2  1   2.0  2/2  3   1 5 1  2   1.5
> 1.5/1.5   4   1 5 2  2   1.5  1.5/1.5 5   1 5 1
> 3   0.0  06   1 5 2  3   0.0  07   1 5
> 1  4   0.0  0/1  8   1 5 2  4   1.0  1/1  9
> 1 5 1  5   1.0  1/210  1 5 2  5   2.0  2/3..
> ... . . ..   ...
> then I want to add a rank coulmn that rank regarding probability, if
> the probability equal they took the same rank for thesame id belongs to
> the same i, otherwize lower probability took higher rank for examole if
> we have three values for i=7 and for the three values the id is 1 and
> the probability is ( .2,.4,.5) the rank should be 3,2,1
> replying  highly appreciatedRagia
>   [[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 

Re: [R] groups Rank

2015-09-07 Thread Ragia Ibrahim
apology for re sending the Email, I changed the format to plain text as I have 
been advised
the data  is as follow  

thanks Sarah, 
I used pdut, and here is the data as written on R..I attached the dput result
structure(list(Measure_id = c(1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 
3, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 1, 2, 2, 2, 
3, 3, 3, 3, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3), i = c(5, 5, 
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 
5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 
7, 7, 7, 7), j = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 
3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5), id = c(1, 2, 3, 4, 5, 
6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 
9, 10, 11, 12), value = c(2, 1.5, 0, 0, 1, 0.5, 0, 0, 0, 0, 0.5, 
2, 2, 1.5, 0, 1, 2, 0, 0.5, 1.44269504088896, 0, 0, 0, 0, 1, 
1.5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 0, 
0, 0, 0)), .Names = c("Measure_id", "i", "j", "id", "value"), row.names = c(NA, 
48L), class = "data.frame")

the data  is as follow  :

   Measure_id i j id value
1           1 5 1  1   2.0
2           1 5 2  1   2.0
3           1 5 1  2   1.5
4           1 5 2  2   1.5
5           1 5 1  3   0.0
6           1 5 2  3   0.0
7           1 5 1  4   0.0
8           1 5 2  4   1.0
9           1 5 1  5   1.0
10          1 5 2  5   2.0
..        ... . . ..   ...
I want to add a probability column,  the prob column depends on id grouped by 
for each i
the rank will be current (value / max value ) for the same id for specific i, 
it would be

 Measure_id i j id value    prob
1           1 5 1  1   2.0          2/2  
2           1 5 2  1   2.0          2/2  
3           1 5 1  2   1.5          1.5/1.5   
4           1 5 2  2   1.5          1.5/1.5 
5           1 5 1  3   0.0          0
6           1 5 2  3   0.0          0
7           1 5 1  4   0.0          0/1  
8           1 5 2  4   1.0          1/1  
9           1 5 1  5   1.0          1/2
10          1 5 2  5   2.0          2/3
..        ... . . ..   ...

then I want to add a rank column that rank regarding probability, if the 
probability equal they took the same rank for the
same id belongs to the same i, otherwize lower probability took higher rank for 
examole if we have three values for i=7 and for the three values the id is 1 
and the probability is ( .2,.4,.5) the rank should be 3,2,1



I looked at aggregate and dplyr...should I use for loop and subset each i and 
id rows do calculations and then group them again ??
is there easier way?

replying  highly appreciated
> 
> 
> 
>> Date: Sun, 6 Sep 2015 19:02:02 -0400 
>> Subject: Re: [R] groups Rank 
>> From: sarah.gos...@gmail.com 
>> To: ragi...@hotmail.com 
>> CC: r-help@r-project.org 
>> 
>> Please use dput() to provide data, rather than expecting people to 
>> open random attachments. Besides, there are multiple options for 
>> getting data into R, and we need to know exactly what you did. dput() 
>> is faster and easier. 
>> 
>> What have you tried? Did you look at aggregate() as I suggested? 
>> 
>> Sarah 
>> 
>> On Sat, Sep 5, 2015 at 10:44 AM, Ragia Ibrahim  wrote: 
>>> thanks for replying, I attached the data frame 
>>> for source "i" I want to sum the values and get the max value then add a 
>>> new column called rank . That new column cell value for each source i and 
>>> for specific id would be (value/max value) * count of rows that have the 
>>> same criteria "same i and same id" 
>>> 
>>> many thanks 
>>> Ragia 
>>> 
 Date: Fri, 4 Sep 2015 10:19:35 -0400 
 Subject: Re: [R] groups Rank 
 From: sarah.gos...@gmail.com 
 To: ragi...@hotmail.com 
 CC: r-help@r-project.org 
 
 Hi Ragia, 
 
 I can't make out your data or desired result, but it sounds like 
 aggregate() might get you started. If you need more help, please 
 repost your data using dput() and do NOT post in HTML so that we can 
 see what your desired result looks like. 
 
 Sarah 
 
 On Fri, Sep 4, 2015 at 10:12 AM, Ragia Ibrahim  
 wrote: 
> Dear Group,kinldy, I have the following data frame df 
> id value1 1 4 2 1 4 3 1 6 4 1 6 5 2 1.5 6 2 2.5 7 2 2.5 8 2 2.5 
> 
> add rank column regarding id coulmn where rank for the highest value 
> would be 1, others rank would be the (value/ value of heighest)/ 
> number of 
> rows that took the same value 
> thus the data frame should be 
> id value Rank1 1 4 0.332 1 4 0.333 1 6 0.54 1 6 0.55 2 1.5 0.6 6 2 2.5 
> 0.337 2 2.5 0.338 2 2.5 0.33 
> 
> how to reach this resultthanks in advanceRagia 
> [[alternative HTML version deleted]] 
> 
  
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R-es] Añadir escala a un mapa

2015-09-07 Thread Francisco Rodriguez Sanchez
Hola Marcos,

échale un vistazo al paquete ggsn: 
https://cran.rstudio.com/web/packages/ggsn/ & 
http://oswaldosantos.github.io/ggsn/

Saludos

Paco

El 04/09/2015 a las 18:51, Marcos Bermejo escribió:
> Hola a tod@s,
>
> Este es el c�digo principal que utilizo para dise�ar mi zona de estudio 
> (cuenca):
>
> png("mapa_zona_estudio.png", units="in", width=9, height=8.5, res=300)
>
> # Vamos a pintar los distintos instrumentos de medida sobre el mapa (junto 
> con �ste) y a�adimos leyenda
> ggmap(mapa, extend='device', legend="left", base_layer=ggplot(datos, 
> aes(x=lon, y=lat))) +
>geom_point(data=datos, aes(shape = INSTRUMENTACI�N, color=INSTRUMENTACI�N, 
> fill=INSTRUMENTACI�N), size=7.5) +
>geom_text(data=coord.geog[1:7,], aes(x=coord.geog$lon[1:7], 
> y=coord.geog$lat[1:7], label=nombres.pluvio, hjust=0.2, vjust=1), size=5.2) +
>scale_shape_manual(values=c(21,24,22,23)) +
>geom_polygon(aes(x=long, y=lat, group=group), data=area.fort, 
> colour="black", fill="brown", alpha=0.15, size=0.5, linetype=5)
>
> dev.off()
>
>
> Mi duda es:
>
> �C�mo puedo a�adir una escala en km a esa imagen (mapa)?
>
> Gracias de antemano,
>
> Saludos,
>
> Marcos
>   
>   [[alternative HTML version deleted]]
>
>
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es

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


[[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] names in R list's

2015-09-07 Thread Witold E Wolski
What is the access time for R lists given a name of list element, is it
linear, log, or constant?

Than what are to rules for names in R-lists

That reusing names is possible makes me wonder.

tmp <- as.list(c(1,2,3,4))
names(tmp) = c("a","a","b","b")
tmp
tmp$a


What I am looking for is a standard R data structure which will allow me
for fast and name lookup.




-- 
Witold Eryk Wolski

[[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] Lag variable by group

2015-09-07 Thread Janka VANSCHOENWINKEL
Hi!

I have the following dataset with the variables ID (this is a unique ID per
farmer), year, and another variable t1.
I now would like to have a fourth variable which is the lag value of t1 for
each farm ID.

I found a code on the internet that does exactly what I need, but it does
not work for this dataset. Does anyone have suggestions about how I can
make this work?

Thanks a lot!

Janka

data<-structure(list(year = c(2007, 2005, 2008, 2006, 2005, 2007, 2006,
2008, 2007, 2005, 2007, 2007, 2005, 2006, 2005, 2006, 2005, 2006,
2007, 2007, 2005, 2008, 2007, 2008, 2005, 2005, 2006, 2008, 2007,
2007, 2008, 2008, 2006, 2005, 2007, 2006, 2008, 2008, 2007, 2007,
2007, 2006, 2006, 2008, 2006, 2008, 2008, 2008, 2006, 2007, 2008,
2007, 2005, 2007, 2008, 2005, 2007, 2005, 2005, 2008, 2005, 2006,
2005, 2006, 2008, 2006, 2008, 2006, 2007, 2006, 2005, 2008, 2006,
2007, 2008, 2006, 2006, 2006, 2005, 2008, 2006, 2008, 2006, 2006,
2006, 2007, 2008, 2005, 2007, 2006, 2007, 2008, 2006, 2008, 2005,
2007, 2005, 2007, 2006, 2006), id = c(28958L, 28962L,
28962L, 28965L, 28960L, 28962L, 28964L, 28970L, 28961L, 28965L,
78458L, 28960L, 28961L, 28961L, 28969L, 28962L, 28959L, 28959L,
58845L, 28965L, 28963L, 78459L, 28967L, 28957L, 28964L, 28966L,
28958L, 28960L, 28969L, 28959L, 28958L, 28969L, 58845L, 28958L,
28954L, 28963L, 78458L, 28965L, 28966L, 28963L, 28970L, 28970L,
28960L, 28959L, 28954L, 28954L, 58845L, 28967L, 28966L, 78459L,
28956L, 28964L, 28956L, 28957L, 28961L, 28970L, 28968L, 28954L,
28955L, 28968L, 28968L, 28967L, 28967L, 28957L, 28966L, 28956L,
28964L, 28969L, 28955L, 28955L, 28957L, 28955L, 28968L, 28956L,
28963L, 29004L, 58848L, 29005L, 28974L, 29005L, 28974L, 29006L,
28981L, 29007L, 29002L, 28980L, 29001L, 29006L, 29005L, 28989L,
28989L, 58846L, 28980L, 28981L, 78467L, 28990L, 28973L, 29004L,
28972L, 29006L), t1 = c(-1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.81807494163513, -1.81807494163513, -1.81807494163513,
-1.81807494163513, -1.43884992599487, -1.43884992599487, -1.43884992599487,
-1.43884992599487, -1.43884992599487, -1.43884992599487, -1.43884992599487,
-1.43884992599487, -1.43884992599487, -1.43884992599487, -1.43884992599487,
-1.43884992599487, -1.43884992599487, -1.43884992599487, -1.43884992599487,
-1.43884992599487, -1.43884992599487, -1.43884992599487, -1.43884992599487,
-1.43884992599487, -1.43884992599487, -1.43884992599487, -1.43884992599487,
-1.43884992599487, -1.43884992599487)), .Names = c("year", "id",
"t1"), row.names = c(NA, 100L), class = "data.frame")

library(data.table)
data[, lag.t1:=c(NA, t1[-.N]), by=id]


Thank you very much!

Janka

[[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] get data from pl sql block

2015-09-07 Thread Diaz Garcia, Luis Carlos
Hello all

last week I create a script with R
This script connect to Oracle database and retreave some data.

This is a sample of the code

dbName <- sqlQuery(con, "SELECT instance_name, host_name from 
v$instance",errors=FALSE)
title (main = paste0("Mapa de los dblinks del entorno: ", dbName$INSTANCE_NAME, 
"_", 
   dbName$HOST_NAME),sub="Luis Diaz - Emergencies & improvments")

This code works fine, but now I need to get data from a pl sql block, such like 
this:

DECLARE
v_result number;

BEGIN
EXECUTE IMMEDIATE 'select count(1) from dual@db_link'';
v_result:=0; 
DBMS_OUTPUT.PUT_LINE(v_result);

EXCEPTION 
WHEN OTHERS THEN 
v_result:=1; 
DBMS_OUTPUT.PUT_LINE(v_result);

END; 
/

This code return 0 if the db link works and 1 if not...
I try tis way:

isDead <- sqlQuery(con,"
set serveroutput on
DECLARE
v_result number;

BEGIN
EXECUTE IMMEDIATE 'select count(1) from dual@DB_LINK';
v_result:=0; 
EXCEPTION 
WHEN OTHERS THEN 
v_result:=1; 
END; 
/
", errors=FALSE)
print(isDead)

The result of this isDead variable is always : -1
I expect a value 0 or 1 depending of the db link result.
Do you have any idea ?

Thanks a los


Tecnocom
Luis Diaz
Arquitecto Bases de Datos Oracle
Email: luis.d...@tecnocom.es
http://www.tecnocom.es

__
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] split.screen to draw graphs - ggplot2 and lattice (can't slip in 4 cells)

2015-09-07 Thread Jim Lemon
Hi Rosa,
I think all you need is the split.screen commands but this will show you
where each screen number is located:

split.screen(figs=matrix(c(0,0.8,0,1,0.8,1,0,1),ncol=4,byrow=TRUE))
split.screen(figs=matrix(c(0,0.5,0.5,1,0.5,1,0.5,1,0,0.5,0,0.5,0.5,1,0,0.5),
 ncol=4,byrow=TRUE),screen=1)
screen(3)
plot(0:1,0:1,type="n",xlab="",ylab="",axes=FALSE)
box()
text(0.5,0.5,3)
screen(4)
plot(0:1,0:1,type="n",xlab="",ylab="",axes=FALSE)
box()
text(0.5,0.5,4)
screen(5)
plot(0:1,0:1,type="n",xlab="",ylab="",axes=FALSE)
box()
text(0.5,0.5,5)
screen(6)
plot(0:1,0:1,type="n",xlab="",ylab="",axes=FALSE)
box()
text(0.5,0.5,6)
screen(2)
plot(0:1,0:1,type="n",xlab="",ylab="",axes=FALSE)
box()
text(0.5,0.5,2)
close.screen(all=TRUE)

I used width=10,height=6 in the device call.

Jim

On Mon, Sep 7, 2015 at 12:06 AM, Rosa Oliveira  wrote:

> Dear all,
>
>
>
> I need your urgent help J
>
>
>
> I’m naïve, and I’m pretty sure my doubt is very simple to solve, but I’m
> not getting it.
>
>
>
> I used the following code to produce my research graphs, nonetheless, is
> this problem, I do not have 6 graphs (1 – 6),
>
>
>
> #   3   4   5
>
> #2
>
> #   6   7   8
>
>
>
>
>
> but only 4,instead.  So, I need to reformulate the code, just to
>
>
>
> #   3   4
>
> #2
>
> #   6   7
>
>
>
> Can you please help me reformulating?
>
> I suppose I have to change something in the split.screen code, because
> nowadays, my “third” column is blank J
>
>
>
>
>
> I attach the code:
>
>
>
> library(ggplot2)
>
> library(reshape)
>
> library(lattice)
>
>
>
> mean.alpha1<-read.csv("graphs_mean_alpha1.csv")
>
> mean.alpha2<-read.csv("graphs_mean_alpha2.csv")
>
> quartz(width=10,height=5)
>
> split.screen(figs=matrix(c(0,0.4,0.5,1,
>
>0.4,0.7,0.5,1,
>
>0.7,1,0.5,1,
>
>0,0.4,0,0.5,
>
>0.4,0.7,0,0.5,
>
>0.7,1,0,0.5),nrow=6,byrow=TRUE),
>
>  screen=1)
>
>
>
>
>
>
>
> screen(3)
>
> par(mar=c(0,3.5,3,0))
>
> # now the second set
>
> n250<-mean.alpha1$nsample==250
>
> matplot(x=mean.alpha1$lambda[n250],y=mean.alpha1[n250,3:5],
>
> type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(-1.2,
> -0.25),main="nsample=250",ylab="", cex.main=1)
>
> abline(h = -1, col = "gray60")
>
> mtext(expression(paste("mean av. for  ",alpha[1])),side=2,line=2,
> cex.main=1)
>
>
>
>
>
>
>
> screen(4)
>
> par(mar=c(0,0,3,0))
>
> # now the second set
>
> n250<-mean.alpha1$nsample==1000
>
> matplot(x=mean.alpha1$lambda[n1000],y=mean.alpha2[n1000,3:5],
>
> type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-1.2,
> -0.25),main="nsample=1000", cex.main=1)
>
> abline(h = -1, col = "gray60")
>
>
>
>
>
>
>
> screen(6)
>
> par(mar=c(3,3.5,0,0))
>
> # now the second set
>
> n250<-mean.alpha2$nsample==250
>
> matplot(x=mean.alpha2$lambda[n250],y=mean.alpha2[n250,3:5],
>
> type="l",pch=1:3,col=c(4,2,3),ylim=c(-.6, -.35),ylab="")
>
> abline(h = -.5, col = "gray60")
>
> mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
>
> mtext(expression(paste("mean av. for  ",alpha[2])),side=2,line=2,
> cex.main=1.5)
>
>
>
>
>
>
>
> screen(7)
>
> par(mar=c(3,0,0,0))
>
> # now the second set
>
> n1000<-mean.alpha2$nsample==1000
>
> matplot(x=mean.alpha2$lambda[n1000],y=mean.alpha2[n1000,3:5],
>
> type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(-.6, -.35))
>
> abline(h = -.5, col = "gray60")
>
> mtext(expression(paste(lambda)),side=1,line=2, , cex.main=1.5)
>
>
>
>
>
> screen(2)
>
> par(mar=c(0,0,0,0))
>
> # plot an empty plot to get the coordinates
>
> plot(0:1,0:1,type="n",axes=FALSE)
>
> legend(0,0.6,c("OLS", "GLS", "Reg. Cal.", "true coefficient"),bty = "n",
> lty=1:3,col=c(4,2,3,"gray60"),xpd=TRUE)
>
>
>
>
>
> close.screen(all=TRUE)
>
>
>
>
>
> BEST,
>
> RO
>
>
>
>
>
> Atenciosamente,
> Rosa Oliveira
>
> --
>
> 
>
>
> Rosa Celeste dos Santos Oliveira,
>
> E-mail: rosit...@gmail.com
> Tlm: +351 939355143
> Linkedin: https://pt.linkedin.com/in/rosacsoliveira
>
> 
> "Many admire, few know"
> Hippocrates
>
> __
> 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] [R-pkgs] nhanesA - easy retrieval and import of NHANES data

2015-09-07 Thread Christopher Endres
Dear R enthusiasts, I would like to announce nhanesA, a package that
enables easy retrieval of the data tables that are available at the
National Health and Nutritional Examination Survey (NHANES).
NHANES data are used in over 10,000 peer-reviewed journal publications
every year. In addition to easy table download, nhanesA features several
functions that implement web scraping (using rvest) to display table names,
table variables, and table code translations.
For more information, Here's a link to the package:
https://cran.r-project.ohg/web/packages/nhanesA/

install.packages("nhanesA") will get you started.

Hopefully it will be useful for clinical research and general data
exploration.

Sincerely,
Christopher Endres

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


[R] Help

2015-09-07 Thread Sofia Saldanha
Hi,
I started using R recently and everything was going perfect until I stoped
seeing my output results in the R console.
Now, instead of showing ">" on the console before the command, it shows
"+". It doesn't even close the program now. I'm using the 64bit 3.2.2
version.
E.g.:
+ 1
+ q()

Thanks!

[[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] values in date format from .xls as label on x-line

2015-09-07 Thread PIKAL Petr
Hi

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
> rbalasus
> Sent: Monday, September 07, 2015 1:19 PM
> To: r-help@r-project.org
> Subject: [R] values in date format from .xls as label on x-line
>
>
> hello , I am very new to R, till now I was working with lineplots
> reading their data from .xls files. All was working as expected, now I
> want to label the data-values with "date"-values on the x line. But I
> have absolute no clue how to read and interprete these values as date-
> values not just only integer, I was testing and searching solutions
> with the convert function. I hop I just  need only one or two
> modifications in my code, and all is working. Any Ideas?
>
>
> this is my testcode, and the example values in the .xls, (with integer
> values, all is working correctly.)
>
>
> textcode.r
> require(XLConnect)
> wb = loadWorkbook("C:/xlsfile.xls")
> impdata = readWorksheet(wb, sheet = "Data", header = TRUE)
> datec(c)  <- as.Date(impdata$date, "%d.%m.%y")
^^^
What is this? If you meant

datec  <- as.Date(impdata$date, "%d.%m.%y")

datec shall be class Date, you can check it by

class(datec)

Maybe there shall be class mentioned on help page for mode and/or typeof  in 
See Also section.

As you did not provide any data here is toy example

datum <- structure(c(16359, 16361, 16362, 16363, 16364, 16365, 16366,
16367, 16368), class = "Date")

plot(datum, 1:9)

gives you a plot with x axes labeled by date. You can change format of x axis

plot(datum, 1:9, format="%d.%m.")

which gives you expected formatting although it issues set of warnings. I did 
not found any plotting method for Date class although it (probably) works as 
expected.

Cheers
Petr

> plot(datec,impdata$amount, main="amount year to date",type="n",
> ylab="Eur",
> xlab="year to date",ylim=c(1,6000))
> lines(datec,impdata$amountmount, col = "steelblue")
>
> xls-file
> dateamount
> 30.01.2015  1000
> 30.02.2015  2000
> 15.03.2015  2800
>
> THANX in advance for your help.
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/values-in-
> date-format-from-xls-as-label-on-x-line-tp4711949.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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 

Re: [R] get data from pl sql block

2015-09-07 Thread Jeff Newmiller
You will get better answers on the R-sig-db mailing list.


You don't say which package you are using, but I don't think RODBC supports 
non-SELECT statements.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On September 7, 2015 2:30:36 AM PDT, "Diaz Garcia, Luis Carlos" 
 wrote:
>Hello all
>
>last week I create a script with R
>This script connect to Oracle database and retreave some data.
>
>This is a sample of the code
>
>dbName <- sqlQuery(con, "SELECT instance_name, host_name from
>v$instance",errors=FALSE)
>title (main = paste0("Mapa de los dblinks del entorno: ",
>dbName$INSTANCE_NAME, "_", 
>   dbName$HOST_NAME),sub="Luis Diaz - Emergencies & improvments")
>
>This code works fine, but now I need to get data from a pl sql block,
>such like this:
>
>   DECLARE
>   v_result number;
>
>   BEGIN
>   EXECUTE IMMEDIATE 'select count(1) from dual@db_link'';
>   v_result:=0; 
>   DBMS_OUTPUT.PUT_LINE(v_result);
>   
>   EXCEPTION 
>   WHEN OTHERS THEN 
>   v_result:=1; 
>   DBMS_OUTPUT.PUT_LINE(v_result);
>
>   END; 
>/
>
>This code return 0 if the db link works and 1 if not...
>I try tis way:
>
>isDead <- sqlQuery(con,"
>   set serveroutput on
>   DECLARE
>   v_result number;
>
>   BEGIN
>   EXECUTE IMMEDIATE 'select count(1) from dual@DB_LINK';
>   v_result:=0; 
>   EXCEPTION 
>   WHEN OTHERS THEN 
>   v_result:=1; 
>END; 
>/
>", errors=FALSE)
>print(isDead)
>
>The result of this isDead variable is always : -1
>I expect a value 0 or 1 depending of the db link result.
>Do you have any idea ?
>
>Thanks a los
>
>
>Tecnocom
>Luis Diaz
>Arquitecto Bases de Datos Oracle
>Email: luis.d...@tecnocom.es
>http://www.tecnocom.es
>
>__
>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] Help

2015-09-07 Thread Dan D
press ESC.

You may have entered a command that was missing a parenthesis or something
else that R needs before it can make sense out of your code (e.g., entering
"sum(X" without the closing paren will give you that pattern). ESC brings
back the command line and you can try again.

-Dan 



--
View this message in context: 
http://r.789695.n4.nabble.com/Help-tp4711952p4711960.html
Sent from the R help mailing list archive at Nabble.com.

__
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] values in date format from .xls as label on x-line

2015-09-07 Thread rbalasus

hello , I am very new to R, till now I was working with lineplots reading
their data from .xls files. All was working as expected, 
now I want to label the data-values with "date"-values on the x line. But I
have absolute no clue how to read and interprete these values as date-values
not just only integer, I was testing and searching solutions with the
convert function. I hop I just  need only one or two modifications in my
code, and all is working. Any Ideas?


this is my testcode, and the example values in the .xls, (with integer
values, all is working correctly.)


textcode.r
require(XLConnect)
wb = loadWorkbook("C:/xlsfile.xls")
impdata = readWorksheet(wb, sheet = "Data", header = TRUE)
datec(c)  <- as.Date(impdata$date, "%d.%m.%y")
plot(datec,impdata$amount, main="amount year to date",type="n", ylab="Eur",
xlab="year to date",ylim=c(1,6000))
lines(datec,impdata$amountmount, col = "steelblue")

xls-file
dateamount
30.01.2015  1000
30.02.2015  2000
15.03.2015  2800

THANX in advance for your help.





--
View this message in context: 
http://r.789695.n4.nabble.com/values-in-date-format-from-xls-as-label-on-x-line-tp4711949.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Maxent package - Restriction on number of unique class labels

2015-09-07 Thread Susrutha Gongalla
Hi everyone,

I am developing a text classification code in R using 'maxent' package. I
see that there is a limit on number of unique class labels that can be
modeled, which is 255. Can someone please help me understand why this limit
is present?
The data I am working on has about 400 labels (data consists of thousands
of records). Can anybody please suggest which package to use to be able to
achieve maximum entropy based text classification on this?
I have tried using 'RTextTools' package as well. It seems to be internally
using 'maxent' package in return and  gives me the same error.

Would really appreciate any help!

Thanks.

Susrutha Gongalla

[[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] names in R list's

2015-09-07 Thread Jeff Newmiller
You puzzle me. Why does someone who cannot figure out how to post an email in 
plain text after so many messages on this mailing list get all worried about 
access time for string indexing?

Environment objects have those properties. They do not solve all problems 
though, because they are rather heavyweight... you need a lot of lookups to pay 
for their overhead. R5 objects and the hash package both use them, but I have 
never found three need to use them. Yes, I do program in Perl so I know where 
you are coming from, but the vector-based name lookup used in R works quite 
effectively for data where the number of list items is short or where I plan to 
access every element as part of my data processing anyway.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On September 7, 2015 3:34:53 AM PDT, Witold E Wolski  wrote:
>What is the access time for R lists given a name of list element, is it
>linear, log, or constant?
>
>Than what are to rules for names in R-lists
>
>That reusing names is possible makes me wonder.
>
>tmp <- as.list(c(1,2,3,4))
>names(tmp) = c("a","a","b","b")
>tmp
>tmp$a
>
>
>What I am looking for is a standard R data structure which will allow
>me
>for fast and name lookup.

__
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] names in R list's

2015-09-07 Thread Barry Rowlingson
On Mon, Sep 7, 2015 at 11:34 AM, Witold E Wolski  wrote:
> What is the access time for R lists given a name of list element, is it
> linear, log, or constant?

 Try it and see?

> Than what are to rules for names in R-lists
>
> That reusing names is possible makes me wonder.
>
> tmp <- as.list(c(1,2,3,4))
> names(tmp) = c("a","a","b","b")
> tmp
> tmp$a
>
>
> What I am looking for is a standard R data structure which will allow me
> for fast and name lookup.

 Depends what you mean by "standard"?

 There's a `hash` package that implements what are variously known as
hash tables or associative arrays (in perl) and dictionaries (in
Python)

 > require(hash)
 > z=hash("a",99)
 > z
 containing 1 key-value pair(s).
  a : 99
 > z$b=123

There's no ordering so numeric indexing fails:

 > z[1]
Error in get(k, x) : invalid first argument
 > z[[1]]
Error in z[[1]] : wrong arguments for subsetting an environment
 > z
 containing 2 key-value pair(s).
  a : 99
  b : 123

and the keys are unique, even if you try:

 > z=hash(c("a","b","b","c"), 1:4)
 > z
  containing 3 key-value pair(s).
  a : 1
  b : 3
  c : 4

I guess the lookup uses the usual fast hash lookup algorithms, but
you'd have to check the docs and source for details.

Barry

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


Re: [R] Help

2015-09-07 Thread PIKAL Petr
Hi

You probably already found what is wrong. You entered syntactically correct 
expression but without proper closing part. R expects this closing part of an 
expression. You can stop it by menu Misc/Stop all computation or simply 
pressing ESC.

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Sofia
> Saldanha
> Sent: Monday, September 07, 2015 12:37 PM
> To: r-help@r-project.org
> Subject: [R] Help
>
> Hi,
> I started using R recently and everything was going perfect until I
> stoped seeing my output results in the R console.
> Now, instead of showing ">" on the console before the command, it shows
> "+". It doesn't even close the program now. I'm using the 64bit 3.2.2
> version.
> E.g.:
> + 1
> + q()
>
> Thanks!
>
>   [[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] get data from pl sql block

2015-09-07 Thread Diaz Garcia, Luis Carlos
Hi Jeff
yes I use RODBC, and I think you're write... Only "select" statments... I have 
a solution I think.
When I'll be sure, I'll share the info into the list.

Thanks a lot !


Tecnocom
Luis Diaz
Arquitecto Bases de Datos Oracle
Email: luis.d...@tecnocom.es
http://www.tecnocom.es


De: Jeff Newmiller [jdnew...@dcn.davis.ca.us]
Enviado: lunes, 7 de septiembre de 2015 16:53
Para: Diaz Garcia, Luis Carlos; R-help@r-project.org
Asunto: Re: [R] get data from pl sql block

You will get better answers on the R-sig-db mailing list.


You don't say which package you are using, but I don't think RODBC supports 
non-SELECT statements.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity.

On September 7, 2015 2:30:36 AM PDT, "Diaz Garcia, Luis Carlos" 
 wrote:
>Hello all
>
>last week I create a script with R
>This script connect to Oracle database and retreave some data.
>
>This is a sample of the code
>
>dbName <- sqlQuery(con, "SELECT instance_name, host_name from
>v$instance",errors=FALSE)
>title (main = paste0("Mapa de los dblinks del entorno: ",
>dbName$INSTANCE_NAME, "_",
>   dbName$HOST_NAME),sub="Luis Diaz - Emergencies & improvments")
>
>This code works fine, but now I need to get data from a pl sql block,
>such like this:
>
>   DECLARE
>   v_result number;
>
>   BEGIN
>   EXECUTE IMMEDIATE 'select count(1) from dual@db_link'';
>   v_result:=0;
>   DBMS_OUTPUT.PUT_LINE(v_result);
>
>   EXCEPTION
>   WHEN OTHERS THEN
>   v_result:=1;
>   DBMS_OUTPUT.PUT_LINE(v_result);
>
>   END;
>/
>
>This code return 0 if the db link works and 1 if not...
>I try tis way:
>
>isDead <- sqlQuery(con,"
>   set serveroutput on
>   DECLARE
>   v_result number;
>
>   BEGIN
>   EXECUTE IMMEDIATE 'select count(1) from dual@DB_LINK';
>   v_result:=0;
>   EXCEPTION
>   WHEN OTHERS THEN
>   v_result:=1;
>END;
>/
>", errors=FALSE)
>print(isDead)
>
>The result of this isDead variable is always : -1
>I expect a value 0 or 1 depending of the db link result.
>Do you have any idea ?
>
>Thanks a los
>
>
>Tecnocom
>Luis Diaz
>Arquitecto Bases de Datos Oracle
>Email: luis.d...@tecnocom.es
>http://www.tecnocom.es
>
>__
>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] extracting every nth character from a string...

2015-09-07 Thread David L Carlson
No rex, but not much less complicated, than your original but a different 
approach:

> i <- seq(1, nchar(str), 2)
> paste0(mapply(substr, str, i, i), collapse="")
[1] "ACEG"

-
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Gabor 
Grothendieck
Sent: Sunday, September 6, 2015 10:27 AM
To: Evan Cooch
Cc: r-help@r-project.org
Subject: Re: [R] extracting every nth character from a string...

This uses a regular expression but is shorter:

> gsub("(.).", "\\1", "ABCDEFG")
[1] "ACEG"

It replaces each successive pair of characters with the first of that
pair.  If there is an odd number of characters then the last character is
not matched and therefore kept -- thus it works properly for both even and
odd.


On Sat, Sep 5, 2015 at 4:59 PM, Evan Cooch  wrote:

> Suppose I had the following string, which has length of integer multiple
> of some value n. So, say n=2, and the example string has a length of  (2x4)
> = 8 characters.
>
> str <- "ABCDEFGH"
>
> What I'm trying to figure out is a simple, base-R coded way (which I
> heuristically call StrSubset in the following) to extract every nth
> character from the string, to generate a new string.
>
> So
>
> str <- "ABCDEFGH"
>
> new_str <- StrSubset(str);
>
> print(new_str)
>
> which would yield
>
> "ACEG"
>
>
> Best I could come up with is something like the following, where I extract
> every odd character from the string:
>
> StrSubset <- function(string)
>   {
> paste(unlist(strsplit(string,""))[seq(1,nchar(string),2)],collapse="") }
>
>
> Anything more elegant come to mind? Trying to avoid regex if possible
> (harder to explain to end-users), but if that meets the 'more elegant'
> sniff test, happy to consider...
>
> Thanks in advance...
>
> __
> 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.
>



-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

[[alternative HTML version deleted]]

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

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


Re: [R] extracting every nth character from a string...

2015-09-07 Thread Dan D
# or:
strsplit("junk",split=NULL)[[1]][(1:nchar("junk"))%%2==1]
strsplit("junk",split=NULL)[[1]][(1:nchar("junk"))%%2==0]





--
View this message in context: 
http://r.789695.n4.nabble.com/extracting-every-nth-character-from-a-string-tp4711908p4711962.html
Sent from the R help mailing list archive at Nabble.com.

__
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] extracting every nth character from a string...

2015-09-07 Thread Dan D
# as a complete function
StrSubset<-function(junk,n){
   ifelse(n==1,junk,
paste(strsplit(junk,split=NULL)[[1]][(1:nchar(junk))%%n==1],collapse=''))
}




--
View this message in context: 
http://r.789695.n4.nabble.com/extracting-every-nth-character-from-a-string-tp4711908p4711963.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Is there a time series resampling function ?

2015-09-07 Thread AltShift

If
Jeff Newmiller wrote
> There are lots of them. You might be having trouble searching because you
> don't know how to spell "interpolate". 

Hi Jeff,

If you re-read my original post you will see the word interpolate, spelled
correctly. I also used the made-up word "intrapolate" (I thought that using
quotes in the post would make this obvious) because I am describing a
process that is complementary to interpolation. 

My actual problem is that I don't know how to search CRAN effectively. I'm
trying to address this deficiency now.




--
View this message in context: 
http://r.789695.n4.nabble.com/Is-there-a-time-series-resampling-function-tp4711907p4711977.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Is there a time series resampling function ?

2015-09-07 Thread Jeff Newmiller
Sorry, I did not see your use of the correct term, and I did not see any 
distinction between interpolate and the process you were describing so 
"intrapolate" just looked out of place.

If Google isn't helping, try

library(sos)
findFn("interpolate")

---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On September 7, 2015 8:04:38 PM PDT, AltShift  wrote:
>
>If
>Jeff Newmiller wrote
>> There are lots of them. You might be having trouble searching because
>you
>> don't know how to spell "interpolate". 
>
>Hi Jeff,
>
>If you re-read my original post you will see the word interpolate,
>spelled
>correctly. I also used the made-up word "intrapolate" (I thought that
>using
>quotes in the post would make this obvious) because I am describing a
>process that is complementary to interpolation. 
>
>My actual problem is that I don't know how to search CRAN effectively.
>I'm
>trying to address this deficiency now.
>
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Is-there-a-time-series-resampling-function-tp4711907p4711977.html
>Sent from the R help mailing list archive at Nabble.com.
>
>__
>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] update.packages() behavior

2015-09-07 Thread Bennet Fauber
I am not seeing an option with

$ ./configure --help

to include libcurl.  The Release Notes say:

=
It is now easier to use secure downloads from https:// URLs on builds
which support them: no longer do non-default options need to be
selected to do so. In particular, packages can be installed from
repositories which offer https:// URLs, and those listed by
setRepositories() now do so (for some of their mirrors).

Support for https:// URLs is available on Windows, and on other
platforms if support for libcurl was compiled in and if that supports
the https protocol (system installations can be expected to do). So
https:// support can be expected except on rather old OSes (an example
being OS X ‘Snow Leopard’, where a non-system version of libcurl can
be used).
=

Is RHEL6 a 'rather old OS'?  Do I need to compile and include a newer
version of libcurl?

Or, perhaps, I am using a mirror that doesn't support this, even
though I chose one from the presented list?

Thanks,  -- bennet



On Mon, Sep 7, 2015 at 5:09 PM, Uwe Ligges
 wrote:
> Right R-3.2.2 has the new default, but requires, for example, libcurl
> suppport in order to be able to deal with https. See the reelase Notes.
> Otherwise, http works as before.
>
> Best,
> Uwe Ligges
>
>
> On 07.09.2015 17:08, Bennet Fauber wrote:
>>
>> I recently compiled and installed R 3.2.2 on an RHEL 6.5 system.  Upon
>> installation, I tried
>>
>> $ R-3.2.2/bin/R
>>
>> R version 3.2.2 (2015-08-14) -- "Fire Safety"
>> 
>>
>>> update.packages()
>>
>> --- Please select a CRAN mirror for use in this session ---
>> Error in download.file(url, destfile = f, quiet = TRUE) :
>>unsupported URL scheme
>> HTTPS CRAN mirror
>> 
>> Selection: 14
>> Warning: unable to access index for repository
>> https://cran.mtu.edu/src/contrib
>>
>> However, choosing '18: (HTTP mirrors)', which then presents a
>> different menu of download location choices, and selecting one of
>> those seems to work, as does specifically naming a http URL, e.g.,
>> update.packages(repos = "http://cran.mtu.edu/;).
>>
>> Is the defaulting to the https URL-type a new behavior?  Did I miss
>> including some library, so https is not included?
>>
>> My configure line was
>>
>> $ ./configure --prefix=/tmp/bennet/local --mandir=/tmp/bennet/local/man \
>> --enable-R-shlib --without-x \
>> --with-blas="-L/usr/cac/rhel6/intel-xe-2015/mkl/lib/intel64
>> -lmkl_gf_lp64 -lmkl_sequential -lmkl_core"
>>
>> and I have
>>
>> $ rpm -qa | grep curl
>> curl-7.19.7-46.el6.x86_64
>> libcurl-devel-7.19.7-46.el6.x86_64
>> libcurl-7.19.7-46.el6.x86_64
>>
>> installed.
>>
>> If https is the default URL-type, is there some configuration I need
>> to do to not get the unsupported URL scheme message?  Is there a way
>> to globally set the URL-type to http instead?
>>
>> I recompiled R 3.1.1 to check, and it doesn't seem to default to https.
>>
>> Sorry if this is covered somewhere, pointers to appropriate
>> documentation will be appreciated.
>>
>> Thanks,  -- bennet
>>
>> __
>> 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] please help me for my project

2015-09-07 Thread Bert Gunter
... But This list has a *no homework* policy, and this sounds like homework.

Cheers,
Bert


Bert Gunter

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


On Mon, Sep 7, 2015 at 12:17 PM, John Kane  wrote:
> Some suggestions on how to ask a question on the R-help list
>
> John Kane
> Kingston ON Canada
>
>
>> -Original Message-
>> From: ghada.f...@gmail.com
>> Sent: Mon, 7 Sep 2015 16:57:19 +0300
>> To: r-help@r-project.org
>> Subject: [R] please help me for my project
>>
>> Hello dears member
>> I have project to analysis clusters algorithm in R
>> "K-mean, Hierarchical, Density based and EM"
>> I want to calculate
>> Cluster instance , number of iteration , sum of squared error SSE and the
>> accuracy for each cluster algorithms that i mention above
>> And the log likelihood for EM and DBSCAN
>>
>>   [[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.
>
> 
> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
> family!
> Visit http://www.inbox.com/photosharing to find out more!
>
> __
> 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] Reformatting text inside a data frame

2015-09-07 Thread David Winsemius

> On Sep 7, 2015, at 1:20 PM, Jon BR  wrote:
> 
> Hi John,
> Thanks for the reply; I'm pasting here the output from dput, with a
> 'df <-' added in front:
> 
> df <- structure(list(rowNum = c(1, 2, 3), first = structure(c(NA, 1L,
> 2L), .Label = c("AD=2;BA=8", "AD=9;BA=1"), class = "factor"),
>second = structure(c(2L, 1L, NA), .Label = c("AD=1;BA=2",
>"AD=13;BA=49"), class = "factor")), .Names = c("rowNum",
> "first", "second"), row.names = c(NA, -3L), class = "data.frame")
> 
> 
> 
> 
> To add more specifics, about what I would like; each value to be adjusted
> has the following general format:
> 
> "AD=X;BA=Y"
> 
> I would like to extract the values of X and Y and format them as a string
> as such:
> 
> "X_X-Y"
> 
> 
> Here's how I would handle a specific instance using awk in a shell script:
> 
> echo  "AD=X;BA=Y" | awk '{split($1,a,"AD="); split(a[2],b,";");
> split(b[2],c,"BA="); print b[1]"_"b[1]"-"c[2]}'
> X_X-Y
> 
> I'd like this to apply for all the entries that aren't NA to the right of
> column 1.

df[2:3] <- lapply(df[2:3], sub, patt="(AD\\=)(.+)(;BA\\=)(.+)”,
repl="\\2_\\2-\\4” )

> df
  rowNum first   second
1  1   13_13-49
2  2 2_2-81_1-2
3  3 9_9-1 

> 
> Hoping this adds clarity for any others who also didn't follow my example.
> 
> Thanks in advance for any tips-
> 
> Best,
> Jonathan
> 
> On Mon, Sep 7, 2015 at 3:48 PM, John Kane  wrote:
> 
>> I'm not making a lot of sense of the data, it looks like you want more
>> recodes than you have mentioned  but in any case  you might want to look at
>> the recode function in the car package.  It "should" do what you want
>> thought there may be faster ways to do it.
>> 
>> BTW, for supplying sample data have a look at ?dput . Using dput() means
>> that we see exactly the same data as you do.
>> 
>> Sorry not to be of more help
>> John Kane
>> Kingston ON Canada
>> 
>> 
>>> -Original Message-
>>> From: jonsle...@gmail.com
>>> Sent: Mon, 7 Sep 2015 15:27:05 -0400
>>> To: r-help@r-project.org
>>> Subject: [R] Reformatting text inside a data frame
>>> 
>>> Hi all,
>>>I've read in a large data frame that has formatting similar to the
>>> one
>>> in the small example below:
>>> 
>>> df <-
>>> 
>> data.frame(c(1,2,3),c(NA,"AD=2;BA=8","AD=9;BA=1"),c("AD=13;BA=49","AD=1;BA=2",NA));
>>> names(df) <- c("rowNum","first","second")
>>> 
 df
>>>  rowNum first  second
>>> 1  1   AD=13;BA=49
>>> 2  2 AD=2;BA=8   AD=1;BA=2
>>> 3  3 AD=9;BA=1
>>> 
>>> 
>>> I'd like to reformat all of the non-NA entries in df from "first" and
>>> "second" and so-on such that "AD=13;BA=49" will be replaced by the
>>> following string: "13_13-49".
>>> 
>>> So applied to df, the output would be the following:
>>> 
>>>  rowNum first  second
>>> 1  1   13_13-49
>>> 2  2 2_2-8   1_1-2
>>> 3  3 9_9-1
>>> 
>>> 
>>> I'm generally a big proponent of shell scripting with awk, but I'd prefer
>>> an all-R solution if one exists (and also to learn how to do this more
>>> generally).
>>> 
>>> Could someone point out an appropriate paradigm or otherwise point me in
>>> the right direction?
>>> 
>>> Best,
>>> Jonathan
>>> 
>>>  [[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.
>> 
>> 
>> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
>> Check it out at http://www.inbox.com/earth
>> 
>> 
>> 
> 
>   [[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] update.packages() behavior

2015-09-07 Thread Uwe Ligges
Right R-3.2.2 has the new default, but requires, for example, libcurl 
suppport in order to be able to deal with https. See the reelase Notes. 
Otherwise, http works as before.


Best,
Uwe Ligges


On 07.09.2015 17:08, Bennet Fauber wrote:

I recently compiled and installed R 3.2.2 on an RHEL 6.5 system.  Upon
installation, I tried

$ R-3.2.2/bin/R

R version 3.2.2 (2015-08-14) -- "Fire Safety"



update.packages()

--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
   unsupported URL scheme
HTTPS CRAN mirror

Selection: 14
Warning: unable to access index for repository https://cran.mtu.edu/src/contrib

However, choosing '18: (HTTP mirrors)', which then presents a
different menu of download location choices, and selecting one of
those seems to work, as does specifically naming a http URL, e.g.,
update.packages(repos = "http://cran.mtu.edu/;).

Is the defaulting to the https URL-type a new behavior?  Did I miss
including some library, so https is not included?

My configure line was

$ ./configure --prefix=/tmp/bennet/local --mandir=/tmp/bennet/local/man \
--enable-R-shlib --without-x \
--with-blas="-L/usr/cac/rhel6/intel-xe-2015/mkl/lib/intel64
-lmkl_gf_lp64 -lmkl_sequential -lmkl_core"

and I have

$ rpm -qa | grep curl
curl-7.19.7-46.el6.x86_64
libcurl-devel-7.19.7-46.el6.x86_64
libcurl-7.19.7-46.el6.x86_64

installed.

If https is the default URL-type, is there some configuration I need
to do to not get the unsupported URL scheme message?  Is there a way
to globally set the URL-type to http instead?

I recompiled R 3.1.1 to check, and it doesn't seem to default to https.

Sorry if this is covered somewhere, pointers to appropriate
documentation will be appreciated.

Thanks,  -- bennet

__
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] Maxent package - Restriction on number of unique class labels

2015-09-07 Thread John Kane

I have never even heard of the package but it might be just that that is the 
default maximum number of labels programmed in.

Have a look at the manual and/or the actual function.  If you don't get an 
answer in a day or so, email the author or maintainer. 
John Kane
Kingston ON Canada


> -Original Message-
> From: susrutha.gonga...@gmail.com
> Sent: Mon, 7 Sep 2015 08:34:47 -0400
> To: r-help@r-project.org
> Subject: [R] Maxent package - Restriction on number of unique class
> labels
> 
> Hi everyone,
> 
> I am developing a text classification code in R using 'maxent' package. I
> see that there is a limit on number of unique class labels that can be
> modeled, which is 255. Can someone please help me understand why this
> limit
> is present?
> The data I am working on has about 400 labels (data consists of thousands
> of records). Can anybody please suggest which package to use to be able
> to
> achieve maximum entropy based text classification on this?
> I have tried using 'RTextTools' package as well. It seems to be
> internally
> using 'maxent' package in return and  gives me the same error.
> 
> Would really appreciate any help!
> 
> Thanks.
> 
> Susrutha Gongalla
> 
>   [[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.


Publish your photos in seconds for FREE
TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if4

__
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] Reformatting text inside a data frame

2015-09-07 Thread Jon BR
Hi John,
 Thanks for the reply; I'm pasting here the output from dput, with a
'df <-' added in front:

df <- structure(list(rowNum = c(1, 2, 3), first = structure(c(NA, 1L,
2L), .Label = c("AD=2;BA=8", "AD=9;BA=1"), class = "factor"),
second = structure(c(2L, 1L, NA), .Label = c("AD=1;BA=2",
"AD=13;BA=49"), class = "factor")), .Names = c("rowNum",
"first", "second"), row.names = c(NA, -3L), class = "data.frame")




To add more specifics, about what I would like; each value to be adjusted
has the following general format:

"AD=X;BA=Y"

I would like to extract the values of X and Y and format them as a string
as such:

"X_X-Y"


Here's how I would handle a specific instance using awk in a shell script:

echo  "AD=X;BA=Y" | awk '{split($1,a,"AD="); split(a[2],b,";");
split(b[2],c,"BA="); print b[1]"_"b[1]"-"c[2]}'
X_X-Y

I'd like this to apply for all the entries that aren't NA to the right of
column 1.

Hoping this adds clarity for any others who also didn't follow my example.

Thanks in advance for any tips-

Best,
Jonathan

On Mon, Sep 7, 2015 at 3:48 PM, John Kane  wrote:

> I'm not making a lot of sense of the data, it looks like you want more
> recodes than you have mentioned  but in any case  you might want to look at
> the recode function in the car package.  It "should" do what you want
> thought there may be faster ways to do it.
>
> BTW, for supplying sample data have a look at ?dput . Using dput() means
> that we see exactly the same data as you do.
>
> Sorry not to be of more help
> John Kane
> Kingston ON Canada
>
>
> > -Original Message-
> > From: jonsle...@gmail.com
> > Sent: Mon, 7 Sep 2015 15:27:05 -0400
> > To: r-help@r-project.org
> > Subject: [R] Reformatting text inside a data frame
> >
> > Hi all,
> > I've read in a large data frame that has formatting similar to the
> > one
> > in the small example below:
> >
> > df <-
> >
> data.frame(c(1,2,3),c(NA,"AD=2;BA=8","AD=9;BA=1"),c("AD=13;BA=49","AD=1;BA=2",NA));
> > names(df) <- c("rowNum","first","second")
> >
> >> df
> >   rowNum first  second
> > 1  1   AD=13;BA=49
> > 2  2 AD=2;BA=8   AD=1;BA=2
> > 3  3 AD=9;BA=1
> >
> >
> > I'd like to reformat all of the non-NA entries in df from "first" and
> > "second" and so-on such that "AD=13;BA=49" will be replaced by the
> > following string: "13_13-49".
> >
> > So applied to df, the output would be the following:
> >
> >   rowNum first  second
> > 1  1   13_13-49
> > 2  2 2_2-8   1_1-2
> > 3  3 9_9-1
> >
> >
> > I'm generally a big proponent of shell scripting with awk, but I'd prefer
> > an all-R solution if one exists (and also to learn how to do this more
> > generally).
> >
> > Could someone point out an appropriate paradigm or otherwise point me in
> > the right direction?
> >
> > Best,
> > Jonathan
> >
> >   [[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.
>
> 
> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
> Check it out at http://www.inbox.com/earth
>
>
>

[[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] scaling loess curves

2015-09-07 Thread PIKAL Petr
Hi

what about xlim or ylim?

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bogdan
> Tanasa
> Sent: Monday, September 07, 2015 8:00 AM
> To: r-help
> Subject: [R] scaling loess curves
>
> Dear all,
>
> please could you advise about a method to scale 2 plots of LOESS
> curves.
> More specifically, we do have 2 sets of 5C data, and the loess plots
> reflect the relationship between INTENSITY and DISTANCE (please see the
> R code below).
>
> I am looking for a method/formula to scale these 2 LOESS plots and make
> them directly comparable.
>
> many thanks,
>
> -- bogdan
>
>
>
> -- the R code --
>
>
>
> a <- read.delim("a",header=T)
> qplot(data=a,distance,intensity)+geom_smooth(method = "loess", size =
> 1,
> span=0.01)+xlab("distance")+ylab("intensity")
>
>
>
> b <- read.delim("b",header=T)
> qplot(data=b,distance,intensity)+geom_smooth(method = "loess", size =
> 1,
> span=0.01)+xlab("distance")+ylab("intensity")
>
>   [[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.

[R] Compiling R 3.2.2 under FreeBSD

2015-09-07 Thread Victor
The R-CRAN project under FreeBSD 10.2 ports is quite obsolete being blocked at 
version 3.0.2 while at the moment the project is at version 3.2.2.
Modifying the /usr/ports/math/R port  I'm trying to upgrade R to that last 
version.  When I issue the 'make' command I get the following error
.
installing etc ...
installing share ...
/usr/ports/math/R-new/work/stage/usr/local/lib/R/lib/libRblas.so is unchanged
gcc48 -std=gnu99 -I. -I../../src/include -I../../src/include 
-I/usr/local/include -I/usr/local/include -DLIBICONV_PLUG -DHAVE_CONFIG_H  
-fopenmp -fpic  -O2 -pipe  -fno-builtin-coshl -fno-builtin-erfcl 
-fno-builtin-erfl -fno-builtin-lgammal -fno-builtin-powl -fno-builtin-sinhl 
-fno-builtin-tanhl -fno-builtin-tgammal -DLIBICONV_PLUG -fstack-protector 
-Wl,-rpath=/usr/local/lib/gcc48 -fno-strict-aliasing -L/usr/local/lib 
-fno-builtin-coshl -fno-builtin-erfcl -fno-builtin-erfl -fno-builtin-lgammal 
-fno-builtin-powl -fno-builtin-sinhl -fno-builtin-tanhl -fno-builtin-tgammal 
-Wl,-rpath=/usr/local/lib/gcc48  -L/usr/local/lib/gcc48 -B/usr/local/bin 
-fstack-protector -Wl,-rpath=/usr/local/lib/gcc48 -L/usr/local/lib/gcc48 
-DR_HOME='"/usr/local/lib/R"'  -o Rscript ./Rscript.c
/usr/ports/math/R-new/work/stage/usr/local/lib/R/bin/exec/R is unchanged
/usr/ports/math/R-new/work/stage/usr/local/lib/R/lib/libR.so is unchanged
/usr/ports/math/R-new/work/stage/usr/local/lib/R/modules/internet.so is 
unchanged
/usr/ports/math/R-new/work/stage/usr/local/lib/R/modules/lapack.so is unchanged
/usr/ports/math/R-new/work/stage/usr/local/lib/R/lib/libRlapack.so is unchanged
/usr/ports/math/R-new/work/stage/usr/local/lib/R/modules/R_X11.so is unchanged
/usr/ports/math/R-new/work/stage/usr/local/lib/R/modules/R_de.so is unchanged
installing packages ...
  building HTML index ...
install: R-FAQ.info*: No such file or directory
*** Error code 71

Stop.
make[1]: stopped in /usr/ports/math/R-new
*** Error code 1

Stop.
make: stopped in /usr/ports/math/R-new




What should I do?

Ciao
Vittorio
__
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] update.packages() behavior

2015-09-07 Thread Bennet Fauber
I recently compiled and installed R 3.2.2 on an RHEL 6.5 system.  Upon
installation, I tried

$ R-3.2.2/bin/R

R version 3.2.2 (2015-08-14) -- "Fire Safety"


> update.packages()
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
  unsupported URL scheme
HTTPS CRAN mirror

Selection: 14
Warning: unable to access index for repository https://cran.mtu.edu/src/contrib

However, choosing '18: (HTTP mirrors)', which then presents a
different menu of download location choices, and selecting one of
those seems to work, as does specifically naming a http URL, e.g.,
update.packages(repos = "http://cran.mtu.edu/;).

Is the defaulting to the https URL-type a new behavior?  Did I miss
including some library, so https is not included?

My configure line was

$ ./configure --prefix=/tmp/bennet/local --mandir=/tmp/bennet/local/man \
   --enable-R-shlib --without-x \
   --with-blas="-L/usr/cac/rhel6/intel-xe-2015/mkl/lib/intel64
-lmkl_gf_lp64 -lmkl_sequential -lmkl_core"

and I have

$ rpm -qa | grep curl
curl-7.19.7-46.el6.x86_64
libcurl-devel-7.19.7-46.el6.x86_64
libcurl-7.19.7-46.el6.x86_64

installed.

If https is the default URL-type, is there some configuration I need
to do to not get the unsupported URL scheme message?  Is there a way
to globally set the URL-type to http instead?

I recompiled R 3.1.1 to check, and it doesn't seem to default to https.

Sorry if this is covered somewhere, pointers to appropriate
documentation will be appreciated.

Thanks,  -- bennet

__
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] please help me for my project

2015-09-07 Thread John Kane
Some suggestions on how to ask a question on the R-help list

John Kane
Kingston ON Canada


> -Original Message-
> From: ghada.f...@gmail.com
> Sent: Mon, 7 Sep 2015 16:57:19 +0300
> To: r-help@r-project.org
> Subject: [R] please help me for my project
> 
> Hello dears member
> I have project to analysis clusters algorithm in R
> "K-mean, Hierarchical, Density based and EM"
> I want to calculate
> Cluster instance , number of iteration , sum of squared error SSE and the
> accuracy for each cluster algorithms that i mention above
> And the log likelihood for EM and DBSCAN
> 
>   [[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.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
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] Reformatting text inside a data frame

2015-09-07 Thread Jon BR
Hi all,
I've read in a large data frame that has formatting similar to the one
in the small example below:

df <-
data.frame(c(1,2,3),c(NA,"AD=2;BA=8","AD=9;BA=1"),c("AD=13;BA=49","AD=1;BA=2",NA));
names(df) <- c("rowNum","first","second")

> df
  rowNum first  second
1  1   AD=13;BA=49
2  2 AD=2;BA=8   AD=1;BA=2
3  3 AD=9;BA=1


I'd like to reformat all of the non-NA entries in df from "first" and
"second" and so-on such that "AD=13;BA=49" will be replaced by the
following string: "13_13-49".

So applied to df, the output would be the following:

  rowNum first  second
1  1   13_13-49
2  2 2_2-8   1_1-2
3  3 9_9-1


I'm generally a big proponent of shell scripting with awk, but I'd prefer
an all-R solution if one exists (and also to learn how to do this more
generally).

Could someone point out an appropriate paradigm or otherwise point me in
the right direction?

Best,
Jonathan

[[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] Reformatting text inside a data frame

2015-09-07 Thread John Kane
I'm not making a lot of sense of the data, it looks like you want more recodes 
than you have mentioned  but in any case  you might want to look at the recode 
function in the car package.  It "should" do what you want thought there may be 
faster ways to do it.

BTW, for supplying sample data have a look at ?dput . Using dput() means that 
we see exactly the same data as you do.

Sorry not to be of more help
John Kane
Kingston ON Canada


> -Original Message-
> From: jonsle...@gmail.com
> Sent: Mon, 7 Sep 2015 15:27:05 -0400
> To: r-help@r-project.org
> Subject: [R] Reformatting text inside a data frame
> 
> Hi all,
> I've read in a large data frame that has formatting similar to the
> one
> in the small example below:
> 
> df <-
> data.frame(c(1,2,3),c(NA,"AD=2;BA=8","AD=9;BA=1"),c("AD=13;BA=49","AD=1;BA=2",NA));
> names(df) <- c("rowNum","first","second")
> 
>> df
>   rowNum first  second
> 1  1   AD=13;BA=49
> 2  2 AD=2;BA=8   AD=1;BA=2
> 3  3 AD=9;BA=1
> 
> 
> I'd like to reformat all of the non-NA entries in df from "first" and
> "second" and so-on such that "AD=13;BA=49" will be replaced by the
> following string: "13_13-49".
> 
> So applied to df, the output would be the following:
> 
>   rowNum first  second
> 1  1   13_13-49
> 2  2 2_2-8   1_1-2
> 3  3 9_9-1
> 
> 
> I'm generally a big proponent of shell scripting with awk, but I'd prefer
> an all-R solution if one exists (and also to learn how to do this more
> generally).
> 
> Could someone point out an appropriate paradigm or otherwise point me in
> the right direction?
> 
> Best,
> Jonathan
> 
>   [[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.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
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] please help me for my project

2015-09-07 Thread Ghada Almousa
Hello dears member
I have project to analysis clusters algorithm in R
"K-mean, Hierarchical, Density based and EM"
I want to calculate
Cluster instance , number of iteration , sum of squared error SSE and the
accuracy for each cluster algorithms that i mention above
And the log likelihood for EM and DBSCAN

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