search for: esawi

Displaying 20 results from an estimated 30 matches for "esawi".

2018 Jan 08
1
Replace NAs in split lists
...wrote: > I don't know. You seem to be posting in HTML so your code is mangled. Can you post plain text and use the reprex package to make sure it produces the errorin a clean R session? > -- > Sent from my phone. Please excuse my brevity. > > On January 8, 2018 8:03:45 AM PST, Ek Esawi <esawiek at gmail.com> wrote: >>Thank you Jeff. Your code works, as usual , perfectly. I am just >>wondering why if i put the whole code in one line, i get an error >>message. >>sdf2 <- lapply( sdf, function(z){z$Value >><-ifelse(is.na(z$Value),z$Value[!is....
2018 Jan 08
2
Replace NAs in split lists
...that going >> forward in your calculations? That is generally the preferred approach in R >> so you can re-do your calculations easily if you find a mistake later. >> -- >> Sent from my phone. Please excuse my brevity. >> >> On January 7, 2018 7:35:59 PM PST, Ek Esawi <esawiek at gmail.com> wrote: >>> >>> I just came up with a solution right after i posted the question, but >>> i figured there must be a better and shorter one.than my solution >>> sdf1[[1]][1,4]<-lapplyresults[[1]] >>> sdf1[[2]][1,4]<-lappl...
2018 Jan 08
0
Replace NAs in split lists
I don't know. You seem to be posting in HTML so your code is mangled. Can you post plain text and use the reprex package to make sure it produces the errorin a clean R session? -- Sent from my phone. Please excuse my brevity. On January 8, 2018 8:03:45 AM PST, Ek Esawi <esawiek at gmail.com> wrote: >Thank you Jeff. Your code works, as usual , perfectly. I am just >wondering why if i put the whole code in one line, i get an error >message. >sdf2 <- lapply( sdf, function(z){z$Value ><-ifelse(is.na(z$Value),z$Value[!is.na(z$Value)][1],z$Va...
2018 Jan 08
3
Replace NAs in split lists
...st reassemble the parts as a new data frame and use that going forward in your calculations? That is generally the preferred approach in R so you can re-do your calculations easily if you find a mistake later. -- Sent from my phone. Please excuse my brevity. On January 7, 2018 7:35:59 PM PST, Ek Esawi <esawiek at gmail.com> wrote: >I just came up with a solution right after i posted the question, but >i figured there must be a better and shorter one.than my solution >sdf1[[1]][1,4]<-lapplyresults[[1]] >sdf1[[2]][1,4]<-lapplyresults[[2]] > >EK > >On Sun, Jan 7,...
2017 Nov 22
1
assign NA to rows by test on multiple columns of a data frame
OPS, Sorry i did not read the post carfully. Mine will not work if you have zeros on columns A and B.. But you could modify it to work for specific columns i believe. EK On Wed, Nov 22, 2017 at 8:37 AM, Ek Esawi <esawiek at gmail.com> wrote: > Hi *Massimo,* > > *Try this.* > > *a <- mydf==0mydf[a] <- NAHTHEK* > > On Wed, Nov 22, 2017 at 5:34 AM, Massimo Bressan < > massimo.bressan at arpa.veneto.it> wrote: > >> >> >> Given this data frame (a s...
2018 Jan 08
0
Replace NAs in split lists
I just came up with a solution right after i posted the question, but i figured there must be a better and shorter one.than my solution sdf1[[1]][1,4]<-lapplyresults[[1]] sdf1[[2]][1,4]<-lapplyresults[[2]] EK On Sun, Jan 7, 2018 at 10:13 PM, Ek Esawi <esawiek at gmail.com> wrote: > Hi all-- > > I stumbled on this problem online. I did not like the solution given > there which was a long UDF. I thought why cannot split and l/s apply > work here. My aim is to split the data frame, use l/sapply, make > changes on the split...
2018 Jan 08
4
Replace NAs in split lists
Hi all-- I stumbled on this problem online. I did not like the solution given there which was a long UDF. I thought why cannot split and l/s apply work here. My aim is to split the data frame, use l/sapply, make changes on the split lists and combine the split lists to new data frame with the desired changes/output. The data frame shown below has a column named ID which has 2 variables a and b;
2018 Jan 08
0
Replace NAs in split lists
...a frame and use that going > forward in your calculations? That is generally the preferred approach > in R so you can re-do your calculations easily if you find a mistake > later. > -- > Sent from my phone. Please excuse my brevity. > > On January 7, 2018 7:35:59 PM PST, Ek Esawi <esawiek at gmail.com> wrote: >> I just came up with a solution right after i posted the question, but >> i figured there must be a better and shorter one.than my solution >> sdf1[[1]][1,4]<-lapplyresults[[1]] >> sdf1[[2]][1,4]<-lapplyresults[[2]] >> >&g...
2018 Jan 08
2
Replace NAs in split lists
...FALSE 2 3 a ac FALSE 2 4 b aa TRUE 5 5 b ab FALSE 5 Cheers Petr > -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jeff > Newmiller > Sent: Monday, January 8, 2018 9:13 AM > To: r-help at r-project.org; Ek Esawi <esawiek at gmail.com> > Subject: Re: [R] Replace NAs in split lists > > Upon closer examination I see that you are not using the split version of > df1 as I usually would, so here is a reproducible example: > > #---- > df1 <- read.table( text= > "ID ID_2 Firis...
2017 Oct 29
1
Count non-zero values in excluding NA Values
...ng Year Month A B C D E 2005 July 0 *4* NA NA *1* 2005 July 0 NA NA 0 *9* 2005 July NA *4* 0 *1* 0 2005 July *4* 0 *2* *9* NA I try to count non-zero values which are not NA values for every *column* *Sincerely* *Engin YILMAZ* 2017-10-29 15:01 GMT+03:00 Ek Esawi <esawiek at gmail.com>: > Since i could not see your data, the easiest thing comes to mind is court > values excluding NAs, is something like this > sum(!is.na(x)) > > Best of luck--EK > > On Sun, Oct 29, 2017 at 6:25 AM, Engin YILMAZ <ispanyolcom at gmail.com> &gt...
2018 Jan 22
2
substr gives empty output
In y <- substr(x, i, 1) your third integer needs to be the location not the number of digits, so change it to y <- substr(x, i, i) and you should get what you want. Cheers, Tim > Date: Sun, 21 Jan 2018 10:50:31 -0500 > From: Ek Esawi <esawiek at gmail.com> > To: Luigi Marongiu <marongiu.luigi at gmail.com>, r-help at r-project.org > Subject: Re: [R] substr gives empty output > Message-ID: > <CA+ZkTxubYDSZ3iqsg_=be9HBA2_3-TE95=mXbh4atvG- > ri_ixQ at mail.gmail.com> > Content-Type: text...
2018 Jan 08
0
Replace NAs in split lists
Because you need to separate the instructions with a ; (semi-colon). Hope this helps Rui Barradas Enviado a partir do meu smartphone Samsung Galaxy.-------- Mensagem original --------De: Ek Esawi <esawiek at gmail.com> Data: 08/01/2018 16:03 (GMT+00:00) Para: Jeff Newmiller <jdnewmil at dcn.davis.ca.us>, r-help at r-project.org Assunto: Re: [R] Replace NAs in split lists Thank you Jeff. Your code works, as usual , perfectly. I am just wondering why if i put the whole code in...
2018 Jan 08
2
Replace NAs in split lists
...> > > >Cheers > >Petr > > > >> -----Original Message----- > >> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jeff > >> Newmiller > >> Sent: Monday, January 8, 2018 9:13 AM > >> To: r-help at r-project.org; Ek Esawi <esawiek at gmail.com> > >> Subject: Re: [R] Replace NAs in split lists > >> > >> Upon closer examination I see that you are not using the split > >version of > >> df1 as I usually would, so here is a reproducible example: > >> > >>...
2018 Jan 08
0
Replace NAs in split lists
...aa TRUE 5 >5 b ab FALSE 5 > >Cheers >Petr > >> -----Original Message----- >> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jeff >> Newmiller >> Sent: Monday, January 8, 2018 9:13 AM >> To: r-help at r-project.org; Ek Esawi <esawiek at gmail.com> >> Subject: Re: [R] Replace NAs in split lists >> >> Upon closer examination I see that you are not using the split >version of >> df1 as I usually would, so here is a reproducible example: >> >> #---- >> df1 <- read.table...
2018 Jan 08
0
Replace NAs in split lists
...gt; >Petr >> > >> >> -----Original Message----- >> >> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of >Jeff >> >> Newmiller >> >> Sent: Monday, January 8, 2018 9:13 AM >> >> To: r-help at r-project.org; Ek Esawi <esawiek at gmail.com> >> >> Subject: Re: [R] Replace NAs in split lists >> >> >> >> Upon closer examination I see that you are not using the split >> >version of >> >> df1 as I usually would, so here is a reproducible example: >>...
2017 Oct 29
0
Count non-zero values in excluding NA Values
What was suggested by Eric and Rui works well, but here is a short and may be simpler answer provided your data is similar what Eric posted. It should work for your l data too. aa <- is.na(data)|data==0 nrow(data)-colSums(aa) EK On Sun, Oct 29, 2017 at 6:25 AM, Engin YILMAZ <ispanyolcom at gmail.com> wrote: > Dear R Staff > > You can see my data.csv file in the annex. >
2017 Jun 21
3
Counting with multiple criteria using data table
I have a data.table which is shown below. I want to count combinations of columns on i and count on j with by. A few examples are given below the table. I want to: all months to show on the output including those that they have zero value I want the three statements combined in on if possible so the output will be one data table; that is the outputs are next to each other as manually
2018 Feb 27
3
Aggregate over multiple and unequal column length data frames
...ame as you expect. > > You should post those data frames as output from dput(data) and show us real desired result from those example data frames. > > Cheers > Petr > >> -----Original Message----- >> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Ek Esawi >> Sent: Wednesday, February 21, 2018 3:34 AM >> To: r-help at r-project.org >> Subject: [R] Aggregate over multiple and unequal column length data frames >> >> Hi All-- >> >> I have generated several 2 column data frames with variable length. The data &gt...
2017 Aug 09
2
Fill in empty spaces modified
Hi All? I was looking at a posting from June-17. I managed to solve it. However, when I changed the example in the posting, my solution will work only once at a time which was mentioned by Jim Lemon on his response to the original posting. This means that my solution will have to be repeated as many times as the maximum number of spaces on each gap; something that may not work well for large
2017 Jun 21
0
Counting with multiple criteria using data table
...do (we're volunteers, so no guarantees). Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Jun 21, 2017 at 2:50 PM, Ek Esawi <esawiek at gmail.com> wrote: > I have a data.table which is shown below. I want to count combinations of > columns on i and count on j with by. A few examples are given below the > table. > > > > I want to: > > all months to show on the output including those that...