Re: [R] aggregate dataframe by multiple factors

2016-11-20 Thread Karim Mezhoud
Sorry for the delay, Many Thanks for Mr. David and Mr. Petr I thinked to use "sort" function to arrange chronologically value by 'date' (without 'date' is colnames) of each variables (DCE, DP). The solution of David seems to be simple to understand with "unlist" function. The solution of Petr s

[R] Need some help with regular expression

2016-11-20 Thread Steven Nagy
I tried out a regular expression on this website: http://regexr.com/3en1m So the input text is: "Name.MEMBER_TYPE: -> STU" The regular expression is: ((?:\w+|\s) -> STU|STU -> (?:\w+|\s)) And it returns: " -> STU" but when I use in R, it doesn't return the same result: strapply(c

Re: [R] aggregate dataframe by multiple factors

2016-11-20 Thread David Winsemius
> On Nov 20, 2016, at 5:28 AM, Karim Mezhoud wrote: > > Sorry for the delay, > Many Thanks for Mr. David and Mr. Petr > I thinked to use "sort" function to arrange chronologically value by > 'date' (without 'date' is colnames) of each variables (DCE, DP). > > > The solution of David seems

Re: [R] aggregate dataframe by multiple factors

2016-11-20 Thread Karim Mezhoud
Yes the results does not have a date but successive DCE.1, DCE2, DCE.3 indicates DCE.date1 , DCE.date2, DCE.date3 I hope that the chronological order of date is conserved. Thanks, Karim On Sun, Nov 20, 2016 at 7:44 PM, David Winsemius wrote: > > > On Nov 20, 2016, at 5:28 AM, Karim Mezhoud wr

Re: [R] aggregate dataframe by multiple factors

2016-11-20 Thread David Winsemius
> On Nov 20, 2016, at 10:49 AM, Karim Mezhoud wrote: > > Yes the results does not have a date but > successive DCE.1, DCE2, DCE.3 indicates > DCE.date1 , DCE.date2, DCE.date3 > I hope that the chronological order of date is conserved. There are, however, 4 dates. See this pair of results. Yo

Re: [R] Need some help with regular expression

2016-11-20 Thread Bert Gunter
If I understand you correctly, I think you are making it more complex than necessary. Using your example (thanks!!), the following should get you started: > x<- c("Name.MEMBER_TYPE: NMA -> STU ; CATEGORY: -> 1 ; CITY: MISSISSAUGA -> > Mississauga ; ZIP: L5N1H9 -> L5N 1H9 ; COUNTRY: CAN -> ; ME

Re: [R] aggregate dataframe by multiple factors

2016-11-20 Thread David Winsemius
> On Nov 20, 2016, at 11:11 AM, David Winsemius wrote: > > >> On Nov 20, 2016, at 10:49 AM, Karim Mezhoud wrote: >> >> Yes the results does not have a date but >> successive DCE.1, DCE2, DCE.3 indicates >> DCE.date1 , DCE.date2, DCE.date3 >> I hope that the chronological order of date is co

Re: [R] aggregate dataframe by multiple factors

2016-11-20 Thread Karim Mezhoud
Many Thanks, What is exactly the solution. Best, Karim On Sun, Nov 20, 2016 at 8:17 PM, David Winsemius wrote: > > > On Nov 20, 2016, at 11:11 AM, David Winsemius > wrote: > > > > > >> On Nov 20, 2016, at 10:49 AM, Karim Mezhoud wrote: > >> > >> Yes the results does not have a date but > >> su

[R] Problems using plsr() in the pls package

2016-11-20 Thread CG Pettersson
Dear all, I am trying to do a PLS regression using plsr() from the pls package. I have tried to make a dataset according to the methods recommended in "Introduction to the pls Package" (Mevik & Wehrens, 2015) and it looks like I get a structure in the dataset that resembles what is packed with th

Re: [R] aggregate dataframe by multiple factors

2016-11-20 Thread David Winsemius
> On Nov 20, 2016, at 11:26 AM, Karim Mezhoud wrote: > > Many Thanks, > What is exactly the solution. Is that a question? If so, you need to be more expansive about the areas of uncertainty, since I _thought_ I had given an "exact" solution. -- David > Best, > Karim > > On Sun, Nov 20, 201

Re: [R] Problems using plsr() in the pls package

2016-11-20 Thread Rui Barradas
Hello, I know nothing about the plsr package but in the data.frame 'gasoline' the column NIR is numeric and in 'lid_allt2' the column lid_nose is character. Maybe you need lid_allt2$lid_nose <- as.numeric(lid_allt2$lid_nose) but I really don't know if this is the problem. Hope this helps,

Re: [R] Problems using plsr() in the pls package

2016-11-20 Thread Rolf Turner
On 21/11/16 09:03, Rui Barradas wrote: Hello, I know nothing about the plsr package but in the data.frame 'gasoline' the column NIR is numeric and in 'lid_allt2' the column lid_nose is character. Maybe you need lid_allt2$lid_nose <- as.numeric(lid_allt2$lid_nose) but I really don't know if thi

Re: [R] Problems using plsr() in the pls package

2016-11-20 Thread Rui Barradas
Hello, Inline. Em 20-11-2016 20:40, Rolf Turner escreveu: On 21/11/16 09:03, Rui Barradas wrote: Hello, I know nothing about the plsr package but in the data.frame 'gasoline' the column NIR is numeric and in 'lid_allt2' the column lid_nose is character. Maybe you need lid_allt2$lid_nose <- a

Re: [R] aggregate dataframe by multiple factors

2016-11-20 Thread Karim Mezhoud
Sorry, "That" and not "What". Best On Sun, Nov 20, 2016 at 9:00 PM, David Winsemius wrote: > > > On Nov 20, 2016, at 11:26 AM, Karim Mezhoud wrote: > > > > Many Thanks, > > What is exactly the solution. > > Is that a question? If so, you need to be more expansive about the areas > of uncertaint

Re: [R] Need some help with regular expression

2016-11-20 Thread Steven Nagy
Thanks a lot Bert. That's amazing. I am very new to both R and regular expressions. I don't really understand the regular expression that you used below. And looks like I don't even need any special library, like the "gsubfn" for the strapply function. I was trying to use the regexr.com website to

Re: [R] Need some help with regular expression

2016-11-20 Thread Bert Gunter
Although others may respond, I think you will do much better studying ?regexp, which will answer all your questions. I believe the effort you will make figuring it out will pay dividends for your future R/regular expression usage that you cannot gain from my direct explanation. Good luck. Best, B

Re: [R] Melt and compute Max, Mean, Min

2016-11-20 Thread PIKAL Petr
Hi see in line From: Miluji Sb [mailto:miluj...@gmail.com] Sent: Friday, November 18, 2016 3:57 PM To: PIKAL Petr Cc: r-help mailing list Subject: Re: [R] Melt and compute Max, Mean, Min If I do: as.data.frame(apply(df[,-(1:3)],1, mean, na.rm=T)) is it possible to sequentially name the varia