Re: [R] save screen printed data frames and ggplots into a file

2016-01-01 Thread Ragia Ibrahim
yes, the script prints that on the scree, when I used pd file to do the job 
only ggplots appears on it !

hope this clarifies, thanks .
Ragia


> Date: Thu, 31 Dec 2015 17:19:35 -0800
> Subject: Re: [R] save screen printed data frames and ggplots into a file
> From: bgunter.4...@gmail.com
> To: ragi...@hotmail.com
> CC: r-help@r-project.org
>
> Does what? You said you already have a script.
>
> **If** you want to program it as a function, then I suggest that you
> do some homework and go through an R tutorial, e.g. the "Intro to R"
> that ships with R or one of the many available on the web.
>
> If that is not what you mean, then clarify.
>
> 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 Thu, Dec 31, 2015 at 4:46 PM, Ragia Ibrahim <ragi...@hotmail.com> wrote:
>> Dear group
>> I have a script that prints data frames and plot using ggplot 2 while 
>> running,
>> how can I do this
>> thanks in advance
>> Ragia
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
  
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] save screen printed data frames and ggplots into a file

2015-12-31 Thread Ragia Ibrahim
Dear group
I have a script that prints data frames and plot using ggplot 2 while running,  
how can I do this
thanks in advance
Ragia 
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] R studio installation and running

2015-12-23 Thread Ragia Ibrahim
many thanks for all replies 
Indeed I post the question on the rstudio support website, many thanks
Ragia


> From: istaz...@gmail.com
> Date: Wed, 23 Dec 2015 13:17:48 -0500
> Subject: Re: [R] R studio installation and running
> To: pda...@gmail.com
> CC: ragi...@hotmail.com; r-help@r-project.org
>
> On Wed, Dec 23, 2015 at 1:04 PM, peter dalgaard <pda...@gmail.com> wrote:
>> Correct me if I'm wrong, but I think the mode of operation is that you run a 
>> local Rstudio, which connects to Rstudio server via  protocol which 
>> lets the two Rstudios communicate via  Internet ports.
>
> I'm pretty sure Rstudio server communicates with a web browser, not
> with a local Rstudio desktop application.
>
> I don't think you can just run Rstudio via a Putty connection. As
> others have pointed out, Rstudio support should give you the details.
>>
>
> If you install Rstudio desktop on the server you may be able to run it
> via ssh with X forwarding. Not sure how/if this works on
> Windows/Putty. If you install Rstudio server then ssh / putty doesn't
> really come into play -- everything happens over http. And yes, this
> conversation should definitely move to the rstudio support forum.
>
> Best,
> Ista
>
>> -pd
>>
>>
>>> On 23 Dec 2015, at 17:51 , Ragia Ibrahim <ragi...@hotmail.com> wrote:
>>>
>>>
>>> many thanks for your help
>>> its remote ubuntu server that I connect via Putty, and I install R and 
>>> rstudio , now trying to make it run..but it doesnt..its only terminal..I 
>>> will try the rstudio help mailing list as many of the list advice's me, 
>>> many thanks prof for your help
>>> Ragia
>>> 
>>>> Date: Wed, 23 Dec 2015 11:44:36 -0500
>>>> From: jsor...@grecc.umaryland.edu
>>>> To: jrkrid...@inbox.com
>>>> CC: ragi...@hotmail.com; r-help@r-project.org
>>>> Subject: Re: [R] R studio installation and running
>>>>
>>>> If you want to run Rstudio locally, install the desktop edition. If you
>>>> want to be able to run Rstudio from a remote machine which will connect
>>>> to your desktop via the web, install the server edition. If you are
>>>> unsure which to use, or are having trouble, start with the desktop
>>>> edition. You must install R before you install either edition of
>>>> RStudio. Once RStudio is installed, enter rstudio , possibly RStudio at
>>>> the command line to run the program
>>>>
>>>>
>>>> John David Sorkin M.D., Ph.D.
>>>> Professor of Medicine
>>>> Chief, Biostatistics and Informatics
>>>> University of Maryland School of Medicine Division of Gerontology and
>>>> Geriatric Medicine
>>>> Baltimore VA Medical Center
>>>> 10 North Greene Street
>>>> GRECC (BT/18/GR)
>>>> Baltimore, MD 21201-1524
>>>> (Phone) 410-605-7119
>>>> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>>>>
>>>> On Dec 23, 2015, at 10:24 AM, John Kane
>>>> <jrkrid...@inbox.com<mailto:jrkrid...@inbox.com>> wrote:
>>>>
>>>> Desktop but you would be better off asking this in an RStudio forum. It
>>>> is a bit off-topic here.
>>>>
>>>> John Kane
>>>> Kingston ON Canada
>>>>
>>>>
>>>> -Original Message-
>>>> From: ragi...@hotmail.com<mailto:ragi...@hotmail.com>
>>>> Sent: Tue, 22 Dec 2015 23:10:58 +0200
>>>> To: r-help@r-project.org<mailto:r-help@r-project.org>
>>>> Subject: [R] R studio installation and running
>>>>
>>>> Dear group
>>>> I used to run Rstudio on windows.
>>>> currently I want to run Rstudio on Ubuntu server, start its GUI .
>>>> kindly, is there a guide on how to do this step by step, I already
>>>> searched and installed R .. but confused ..should I install Rstudio for
>>>> desktop or server ? how to start it?, I am the server admin.
>>>>
>>>> thanks in advance
>>>> Ragia
>>>>
>>>>
>>>> __
>>>> R-help@r-project.org<mailto: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.

Re: [R] R studio installation and running

2015-12-23 Thread Ragia Ibrahim

many thanks for your help
its remote ubuntu server that I connect via Putty, and I install R and rstudio 
, now trying to make it run..but it doesnt..its only terminal..I will try the 
rstudio help mailing list as many of the list advice's me, many thanks prof for 
your help
Ragia

> Date: Wed, 23 Dec 2015 11:44:36 -0500 
> From: jsor...@grecc.umaryland.edu 
> To: jrkrid...@inbox.com 
> CC: ragi...@hotmail.com; r-help@r-project.org 
> Subject: Re: [R] R studio installation and running 
> 
> If you want to run Rstudio locally, install the desktop edition. If you 
> want to be able to run Rstudio from a remote machine which will connect 
> to your desktop via the web, install the server edition. If you are 
> unsure which to use, or are having trouble, start with the desktop 
> edition. You must install R before you install either edition of 
> RStudio. Once RStudio is installed, enter rstudio , possibly RStudio at 
> the command line to run the program 
> 
> 
> John David Sorkin M.D., Ph.D. 
> Professor of Medicine 
> Chief, Biostatistics and Informatics 
> University of Maryland School of Medicine Division of Gerontology and 
> Geriatric Medicine 
> Baltimore VA Medical Center 
> 10 North Greene Street 
> GRECC (BT/18/GR) 
> Baltimore, MD 21201-1524 
> (Phone) 410-605-7119 
> (Fax) 410-605-7913 (Please call phone number above prior to faxing) 
> 
> On Dec 23, 2015, at 10:24 AM, John Kane 
> > wrote: 
> 
> Desktop but you would be better off asking this in an RStudio forum. It 
> is a bit off-topic here. 
> 
> John Kane 
> Kingston ON Canada 
> 
> 
> -Original Message- 
> From: ragi...@hotmail.com 
> Sent: Tue, 22 Dec 2015 23:10:58 +0200 
> To: r-help@r-project.org 
> Subject: [R] R studio installation and running 
> 
> Dear group 
> I used to run Rstudio on windows. 
> currently I want to run Rstudio on Ubuntu server, start its GUI . 
> kindly, is there a guide on how to do this step by step, I already 
> searched and installed R .. but confused ..should I install Rstudio for 
> desktop or server ? how to start it?, I am the server admin. 
> 
> thanks in advance 
> Ragia 
> 
> 
> __ 
> 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. 
> 
> 
> Confidentiality Statement: 
> 
> This email message, including any attachments, is for the sole use of 
> the intended recipient(s) and may contain confidential and privileged 
> information. Any unauthorized use, disclosure or distribution is 
> prohibited. If you are not the intended recipient, please contact the 
> sender by reply email and destroy all copies of the original message. 
  
__
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 studio installation and running

2015-12-22 Thread Ragia Ibrahim
Dear group
I used to run Rstudio on windows.
currently  I want to run Rstudio on Ubuntu server, start its GUI .
kindly, is there a guide on how to do this step by step, I already searched and 
installed R .. but confused ..should I install Rstudio for desktop or server ? 
how to start it?, I am the server admin.

thanks in advance
Ragia

  
__
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] splitting data frame into fixed rows depending on column rep

2015-12-06 Thread Ragia Ibrahim
Dear group,

I have the following data frame

            v1 v2  v3 v4 v5
1           1  3 1   3.5    1
2           1  4 3   3.5    1
3           1  8 3   3.5    1
4           2  9 8   2.5    1
5           2 10 9   2.5    1
6           2  6 3   1.5    1
7           3  4 3   2.0    1
8           3  5 3   1.0    1
9           3  8 3   1.0    1
10          4  9 8   2.0    1
11          4  6 5   1.0    1
12          4  8 4   1.0    1
13          5  4 3   2.0    1
14          5  5 3   2.0    1
15          5  6 5   2.0    1

I'm trying to split it into data frames where each equal v1 so all v1==1 in 
data frame and all v1==2 in separate data frame and so on.
so it would be

        v1 v2  v3 v4 v5
1           1  3 1   3.5    1
2           1  4 3   3.5    1
3           1  8 3   3.5    1
then
            v1 v2  v3 v4 v5
4           2  9 8   2.5    1
5           2 10 9   2.5    1
6           2  6 3   1.5    1
...
...
and so on

I tried 
a<- split(df, df$v1==1) 
but the resulting class is a list and when I try to access for example a$v2 it 
gave me NULL ??

how can I split it an get each vector of v2 for each group, 
lots of thanks
Ragia 
__
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] extract rows based on column value in a data frame

2015-12-02 Thread Ragia Ibrahim
lots of thanks 
Ragia


> Date: Wed, 2 Dec 2015 14:12:46 -0800
> Subject: Re: [R] extract rows based on column value in a data frame
> From: bgunter.4...@gmail.com
> To: dwinsem...@comcast.net
> CC: ragi...@hotmail.com; r-help@r-project.org
>
> ...
> Perhaps also worth mentioning -- David's solution works even if there
> are less than 3 rows per group, whereas mine will fail.
>
> Cheers,
> Bert
>
>
> Bert Gunter
>
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
> -- Clifford Stoll
>
>
> On Wed, Dec 2, 2015 at 2:10 PM, Bert Gunter <bgunter.4...@gmail.com> wrote:
>> ... or perhaps using rep() to do the indexing directly instead of matching:
>>
>> dfrm[ ave(dfrm$v1, dfrm$v1, FUN =
>> function(x)rep(c(TRUE,FALSE),c(3,length(x)-3))), ]
>>
>> There's probably another 6 dozen ways to do it, especially if you
>> access packages like data.table, plyr, etc.
>>
>> Cheers,
>> Bert
>>
>>
>> Bert Gunter
>>
>> "Data is not information. Information is not knowledge. And knowledge
>> is certainly not wisdom."
>> -- Clifford Stoll
>>
>>
>> On Wed, Dec 2, 2015 at 12:26 PM, David Winsemius <dwinsem...@comcast.net> 
>> wrote:
>>>
>>>> On Dec 2, 2015, at 10:09 AM, Ragia Ibrahim <ragi...@hotmail.com> wrote:
>>>>
>>>> Dear Group,
>>>> I have a data frame that such as
>>>>
>>>> v1 v2 v3 v4
>>>> 1 1 3 6
>>>> 1 1 5 6
>>>> 1 1 8 0
>>>> 1 2 6 1
>>>> 1 2 4 0
>>>> 1 3 4 4
>>>> 1 3 5 4
>>>> 1 3 6 3
>>>> 1 3 7 1
>>>>
>>>> 2 4 3 7
>>>> 2 5 5 4
>>>> 2 5 8 2
>>>> 2 1 6 1
>>>> 2 1 4 0
>>>> 2 1 4 3
>>>> 2 1 5 2
>>>> 3 1 6 1
>>>> 3 6 7 0
>>>>
>>>> 3 6 3 6
>>>> 3 6 5 6
>>>> 3 6 8 0
>>>> 3 6 6 1
>>>> 3 2 4 0
>>>> 3 2 4 4
>>>> 3 2 5 4
>>>> 3 2 6 3
>>>> 3 2 7 1
>>>> 3 5 9 5
>>>> 3 6 9 5
>>>>
>>>>
>>>> the result required is each first 3 rows, from distinct v2 column for each 
>>>> v1 column
>>>>
>>>>
>>>> v1 v2 v3 v4
>>>> 1 1 3 6
>>>> 1 2 6 1
>>>> 1 3 4 4
>>>> 2 4 3 7
>>>> 2 5 5 4
>>>> 2 1 6 1
>>>> 3 6 3 6
>>>> 3 2 4 0
>>>> 3 5 9 5
>>>
>>>
>>> Probably something along the lines of
>>>
>>> dfrm[ ave(dfrm$v1, dfrm$v1, FUN=seq_along) %in% 1:3 , ]
>>>
>>>
>>>>
>>>>
>>>> thanks in advance
>>>> [[alternative HTML version deleted]]
>>>
>>> Future postings should be in plain text.
>>>
>>> —
>>>
>>> David Winsemius
>>> Alameda, CA, USA
>>>
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
  
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] Extracing Unique Rows based on 2 Column

2015-11-29 Thread Ragia Ibrahim
Dear group,
kindly,  I have a data frame, as follows:


 Measure_id i j value      rank
1           1 2 3   2.0 1.000
2           1 5 1   2.0 1.000
3           1 2 1   1.5 0.750
4           1 5 2   1.5 0.750
5           1 7 3   1.5 1.000
6           1 2 4   1.0 0.500
7           1 7 5   1.0 0.667
8           2 5 2   2.5 1.000
9           2 2 1   2.0 1.000
10          2 2 4   2.0 1.000
..        ... . .   ...       ...

I want to select distinct rows based on two coulmn ( Measure_id  and i )

for example for Measure_id  = 1,2  the result would be
1           1 2 3   2.0 1.000
2           1 5 1   2.0 1.000
5           1 7 3   1.5 1.000
8           2 5 2   2.5 1.000
9          2 2 1   2.0 1.000


kindly how I could do this?

example of the data frame are followed using dput.

dput(orderlist)

structure(list(Measure_id = c(1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 
2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 
5, 5, 5), i = c(2, 5, 2, 5, 7, 2, 7, 5, 2, 2, 7, 2, 5, 7, 2, 
2, 2, 5, 5, 7, 7, 2, 5, 2, 2, 5, 7, 7, 2, 2, 5, 2, 5, 7, 7), 
    j = c(3, 1, 1, 2, 3, 4, 5, 2, 1, 4, 5, 3, 1, 3, 1, 3, 4, 
    1, 2, 3, 5, 4, 2, 1, 3, 1, 3, 5, 1, 4, 2, 3, 1, 3, 5), value = c(2, 
    2, 1.5, 1.5, 1.5, 1, 1, 2.5, 2, 2, 2, 1.5, 1.5, 1, 1, 0, 
    0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1), 
    rank = c(1, 1, 0.75, 0.75, 1, 0.5, 0.667, 1, 
    1, 1, 1, 0.75, 0.6, 0.5, 1, 0, 0, NaN, NaN, NaN, NaN, 1, 
    1, 0, 0, 0, NaN, NaN, 1, 1, 1, 0.5, 0.5, 1, 1)), class = c("grouped_df", 
"tbl_df", "tbl", "data.frame"), row.names = c(NA, -35L), .Names = 
c("Measure_id", 
"i", "j", "value", "rank"), vars = list(Measure_id), indices = list(
    0:6, 7:13, 14:20, 21:27, 28:34), group_sizes = c(7L, 7L, 
7L, 7L, 7L), biggest_group_size = 7L, labels = structure(list(
    Measure_id = c(1, 2, 3, 4, 5)), class = "data.frame", row.names = c(NA, 
-5L), .Names = "Measure_id", vars = list(Measure_id)))




thanks in advance
Ragia 
__
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] {non} linear model solving

2015-11-16 Thread Ragia Ibrahim
appreciate replying.. I'll go through these packages documentation.
Regards


> Subject: Re: [R] {non} linear model solving
> From: dwinsem...@comcast.net
> Date: Mon, 16 Nov 2015 16:39:31 -0800
> CC: r.tur...@auckland.ac.nz; r-help@r-project.org
> To: ragi...@hotmail.com
>
>
>> On Nov 16, 2015, at 4:01 PM, Ragia Ibrahim <ragi...@hotmail.com> wrote:
>>
>> thanks for replying.
>>
>> the question about non linear model, I formed it incorrectly, I have a 
>> single objective multi constrain non linear model..I searched some R library 
>> to solve it, is there any tutorial step by step for such problem I can 
>> follow.
>
> I don’t see how this advances the discussion. It is hardly any more specific 
> than the vague question you posted earlier. There has already been quite a 
> bit of effort at building the CRAN Task Views and the Optimization Task View 
> should have popped up with any sort of effort on your part:
>
> https://cran.r-project.org/web/views/Optimization.html
>
> Any sort of specific response will require that you provide …… specifics.
>
> —
> David.
>>
>> Best Regards
>>
>> 
>>> Subject: Re: [R] linear model solving
>>> To: ragi...@hotmail.com; r-help@r-project.org
>>> From: r.tur...@auckland.ac.nz
>>> Date: Mon, 16 Nov 2015 21:55:18 +1300
>>>
>>> On 16/11/15 20:49, Ragia Ibrahim wrote:
>>>> Dear group IF I had an objective function and some constrains formed
>>>> in linear model form. is there a way,..library in R that helps me to
>>>> solve such amodel and find the unknown variable in it?
>>>
>>>
>>> This is a very ill-posed question and is unlikely to provoke any useful
>>> responses. If you can't make the effort to ask a clear, precise
>>> question, why should anyone make the effort to try to answer you? Even
>>> if they *could* answer you. Which they can't.
>>>
>>> (a) Frame a proper question, providing a minimal reproducible example.
>>>
>>> (b) Do some googling; don't expect others to do your work for you.
>>>
>>> cheers,
>>>
>>> Rolf Turner
>>>
>>> --
>>> Technical Editor ANZJS
>>> Department of Statistics
>>> University of Auckland
>>> Phone: +64-9-373-7599 ext. 88276
>>
>> __
>> 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.
>
> David Winsemius
> Alameda, CA, USA
>
  
__
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] linear model solving

2015-11-15 Thread Ragia Ibrahim
Dear group
IF I had an objective function and some constrains formed in linear model form. 
is there a way,..library in R that helps me to solve such amodel and find the 
unknown variable in it?

thanks in advance
Ragia 
__
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 maximum 3 rows by column elements in data frame

2015-11-09 Thread Ragia Ibrahim
Dear group,

I have the following data freame

dput(df_all_nodes)

structure(list(Measure_id = c(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 
2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 
3, 4, 5, 1, 2, 3, 4, 5), i = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 
7, 7, 7, 7, 7, 7, 7, 7, 7), j = c(1, 1, 1, 1, 1, 3, 3, 3, 3, 
3, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 
3, 3, 3, 3, 3, 5, 5, 5, 5, 5), value = c(1.5, 2, 1, 0, 2, 2, 
1.5, 0, 0, 1, 1, 2, 0, 1, 2, 2, 0.5, 1, 0, 2, 2, 1.5, 0, 0, 1, 
1.5, 2.5, 0, 1, 2, 1.5, 1, 0, 0, 1, 1, 2, 0, 0, 1), rank = c(0.75, 
1, 1, 0, 1, 1, 0.75, 0, 0, 0.5, 0.5, 1, 0, 1, 1, 1, 1, 1, NaN, 
1, 1, 0.6, NaN, 0, 0.5, 0.75, 1, NaN, 1, 1, 1, 0.5, NaN, NaN, 
1, 0.667, 1, NaN, NaN, 1)), .Names = c("Measure_id", 
"i", "j", "value", "rank"), row.names = c(NA, 40L), class = "data.frame")
> 

I want to get maximum 3 rows in each group of Measure_id. e.g. for measure_id 1 
get the max ranks  (select the max for each measure depending on the rank 
column).

how to do that
Best regards,
Ragia


  
__
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] group by function

2015-11-07 Thread Ragia Ibrahim
Dear group,
kindly, I have the following data frame

structure(c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 
3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1.5, 2, 1, 0, 2, 2, 1.5, 
0, 0, 1, 1, 2, 0, 1, 2), .Dim = c(15L, 3L), .Dimnames = list(
NULL, c("i", "Measure_id", "value")))



it has 3 coulmns
I used 
df$newcoulmn <-  ave(df$value, paste( df$i, df$Measure_id), FUN= 
function(x)   x/max(x) )


to get x /max(x) and calc probability.. but I want to do that for each source 
measure_id" separately  that means that rows 4,7,13 ..their value should be 
divided by 1.5 not 2..

rows 1,5,11 will be divided by  2 the max of their same group grouped by 
measure id 
 how to make such grouping

thanks in advance
Ragia 
[[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] group by function

2015-11-07 Thread Ragia Ibrahim
many thanks for replying,
yes I am kindly accept my pardon, I mistaken the rows from each other many 
thanks I will read them.
Ragia 


> Date: Sat, 7 Nov 2015 07:48:36 -0800
> Subject: Re: [R] group by function
> From: bgunter.4...@gmail.com
> To: ragi...@hotmail.com
> CC: r-help@r-project.org
>
> ??
> Row 4 has i = 2 and Measure_id =4 and therefore has value divided by
> the max of all values with that i and Measure_id, which is 1. Row 7
> has i =2 and Measure_id =2, and so is divided by the max value in all
> rows with those values of i and Measure_id, which is 2. etc. So either
> you do not understand ave() or you are incorrectly stating what you
> want.
>
> Incidentally, read ?ave, ?with and ?within. paste() is not needed and
> the call can be shortened to
>
> df <- within(df,newcol<-ave(value,i,Measure_id,FUN=function(x)x/max(x)))
>
> Finally, I suggest you learn to post in plain text (as the posting
> guide requests) to avoid possible mangling of your posts.
>
> Cheers,
> Bert
>
> Bert Gunter
>
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
> -- Clifford Stoll
>
>
> On Sat, Nov 7, 2015 at 6:32 AM, Ragia Ibrahim <ragi...@hotmail.com> wrote:
>> Dear group,
>> kindly, I have the following data frame
>>
>> structure(c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2,
>> 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1.5, 2, 1, 0, 2, 2, 1.5,
>> 0, 0, 1, 1, 2, 0, 1, 2), .Dim = c(15L, 3L), .Dimnames = list(
>> NULL, c("i", "Measure_id", "value")))
>>
>>
>>
>> it has 3 coulmns
>> I used
>> df$newcoulmn <- ave(df$value, paste( df$i, df$Measure_id), FUN= function(x) 
>> x/max(x) )
>>
>>
>> to get x /max(x) and calc probability.. but I want to do that for each 
>> source measure_id" separately that means that rows 4,7,13 ..their value 
>> should be divided by 1.5 not 2..
>>
>> rows 1,5,11 will be divided by 2 the max of their same group grouped by 
>> measure id
>> how to make such grouping
>>
>> thanks in advance
>> Ragia
>> [[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] kendall tau distance

2015-09-12 Thread Ragia Ibrahim
many thanks for replying.
 I have the vectors
 running the code

ConDisPairs( data.frame(c(1,2,3,4,5),c(3,4,1,2,5)) ) 

$pi.c
     [,1] [,2]
[1,]   12    0
[2,]    8    1
[3,]    7    3
[4,]    5    6
[5,]    0   10

$pi.d
     [,1] [,2]
[1,]    0   14
[2,]    3   12
[3,]    7    9
[4,]    8    5
[5,]   10    0

$C
[1] 69

$D
[1] 109


I could not find the result related to the result at wiki page in any 
way..looking for 4 ? dissimilar pairs?

many thanks


> From: dcarl...@tamu.edu
> To: ragi...@hotmail.com; r-help@r-project.org
> Subject: RE: [R] kendall tau distance
> Date: Fri, 11 Sep 2015 15:37:19 +
>
> The Wikipedia article gives a simple formula based on the number of 
> discordant pairs. You can get that from the ConDisPairs() function in package 
> DescTools.
>
> -
> 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 Ragia Ibrahim
> Sent: Thursday, September 10, 2015 12:40 PM
> To: r-help@r-project.org
> Subject: [R] kendall tau distance
>
> Dear group
> how to calculate kendall tau distance according to Kendall_tau_distance at 
> wikipedia
>
>  href="httpsen.wikipedia.orgwikiKendall_tau_distance" 
> target="_blank" 
> class="newlyinsertedlink">httpsen.wikipedia.orgwikiKendall_tau_distance
>
>
> thanks in advance
> Ragia
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
  
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] kendall tau distance

2015-09-10 Thread Ragia Ibrahim
Dear group
how to calculate  kendall tau distance according to  Kendall_tau_distance at 
wikipedia

 httpsen.wikipedia.orgwikiKendall_tau_distance
 


thanks in advance
Ragia 
__
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] groups Rank

2015-09-08 Thread Ragia Ibrahim

many thanks, It WORKS.

But

what If I want to add a condition that considered Measure_id , if it is '1'   
rank reverse the probability and if it is ' 2 ' rank is ordered like 
probability? 

Replying is highly appreciated 
Ragia

> From: petr.pi...@precheza.cz
> To: ragi...@hotmail.com; r-help@r-project.org
> Subject: RE: [R] groups Rank
> Date: Mon, 7 Sep 2015 09:29:21 +
>
> 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 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 Sa

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 <ragi...@hotmail.com> 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 <ragi...@hotmail.com> 
>>>> 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 
>>>>>

[R] dplyr question

2015-09-06 Thread Ragia Ibrahim
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.


[R] groups Rank

2015-09-04 Thread Ragia Ibrahim
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 valueRank1   1  4
0.332   1  40.333   1  6
0.54   1  60.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
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] result NA , but expected True or False

2015-08-09 Thread Ragia Ibrahim
Dear Group,
Kindly,

I have those two lines
if(  (z_nebla==0) ||  (z_nebla_dash==0) )
   CM - 0 else 

   CM -  0.5 *(1/a)  +   0.5*(1/b)  

when running it

I got this

z_nebla==0)
logical(0)
 (z_nebla_dash==0)
logical(0)
 (z_nebla==0) ||  (z_nebla_dash==0)
[1] NA


why  (z_nebla==0) ||  (z_nebla_dash==0)
gives me NA ?

thanks in advance
Ragia

  
[[alternative HTML version deleted]]

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


[R] Data frame Q

2015-08-09 Thread Ragia Ibrahim
 



Dear Group,
Kindly,
 I have the following 

Common_Friends - intersect(node_neighbours_i_out,node_neighbours_j_out)
 class(Common_Friends)
 print(Common_Friends)
 #4 = Common_Friends
   newline-c(i,   Common_Friends  )
 df- rbind(df,newline)

I created a data frame to add the new line

when   Common_Friends  =0 nothing add ?, how to force it to write the value 
into the data frame


Common_Friends - intersect(node_neighbours_i_out,node_neighbours_j_out)
  class(Common_Friends)
[1] numeric
  print(Common_Friends)
numeric(0)

newline-c(i,   Common_Friends  )
 newline
[1] 5
thanks in advance
Ragia


  
[[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] numeric of length 1

2015-06-23 Thread Ragia Ibrahim
Dear group,
I have the following object

 pr_sub$vector[1]
14 
0.07782809 

 class( pr_sub$vector[1])
[1] numeric

  length( pr_sub$vector[1])
[1] 1
how can I separate  pr_sub$vector[1]

and get 14 only

thanks in advance
Ragia
  
[[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] community

2015-06-15 Thread Ragia Ibrahim
Dear group
working on a graph..I parse the graph node by node and create cluster for set 
of nodes..firstly the number of clusters are not knowen
what kind of R object can I flexibly use as community, say I want M communities
C1,C2..CM
how can I define this ?

thanks in advance
Ragia
  
[[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] most frequent value

2015-06-14 Thread Ragia Ibrahim
Dear group,
I have the following integer object

 a 

3 4 6 
3 3 6 

how to get the most frequent value (it should be 3)

and get nothing if no frequent one and all is equal

3 4 6 
3 4 6 
Thanks in advance
Ragia
  
[[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] order matrix regarding its content.

2015-05-23 Thread Ragia Ibrahim
Dear group,
I have the following matrix

  1 2 3 4 5 6 7 8 9 10
1  0 1 1 1 1 1 1 1 1  1
2  0 0 0 1 1 0 0 0 0  0
3  0 0 0 1 1 1 1 1 1  1
4  0 0 0 0 1 0 0 0 0  0
5  0 0 0 0 0 0 0 0 0  0
6  0 0 0 0 0 0 1 1 1  1
7  0 0 0 0 0 0 0 1 1  0
8  0 0 0 0 0 0 0 0 1  0
9  1 1 1 1 1 1 1 1 1  1
10 0 0 0 0 0 0 0 0 0  0

how to order it according to ones and zeros to be ordered as if it all ones 
orpartially finally all zeros, like  the following or similar


9  1 1 1 1 1 1 1 1 1  1
1  0 1 1 1 1 1 1 1 1  1
3  0 0 0 1 1 1 1 1 1  1
6  0 0 0 0 0 0 1 1 1  1
2  0 0 0 1 1 0 0 0 0  0
7  0 0 0 0 0 0 0 1 1  0
4  0 0 0 0 1 0 0 0 0  0
8  0 0 0 0 0 0 0 0 1  0
5  0 0 0 0 0 0 0 0 0  0
10 0 0 0 0 0 0 0 0 0  0


thanks in advance
Ragia





  
[[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] order matrix regarding its content.

2015-05-23 Thread Ragia Ibrahim
Many thanks

 Date: Sat, 23 May 2015 11:55:07 +0200
 From: lig...@statistik.tu-dortmund.de
 To: ragi...@hotmail.com; r-help@r-project.org
 Subject: Re: [R] order matrix regarding its content.
 
 
 
 On 23.05.2015 11:10, Ragia Ibrahim wrote:
  Dear group,
  I have the following matrix
 
 1 2 3 4 5 6 7 8 9 10
  1  0 1 1 1 1 1 1 1 1  1
  2  0 0 0 1 1 0 0 0 0  0
  3  0 0 0 1 1 1 1 1 1  1
  4  0 0 0 0 1 0 0 0 0  0
  5  0 0 0 0 0 0 0 0 0  0
  6  0 0 0 0 0 0 1 1 1  1
  7  0 0 0 0 0 0 0 1 1  0
  8  0 0 0 0 0 0 0 0 1  0
  9  1 1 1 1 1 1 1 1 1  1
  10 0 0 0 0 0 0 0 0 0  0
 
  how to order it according to ones and zeros to be ordered as if it all ones 
  orpartially finally all zeros, like  the following or similar
 
 
   X[order(-rowSums(X)),]
 
 Best,
 Uwe Ligges
 
 
 
 
  9  1 1 1 1 1 1 1 1 1  1
  1  0 1 1 1 1 1 1 1 1  1
  3  0 0 0 1 1 1 1 1 1  1
  6  0 0 0 0 0 0 1 1 1  1
  2  0 0 0 1 1 0 0 0 0  0
  7  0 0 0 0 0 0 0 1 1  0
  4  0 0 0 0 1 0 0 0 0  0
  8  0 0 0 0 0 0 0 0 1  0
  5  0 0 0 0 0 0 0 0 0  0
  10 0 0 0 0 0 0 0 0 0  0
 
 
  thanks in advance
  Ragia
 
 
 
 
 
  
  [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
  
[[alternative HTML version deleted]]

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


[R] matrix inf and zero's value replacement

2015-05-13 Thread Ragia Ibrahim
Dear Group,
I have the following matrix
m
 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,]021  Inf  Inf  Inf  Inf  Inf
[2,]102  Inf  Inf  Inf  Inf  Inf
[3,]210  Inf  Inf  Inf  Inf  Inf
[4,]3210  Inf  Inf  Inf  Inf
[5,]  Inf  Inf  Inf  Inf0  Inf  Inf  Inf
[6,]  Inf  Inf  Inf  Inf10  Inf  Inf
[7,]  Inf  Inf  Inf  Inf  Inf  Inf0  Inf
[8,]132  Inf  Inf  Inf10

I want  all values grater than 0 = to 1 and zero other wise?
thanks in advance
so 
this used, 
m -ifelse(  (m==0)||  is.infinite(m),0, 1   )

but it gave me  zero   result
replacing
|| with | ,make sense and return the matrix I was looking for.

what is the difference betwen boht || an | ? when to use each ?

thanks in advance
  
[[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 sub elements

2015-05-10 Thread Ragia Ibrahim
Dear group 
I have this numeric object
allrecords 
1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 
28 29 
 1  1  2  1  3  1  1  2  5  4  1  6  8  1  2  1  3  3  2 13  1  4  2  4  7  1 
14  1  1 
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 
 1  1  2  2  1  1  2  2  2  9  3  1  1  3  6  1  4  1  3  9  2 


how can I extract only records between 9 and 5 values only  and put the record 
number n a vector

it should be vector 
thanks in advance
Ragia




  
[[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 the first row ?

2015-05-10 Thread Ragia Ibrahim
Dear group
kindly

I have a logical data type 
ISINFCluster:
1 2 3 4 5 6 7 8 910111213   
 14 
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
FALSE 
   15161718192021222324252627   
 28 
FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE 
FALSE 
   29303132333435363738394041   
 42 
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
FALSE 
   4344454647484950 
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 

and I want to get just number of records from those that has the  value true, 
thus 

 firstclass- all[ISINCluster]  
where  all is numeric object 
1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 
28 29 
 1  1  2  1  3  1  1  2  5  4  1  6  8  1  2  1  3  3  2 13  1  4  2  4  7  1 
14  1  1 
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 
 1  1  2  2  1  1  2  2  2  9  3  1  1  3  6  1  4  1  3  9  2 

the firstclass containes the following
firstclass
20 27 
13 14 

And I could not get the first row..
head(firstclass)
20 27 
13 14 


how can I got it?
thanks in advance
Ragia



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

2015-04-11 Thread Ragia Ibrahim





Dear group ,


I used the following code to download some tweets (1500)

library(twitteR)
library(ROAuth)
library(plyr)
library(stringr)
library(ggplot2)

## Windows users need to get this file
download.file(url=http://curl.haxx.se/ca/cacert.pem;, destfile=cacert.pem)

requestURL https://api.twitter.com/oauth/request_token;
   accessURL = https://api.twitter.com/oauth/access_token;
authURL = https://api.twitter.com/oauth/authorize;
consumerKey = secret
consumerSecret = secret
Cred - oauthfactory$new(consumerkey=
consumerSecret=consumerSecret,
 requestURL=requestURL,
 accessURL=accessURL,
 authURL=authURL)
Cred$handshake(cainfo = system.file(CurlSSL, cacert.pem, package = RCurl) 
)

registerTwitterOAuth(Cred)
save(Cred, file=twitter authentication.Rdata)

###

# Chunk - 2 - Twitter Scrape  


searchTwitter(  alhazm, n=1500   , cainfo=cacert.pem ) 

But I got the following error message

In doRppAPICall(search/tweets, n, params = params, retryOnRateLimit = 
retryOnRateLimit,  :
  500 tweets were requested but the API can only return 28

why ? and how I can Increase number of retreived tweets, many thanks


Ragia


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

2015-04-11 Thread Ragia Ibrahim
Dear group 
I used the following code to download some tweets (1500)
library(twitteR)
library(ROAuth)
library(plyr)
library(stringr)
library(ggplot2)

## Windows users need to get this file
download.file(url=http://curl.haxx.se/ca/cacert.pem;, destfile=cacert.pem)

requestURL https://api.twitter.com/oauth/request_token;
   accessURL = https://api.twitter.com/oauth/access_token;
authURL = https://api.twitter.com/oauth/authorize;
consumerKey = secret
consumerSecret = secret
Cred - oauthfactory$new(consumerkey=
consumerSecret=consumerSecret,
 requestURL=requestURL,
 accessURL=accessURL,
 authURL=authURL)
Cred$handshake(cainfo = system.file(CurlSSL, cacert.pem, package = RCurl) 
)

registerTwitterOAuth(Cred)
save(Cred, file=twitter authentication.Rdata)

###

# Chunk - 2 - Twitter Scrape  


searchTwitter(  alhazm, n=1500   , cainfo=cacert.pem ) 

But I got the following error message

In doRppAPICall(search/tweets, n, params = params, retryOnRateLimit = 
retryOnRateLimit,  :
  500 tweets were requested but the API can only return 28

why ? and how I can Increase number of retreived tweets, many thanks


Ragia

  
[[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] searchTwitter with unicode- UTF8

2015-04-10 Thread Ragia Ibrahim
Dear group
I uses 'searchTwitter'  to get users tweets it works  for English words such as 
(iphone)
but when working with Arabic   text
example
searchTwitter(�)   it gave me the following Error

Error in twInterfaceObj$doAPICall(cmd, params, GET, ...) : 
  Error: Forbidden


my questions  are
how to make it understand the unicode characters?
and if It is a hashtag should I write it that way #�

many thanks in advance
Ragia
  
[[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] sort adjacency matrix

2015-04-06 Thread Ragia Ibrahim
Dear group 
i have the following matrix

1  . . 1 . . 1 . . . .
2  . . . . . . 1 . . .
3  1 . . . 1 . . 1 . 1
4  . . . . . 1 . . . .
5  . . 1 . . . . . . 1
6  1 . . 1 . . . . 1 .
7  . 1 . . . . . 1 . .
8  . . 1 . . . 1 . . 1
9  . . . . . 1 . . . 1
10 . . 1 . 1 . . 1 1 .

I want to sort it according to ones in each row ascending (where max number of 
ones first)

to be as follow

3  1 . . . 1 . . 1 . 1
10 . . 1 . 1 . . 1 1 .
6  1 . . 1 . . . . 1 .8  . . 1 . . . 1 . . 11  . . 1 . . 1 . . . .5  . . 1 . . 
. . . . 17  . 1 . . . . . 1 . .9  . . . . . 1 . . . 12  . . . . . . 1 . . .4  . 
. . . . 1 . . . .

how can I do this in R
thanks in advance
  
[[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] sort adjacency matrix_with data

2015-04-06 Thread Ragia Ibrahim
Hi again
the data represents a  directed graph  represented in a matrix

e.g 
library(igraph)
g - forest.fire.game(10, fw.prob=0.3 , bw.factor=0.32/0.3, directed = TRUE)

m=get.adjacency(g , attr=NULL)
print(m)

--
many thanks and pardon me for multiple posts
Ragia

 Date: Mon, 6 Apr 2015 19:20:02 +0100
 From: ruipbarra...@sapo.pt
 To: ragi...@hotmail.com; r-help@r-project.org
 Subject: Re: [R] sort adjacency  matrix
 
 Hello,
 
 You should have used ?dput to post your data example.
 Since you haven't, I've made up one.
 
 set.seed(4795)
 mat - matrix(sample(0:1, 24, replace = TRUE), nrow = 6)
 mat
 
 inx - order(rowSums(mat), decreasing = TRUE)
 mat[inx, ]
 
 
 Hope this helps,
 
 Rui Barradas
 
 Em 06-04-2015 18:18, Ragia Ibrahim escreveu:
  Dear group
  i have the following matrix
 
  1  . . 1 . . 1 . . . .
  2  . . . . . . 1 . . .
  3  1 . . . 1 . . 1 . 1
  4  . . . . . 1 . . . .
  5  . . 1 . . . . . . 1
  6  1 . . 1 . . . . 1 .
  7  . 1 . . . . . 1 . .
  8  . . 1 . . . 1 . . 1
  9  . . . . . 1 . . . 1
  10 . . 1 . 1 . . 1 1 .
 
  I want to sort it according to ones in each row ascending (where max number 
  of ones first)
 
  to be as follow
 
  3  1 . . . 1 . . 1 . 1
  10 . . 1 . 1 . . 1 1 .
  6  1 . . 1 . . . . 1 .8  . . 1 . . . 1 . . 11  . . 1 . . 1 . . . .5  . . 1 
  . . . . . . 17  . 1 . . . . . 1 . .9  . . . . . 1 . . . 12  . . . . . . 1 . 
  . .4  . . . . . 1 . . . .
 
  how can I do this in R
  thanks in advance
  
  [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
  
[[alternative HTML version deleted]]

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


[R] creating matrix row by row

2015-03-28 Thread Ragia Ibrahim
 



Hi,
 I have a original adjacency  matrix  n X n , and I want to connect certain row 
with
 a set of other selected columns (could be not the same as in the 
original matrix).
this in each iteration I have a new row of this connections matrix , how to 
create this matrix.
having original row number and the numbers of columns that will be connected to.

e.g. 
   1 2 3 4 5
1  1 1 1 1 1
2  1 1 0 0 1
3
4
4

inf first iteration row 1 will have only connections to columns 2 and 5
and in secondly  row 2 will have only relation to column 2

how can I do this
thanks in advance


  
[[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] save program results and graphs to one file

2015-02-01 Thread Ragia Ibrahim

Dear group,

I have many plots and numeric results in my R program,  kindly how can I save 
them all sequently on one file.
thanks in advance
RAI
  
[[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] subscript out of bounds

2015-01-20 Thread Ragia Ibrahim
Hello,
kindly ,
how to catch this Error
Error in A[[i]] : subscript out of bounds
and check that the list is empty is.null( A[[i]] ) do no twork
 thanks in advance
R.I
  
[[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] union empty set with an element

2015-01-19 Thread Ragia Ibrahim
many thanks for replying
the code 
A is list of sets where each list element is a set
 i-1
A[i]-3
#inside the loop
 i-i+1;
 # for example  new element in the list will be {7,9}, each added 
separately inside the loop 
   A[i]  - union( A[[i]]   ,new element)

many thanks for replying

Regards
R.
 Subject: Re: [R] union empty set with an element
 From: b...@xs4all.nl
 Date: Mon, 19 Jan 2015 16:00:28 +0100
 CC: r-help@r-project.org
 To: ragi...@hotmail.com
 
 
  On 19-01-2015, at 15:51, Ragia Ibrahim ragi...@hotmail.com wrote:
  
  Hello,
  I started the program with an empty set then I add and element when needed.
  the problem how can I add the first element to the empty set
  union(set_name   ,element)
  gives subscript out of bounds �
  
 
 Which program did you start?
 Show us the code you used to get the error message.
 
 Berend
 
 
  thanks in advance
  R.

  [[alternative HTML version deleted]]
  
 
 Post in plain text, please.
 
  __
  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] union empty set with an element

2015-01-19 Thread Ragia Ibrahim
Hello,
I started the program with an empty set then I add and element when needed.
the problem how can I add the first element to the empty set
union(set_name   ,element)
gives subscript out of bounds 

thanks in advance
R.
  
[[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] union empty set with an element

2015-01-19 Thread Ragia Ibrahim
many thanks for replying
the code 
A is list of sets where each list element is a set
 i-1
A[i]-3
#inside the loop
 i-i+1;
 # for example  new element in the list will be {7,9}, each added 
separately inside the loop 
   A[i]  - union( A[[i]]   ,new element)

many thanks for replying

Regards
R.
 Subject: Re: [R] union empty set with an element
 From: b...@xs4all.nl
 Date: Mon, 19 Jan 2015 16:00:28 +0100
 CC: r-help@r-project.org
 To: ragi...@hotmail.com
 
 
  On 19-01-2015, at 15:51, Ragia Ibrahim ragi...@hotmail.com wrote:
  
  Hello,
  I started the program with an empty set then I add and element when needed.
  the problem how can I add the first element to the empty set
  union(set_name   ,element)
  gives subscript out of bounds �
  
 
 Which program did you start?
 Show us the code you used to get the error message.
 
 Berend
 
 
  thanks in advance
  R.

  [[alternative HTML version deleted]]
  
 
 Post in plain text, please.
 
  __
  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] list of lists, is this element empty

2014-12-20 Thread Ragia Ibrahim
Hello,
Kindly I have a list of lists as follow
x
[[1]]
[1] 7

[[2]]
[1] 3 4 5

as showen x[[3]] does not have a value and it has NULL, how can I check on this 
how to test if x[[3]] is empty.

thanks in advance
Ragia
  
[[alternative HTML version deleted]]

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


[R] data frame cumulative row sum

2014-12-08 Thread Ragia Ibrahim
Hi,
Kindly I had a data frame looks like this
x y  
1 3  
2 2  
3 1  
4 3  
and I want to add column z that sum cumulativly like this
x y z
1 3 3
2 2 5
3 1 6
4 3 9

how to do this?
Regards
Ragia
  
[[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] Generate random numbers under constrain

2014-11-22 Thread Ragia Ibrahim
 
Dear all,
I use R 3.1.1 for Windows.
kindly how can I generate n number of random numbers with probability from [0,1]
and their sum must not be more than one
thanks in advance
Ragia


  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] re arrange according to first positions

2014-08-28 Thread Ragia Ibrahim
Dear all,
I have a data frame, where multible process and ordering done  ..can I re 
arrange (re order ) it regarding  it' s original ROW index ? how?
example
   Xi  items numrber_list_items
38  8, 7, 3, 44
27 7, 3, 40
1   10  101
result should be starting from row index 1 to 3.

thanks in advance
Ragia
 
  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] local and global variables

2014-06-21 Thread Ragia Ibrahim
Dear group 
I have some thing like the following code...
##start
my_list (global object)

function 1
{
list1-mylist

function2(list1)
function3(list1)
function4(list1)
}

function2(list1)
{
assign values via - to the object items
}

function3(list1)
{
assign values via - to the object items
}
# end


why after finishing each function the object variable is NULL..how can i keep 
its values across functions.

Regardes
RAE
  
[[alternative HTML version deleted]]

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


[R] How to follow

2014-05-23 Thread Ragia Ibrahim


F 



Hi,
An R function that should be run for about 50 000 times...
during execution some data saved in data frame 
how can I view the progress of the function, even its counter..?
there are print stamens inside the code but nothing show up till the end of the 
run !!!
other thing, is there any way in R to make simulation easier?
thanks n advance
RAE

  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] select randomly from a list

2014-05-22 Thread Ragia Ibrahim
Hi,
kindly I want to select randomly and item from list of items. the list 
generated in a looping process. 
I used sample(mylist,1) it works fine. BUTsome times the list have only one 
item. that should be chosen in this case since there is no other one.
I found that sample return different item not included in the list
thanks in advance
RAE
  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Cure and data type

2014-05-14 Thread Ragia Ibrahim
Hi,
I have a simple table of age and frequency
What data type should I use to represent this kind of data in R, and kindly how 
can I plot it in a curve
thanks in advance
RAE
  
[[alternative HTML version deleted]]

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


[R] data presentation -curve

2014-05-14 Thread Ragia Ibrahim
dear group,
I had  table of ages and their related frequancy.
What data type  can I use to reoresent ir? Can I plot it in curve ?
thanks in advance
ARE 
  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] variable length lisin in data frame

2014-05-10 Thread Ragia Ibrahim
Dear Group,
I have data like the following

id   contacts_list   number of contacts
---
1   3 4   2
2   1 3 43
34 2 1   3
411
--


can you kindly please sugest a data type in R to use for it?
i thought about data frame that consists of a  list element. but  lists are not 
in  the same length, any  solutions?
thanks in advance
RAE
  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] uniform number

2014-05-04 Thread Ragia Ibrahim

Dear group,
How to generate  uniform probability choosing p to be 2% and 5%, in separate 
trials for 100 times.
thanks in advance
RAE


 
  
[[alternative HTML version deleted]]

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


[R] how should the program looks like?

2014-02-19 Thread Ragia Ibrahim
Hi,


I used to write C++ code. write what i want in a function ..pass pointers if i 
want to change the object real value...

here i want to ask
in R, igraphshould i write the script as lines without functions..to change 
graph attributes or edges attributes or some values of the nodes ?
 should i pass copy of the graph each time i write a function ?
how should the program looks like?
RAE


 
  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.