Re: [R] Missing Values in Table Statement

2015-06-11 Thread PIKAL Petr
Hi

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Shivi82
> Sent: Friday, June 12, 2015 8:28 AM
> To: r-help@r-project.org
> Subject: Re: [R] Missing Values in Table Statement
>
> Hi Petr,
>
> Probably i did not explain my scenario clearly.
>  table(test$ORIGIN_NAME,is.na(test$SCH_TIME)) is the syntax with which

This is what **I** get.

> table(test$ORIGIN_NAME,is.na(test$SCH_TIME))
Error in table(test$ORIGIN_NAME, is.na(test$SCH_TIME)) :
  object 'test' not found
>

> i am trying to find per destination wise how many instances are there
> where system failed to enter the scheduled delivery time & there are
> multiple cases of these. I am expecting an output where TRUE and FALSE

As I said output of table is not logical but numeric.

> will give number of observations either missing or non-missing.
>
> ORIGIN ORIGIN_NAME DESTINATION  DESTINATION_NM  RPS_NO
> DLI11DELHI-11   NDA50  NOIDA-50
> 1350760
> NDA50NOIDA-50 DLI11DELHI-11
> 1352692
>
>
> SCH_TIME  ACTUAL_DEP_DATE ACTUAL_DEP_TIME WAYBILLS TOTAL_PKG ACTUAL_WT
> CHG_WT
> 6:00 13/03/20156:30  -
> 0  00
> 21:30   15/03/2015   13:37 28
> 256   3419   3730
>
>
> Hopefully i am able to make my self now clear. Thank you.

Not really.

Cheers
Petr


>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Missing-
> Values-in-Table-Statement-tp4708534p4708537.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 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.
__

Re: [R] Missing Values in Table Statement

2015-06-11 Thread Shivi82
Hi Petr,

Probably i did not explain my scenario clearly.
 table(test$ORIGIN_NAME,is.na(test$SCH_TIME)) is the syntax with which i am
trying to find per destination wise how many instances are there where
system failed to enter the scheduled delivery time & there are multiple
cases of these. I am expecting an output where TRUE and FALSE will give
number of observations either missing or non-missing. 

ORIGIN ORIGIN_NAME DESTINATION  DESTINATION_NM  RPS_NO
DLI11DELHI-11   NDA50  NOIDA-50
1350760
NDA50NOIDA-50 DLI11DELHI-11
1352692 


SCH_TIME  ACTUAL_DEP_DATE ACTUAL_DEP_TIME WAYBILLS TOTAL_PKG ACTUAL_WT
CHG_WT
6:00 13/03/20156:30  -  
0  00
21:30   15/03/2015   13:37 28   
256   3419   3730


Hopefully i am able to make my self now clear. Thank you. 







--
View this message in context: 
http://r.789695.n4.nabble.com/Missing-Values-in-Table-Statement-tp4708534p4708537.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] Missing Values in Table Statement

2015-06-11 Thread PIKAL Petr
Hi

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Shivi82
> Sent: Friday, June 12, 2015 7:41 AM
> To: r-help@r-project.org
> Subject: [R] Missing Values in Table Statement
>
> HI All,
>
> I need help on 2 issues as highlighted below"
>
> A)I have 2 variables:- Sch_Time & Origin Name.
> Now there are multiple instances where Scheduled time i.e. Sch_Time is
> missing from each location hence i need to count how many instances do
> i have split on location.
> the code i have is :
> table(test$ORIGIN_NAME,is.na(test$SCH_TIME))
> but with code it is not giving any value as TRUE & in FALSE all the
> values are total count of scheduled departure.

Table gives you count for each category of a factor. You say that you want 
count instances but then you complain you get them. I am puzzled.

>
> Could you please suggest what should be the solution for the same.
> Would it be because of var i am dealing with as result of
> typeof(test$ORIGIN_NAME) &
> typeof(test$SCH_TIME) both result to character.
>
> B) In the cross table can we show the proportion of values under each
> head as in %.
> table(test$CR_DT)/10765*100. Here i am trying to find how many values
> appearing on a date basis where 10765 is my total data count.

see also ?prop.table


>
> Kindly let me know if i need to supply dput data. Thank you!!!

It is way easier to understand your problem with reproducible example for which 
data is important part.

Cheers
Petr

>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Missing-
> Values-in-Table-Statement-tp4708534.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 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-

[R] Missing Values in Table Statement

2015-06-11 Thread Shivi82
HI All,

I need help on 2 issues as highlighted below"

A)I have 2 variables:- Sch_Time & Origin Name.
Now there are multiple instances where Scheduled time i.e. Sch_Time is
missing from each location hence i need to count how many instances do i
have split on location. 
the code i have is :
table(test$ORIGIN_NAME,is.na(test$SCH_TIME)) 
but with code it is not giving any value as TRUE & in FALSE all the values
are total count of scheduled departure.

Could you please suggest what should be the solution for the same. Would it
be because of var i am dealing with as result of typeof(test$ORIGIN_NAME) &
typeof(test$SCH_TIME) both result to character. 

B) In the cross table can we show the proportion of values under each head
as in %. 
table(test$CR_DT)/10765*100. Here i am trying to find how many values
appearing on a date basis where 10765 is my total data count.

Kindly let me know if i need to supply dput data. Thank you!!!




--
View this message in context: 
http://r.789695.n4.nabble.com/Missing-Values-in-Table-Statement-tp4708534.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] accessing the ellements in an array and factors.

2015-06-11 Thread David Winsemius
Cross-posting to SO and Rhelp is deprecated.

On Jun 11, 2015, at 8:40 PM, Bogdan Tanasa wrote:

> Dear all,
> 
> please could you please with a simple question : I do have an array of 32
> elements, where each element is indexed by a name : eg :
> 
> list_triplet_wells <-c("A1:A2:A3", "A4:A5:A6 ",  "A7:A8:A9",   "A10:A11:A12
> ")
> xxx <-array(0, dim=4)
> dimnames(xxx) = list(list_triplet_wells)
> 
>> From another script, I have an output like :
> 
>> yyy
> [1]   A1:A2:A3B4:B5:B6
> 31 Levels:   B4:B5:B6A1:A2:A3  ...   F4:F5:F6
> 
> so yyy seems to be a factor type. I would need to call the elements of xxx
> array based on the elements of yyy; eg xxx[yyy].
> 
> How can I do this in order to circumvent the factor type of yyy ? Thanks a
> lot,
> 
> bogdan
> 
>   [[alternative HTML version deleted]]
> 

As is posting in HTML.

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

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] accessing the ellements in an array and factors.

2015-06-11 Thread Bogdan Tanasa
Dear all,

please could you please with a simple question : I do have an array of 32
elements, where each element is indexed by a name : eg :

list_triplet_wells <-c("A1:A2:A3", "A4:A5:A6 ",  "A7:A8:A9",   "A10:A11:A12
")
xxx <-array(0, dim=4)
dimnames(xxx) = list(list_triplet_wells)

>From another script, I have an output like :

> yyy
[1]   A1:A2:A3B4:B5:B6
31 Levels:   B4:B5:B6A1:A2:A3  ...   F4:F5:F6

so yyy seems to be a factor type. I would need to call the elements of xxx
array based on the elements of yyy; eg xxx[yyy].

How can I do this in order to circumvent the factor type of yyy ? Thanks a
lot,

bogdan

[[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] for loop incorrect row count

2015-06-11 Thread John Kane
Hi Kevin,

I don't even pretend to try to read it.  If David is having a problem I am 
going for tea.

I think we need some sample data (see ?dput for the best way to supply it) and 
an succinct description in English of what the problem is and what you need to 
get out of the data. 

I suspect because you are so used to programming in other languages you are 
jumping into one approach before you should. R can be very weird indeed for 
those used to working with "sensible" languages.  

Also have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html for some general suggestions 
about questions on the list etc.

BTW, the reason for using dput()  is that it provides a 'perfect' copy of your 
data.  Other ways of submitting sample data are less satisfactory. For example 
I tend to use 1 of 2 ways to read in text data especially if I am just grabbing 
some data from a problem on R-help and I may read in the data okay if I use one 
method  or, if for some reason I use the other method I might read in some data 
as numeric that should be a factor, etc. which makes troubleshooting just a bit 
difficult.  And which method I use can be a crap shoot. 


John Kane
Kingston ON Canada


> -Original Message-
> From: dwinsem...@comcast.net
> Sent: Thu, 11 Jun 2015 16:48:40 -0700
> To: k.kowit...@icloud.com
> Subject: Re: [R] for loop incorrect row count
> 
> 
> On Jun 11, 2015, at 12:25 PM, Kevin Kowitski wrote:
> 
>> Hey,
>> 
>>   I am having an issue with a for loop that is intended to read index
>> values by row and column so that it can pull out the valuable
>> information.  My issue is that I am using a data.frame(which(df==1,
>> arr.ind=TRUE))
> 
> That would be coercing a matrix to a dataframe. But why?
> 
> 
>> to find the index of the values in my data frame that are equal to 1.
>> This outputs a data frame of 71 rows which is confirmed by the "nrows"
>> function.  However, when I try to break up the rows and columns using
>> the code below I am producing two vectors of 75 values, even though
>> there are only 71 and the for loop is from 1 to the value of 71.  Am I
>> making this task more complicated than it needs to be?
>> 
>> if(countRaw > 0){
> 
> How the value of countRow enters into this is entirely unclear.
> 
>>  index_R_df<-rbind( index_R_df, 
>> data.frame(which(sapply(data2[0:24,],
> 
> R does NOT use zero-based indexing.
> 
> 
>> match, INDString, nomatch=0)==1, arr.ind=TRUE)))
> 
> You need to explain what you are doing here. It's a bit too obscure to me
> how we should know that index_R_df will line up with the items would drop
> out of:
> 
> data.frame(which(sapply(data2[0:24,],match, INDString, nomatch=0)==1,
> arr.ind=TRUE)))
> 
> I would have expected some `name` to be followed by `[` then `which(...)`
> 
> 
>>  index_lengthR<-nrow(index_R_df)
>> 
>>  for (j in 1:index_lengthR){
>>  index_rowsR<-c(index_rowsR, 
>> index_R_df[j,1])
>>  index_colsR<-c(index_colsR, 
>> index_R_df[j,2])
>>  #rowsPass_R<-c(unique(index_rowsR))
>>  #collect_rows<-c(collect_rows, 
>> rowsPass_R)
>>  }
>> 
> 
> There are too many missing here for me to do anything useful. You are
> either only giving us a fragment of code and using zero based  indexing.
> Without a data example, I'm throwing it back to you ot someone in the
> readership with better intuition or imagination than I possess.
> 
> 
>> I'm sorry if this seems very novice, I'm new to R.
>> 
>> -Kevin
>> __
>> 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.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas 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.


Re: [R] for loop incorrect row count

2015-06-11 Thread Bert Gunter
Oh, Swami, gazing into the crystal ball one can see ...


;-}

Cheers,
Bert

Bert Gunter

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

On Thu, Jun 11, 2015 at 4:48 PM, David Winsemius 
wrote:

>
> On Jun 11, 2015, at 12:25 PM, Kevin Kowitski wrote:
>
> > Hey,
> >
> >   I am having an issue with a for loop that is intended to read index
> values by row and column so that it can pull out the valuable information.
> My issue is that I am using a data.frame(which(df==1, arr.ind=TRUE))
>
> That would be coercing a matrix to a dataframe. But why?
>
>
> > to find the index of the values in my data frame that are equal to 1.
> This outputs a data frame of 71 rows which is confirmed by the "nrows"
> function.  However, when I try to break up the rows and columns using the
> code below I am producing two vectors of 75 values, even though there are
> only 71 and the for loop is from 1 to the value of 71.  Am I making this
> task more complicated than it needs to be?
> >
> > if(countRaw > 0){
>
> How the value of countRow enters into this is entirely unclear.
>
> >   index_R_df<-rbind( index_R_df,
> data.frame(which(sapply(data2[0:24,],
>
> R does NOT use zero-based indexing.
>
>
> > match, INDString, nomatch=0)==1, arr.ind=TRUE)))
>
> You need to explain what you are doing here. It's a bit too obscure to me
> how we should know that index_R_df will line up with the items would drop
> out of:
>
> data.frame(which(sapply(data2[0:24,],match, INDString, nomatch=0)==1,
> arr.ind=TRUE)))
>
> I would have expected some `name` to be followed by `[` then `which(...)`
>
>
> >   index_lengthR<-nrow(index_R_df)
> >
> >   for (j in 1:index_lengthR){
> >   index_rowsR<-c(index_rowsR,
> index_R_df[j,1])
> >   index_colsR<-c(index_colsR,
> index_R_df[j,2])
> >   #rowsPass_R<-c(unique(index_rowsR))
> >   #collect_rows<-c(collect_rows,
> rowsPass_R)
> >   }
> >
>
> There are too many missing here for me to do anything useful. You are
> either only giving us a fragment of code and using zero based  indexing.
> Without a data example, I'm throwing it back to you ot someone in the
> readership with better intuition or imagination than I possess.
>
>
> > I'm sorry if this seems very novice, I'm new to R.
> >
> > -Kevin
> > __
> > 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.
>

[[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] Boxplot function error-help required

2015-06-11 Thread John Kane
Thanks Don,

I suspected there was a Boxplot() out there by was too lazy to look.  I still 
don't see how the original code would work if label only had onevalue but I 
must admit what Boxplot() is actually doing is still confusing me.

John Kane
Kingston ON Canada


> -Original Message-
> From: macque...@llnl.gov
> Sent: Thu, 11 Jun 2015 21:44:39 +
> To: kris.si...@research.uwa.edu.au, r-help@r-project.org
> Subject: Re: [R] Boxplot function error-help required
> 
> In addition to the other answers, I would suggest that the next time you
> get the "could not find function" message, try like this:
> 
>  help.search('Boxplot')
> 
> Among the output from that you should see
> 
>   graphics::boxplot Box Plots
> 
> which should lead you to "boxplot" instead of "Boxplot".
> 
> 
> You may see considerably more output from help.search(), depending on
> what
> packages you have installed. For example, when I did it, I found that the
> car package has a function named "Boxplot".
> 
> -Don
> 
> 
> --
> Don MacQueen
> 
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> 925-423-1062
> 
> 
> 
> 
> 
> On 6/11/15, 4:20 AM, "Kris Singh"  wrote:
> 
> >Dear Sirm/Madam,
>> 
> >Just wondering if someone could help me.  I've tried running a code on R
> >and the code includes the following:
>> 
>>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>> 
> >But I receive the following  error message:
>> 
> >*Error: could not find function "Boxplot"*
>> 
> >I have tried installing all the packages but keep getting teh same error
> >message.  The code runs on my supervisors R program and produces a
> >boxplot,
> >but doesn't on mine and am wondering if someone could assist me.
>> 
> >Thanks in advance,
> >Kris
>> 
> >--
> >*Kris Singh*
> >Provisional Psychologist
>> 
> >MPsych (Clinical Neuropsychology) / PhD Candidate
> >Sanders Building, Room 1.10
> >University of Western Australia
> >35 Stirling Highway
> >Crawley WA 6009
>> 
> >Phone: (08) 6488 1418
> >Email: kris.si...@research.uwa.edu.au
>> 
> > [[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.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
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] for loop incorrect row count

2015-06-11 Thread David Winsemius

On Jun 11, 2015, at 12:25 PM, Kevin Kowitski wrote:

> Hey, 
> 
>   I am having an issue with a for loop that is intended to read index values 
> by row and column so that it can pull out the valuable information.  My issue 
> is that I am using a data.frame(which(df==1, arr.ind=TRUE))

That would be coercing a matrix to a dataframe. But why?


> to find the index of the values in my data frame that are equal to 1.  This 
> outputs a data frame of 71 rows which is confirmed by the "nrows" function.  
> However, when I try to break up the rows and columns using the code below I 
> am producing two vectors of 75 values, even though there are only 71 and the 
> for loop is from 1 to the value of 71.  Am I making this task more 
> complicated than it needs to be? 
> 
> if(countRaw > 0){

How the value of countRow enters into this is entirely unclear.

>   index_R_df<-rbind( index_R_df, 
> data.frame(which(sapply(data2[0:24,],

R does NOT use zero-based indexing.


> match, INDString, nomatch=0)==1, arr.ind=TRUE)))

You need to explain what you are doing here. It's a bit too obscure to me how 
we should know that index_R_df will line up with the items would drop out of:

data.frame(which(sapply(data2[0:24,],match, INDString, nomatch=0)==1, 
arr.ind=TRUE)))

I would have expected some `name` to be followed by `[` then `which(...)`


>   index_lengthR<-nrow(index_R_df)
>   
>   for (j in 1:index_lengthR){
>   index_rowsR<-c(index_rowsR, 
> index_R_df[j,1])
>   index_colsR<-c(index_colsR, 
> index_R_df[j,2])
>   #rowsPass_R<-c(unique(index_rowsR))
>   #collect_rows<-c(collect_rows, 
> rowsPass_R)
>   }
> 

There are too many missing here for me to do anything useful. You are either 
only giving us a fragment of code and using zero based  indexing. Without a 
data example, I'm throwing it back to you ot someone in the readership with 
better intuition or imagination than I possess.


> I'm sorry if this seems very novice, I'm new to R. 
> 
> -Kevin
> __
> 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] GAMM - error when using spline smoother, only allowed to use tensor product

2015-06-11 Thread Hannah Linder
Hello,

I am familiar with the basics of statistical regression models, including
GAMs, but I am stumped on a particular implementation issue.

I am constructing a GAMM to fit to data that is autocorrelated. On of my
covariates (covariate "4") is a sin function the represents time of day. It
is simply: sin.t <- sin(2*pi*seq(TT)/12), in this case TT is equal to my
number of data points, which is 336.

When I initially created a gamm model for my data, the equation looked as
shown:

gam=gamm(data1~s(covariates[1,],bs="cc")+s(covariates[3,],bs="cs")+s(covariates[4,],bs="cc"),family=gaussian(),correlation
= corARMA(p=2,q=0))

Note: Covariate "1" is a Julian day count, and covariate "3" is tidal range.

No matter how I change anything else about the equation, unless I change
the smoother to a tensor product for covariate 4 (i.e.,
te(covariates[4,])), I receive the following error:

Error in na.fail.default(list(Xr.1 = c(-0.00539071823269798,
0.00735538093451461,  :
  missing values in object
In addition: Warning message:
In sqrt(D) : NaNs produced

Does anyone know what may be going on? In addition, my data fit is much
better when I don't treat the sin covariate as cyclic, but that doesn't
seem appropriate to me, because a sin is naturally cyclic.

Any help is much appreciate, thank-you for your time!

Hannah

[[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] for loop incorrect row count

2015-06-11 Thread Kevin Kowitski

Hey, 

  I am having an issue with a for loop that is intended to read index values by row and 
column so that it can pull out the valuable information.  My issue is that I am using a 
data.frame(which(df==1, arr.ind=TRUE)) to find the index of the values in my data frame 
that are equal to 1.  This outputs a data frame of 71 rows which is confirmed by the 
"nrows" function.  However, when I try to break up the rows and columns using 
the code below I am producing two vectors of 75 values, even though there are only 71 and 
the for loop is from 1 to the value of 71.  Am I making this task more complicated than 
it needs to be? 

if(countRaw > 0){

index_R_df<-rbind(index_R_df,data.frame(which(sapply(data2[0:24,], match, 
INDString, nomatch=0)==1, arr.ind=TRUE)))
index_lengthR<-nrow(index_R_df)

for (j in 1:index_lengthR){
index_rowsR<-c(index_rowsR, 
index_R_df[j,1])
index_colsR<-c(index_colsR, 
index_R_df[j,2])
#rowsPass_R<-c(unique(index_rowsR))
#collect_rows<-c(collect_rows, 
rowsPass_R)
}

I'm sorry if this seems very novice, I'm new to R. 

-Kevin
__
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] Getting XML Data From Sharepoint

2015-06-11 Thread David Wagle
I'm trying, and so far failing, to extract data from a very large
SharePoint list.

I have a URL for getting XML from sharepoint:

http://
/_vti_bin/owssvr.dll?Cmd=Display&List={GUID}&Query=*&XMLDATA=TRUE

When I do something like the following:

require(XML)
require(RCurl)

URL <- "http://
/_vti_bin/owssvr.dll?Cmd=Display&List={GUID}&Query=*&XMLDATA=TRUE"
data = xmlParse(readLines(URL)


I get an authorization error back:

Error in file(con, "r") : cannot open the connection
In file(con, "r") : cannot open: HTTP status was '401 Unauthorized'

No problem I modifty things to this:

URL <- "http://
/_vti_bin/owssvr.dll?Cmd=Display&List={GUID}&XMLDATA=TRUE"
w <- getURL(URL, userpwd="uname:password")
myDataFrame <- xmlParse(w)
.
.
.

it returns with:

internal error: Huge input lookup
internal error: Huge input lookup
Extra content at the end of the document


Help!

Thanks in advance

-- 
David A. Wagle
cell: 952-607-71741
linkedin: http://www.linkedin.com/in/davidwagle/

[[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] powerTransform Convergence erro

2015-06-11 Thread Brittany Demmitt
Hi John,

That does help, thanks!

Brittany


> On Jun 11, 2015, at 4:02 PM, John Fox  wrote:
> 
> Dear Brittany,
> 
> There is an essentially perfect linear dependency among the variables in your 
> data (note the last eigenvalue, which is 0 within rounding error):
> 
>> eigen(cor(problem.data.boxcox[,-1]), only.values=TRUE)
> $values
> [1]  3.644257e+00  1.821582e+00  1.712152e+00  1.205091e+00  1.007231e+00  
> 9.231163e-01  9.048724e-01
> [8]  8.718398e-01  8.379187e-01  7.371353e-01  6.334100e-01  5.235629e-01  
> 4.757997e-01  4.246831e-01
> [15]  2.773471e-01 -2.802502e-16
> 
> In addition, some of your variables have many tied values at the bottom of 
> their distributions, making them very poor candidates for normalizing power 
> transformations; for example,
> 
>> sum(problem.data.boxcox$variable2 == 1)
> [1] 626
> 
> I hope this helps,
> John
> 
> 
> John Fox, Professor
> McMaster University
> Hamilton, Ontario, Canada
> http://socserv.mcmaster.ca/jfox/
>   
>   
> 
> On Thu, 11 Jun 2015 09:37:57 -0600
> Brittany Demmitt  wrote:
>> Hi John,
>> 
>> Thank you so much for the info!  I have attached the data in .csv format 
>> that is giving me the warning along with the command that I am running.  It 
>> i a data frame with 1510 sample IDs and then their values for 16 variables.  
>> I am trying to transform the 16 variables.  I do not receive the warning 
>> when I run each variable independently, just when I run the entire dataframe 
>> at once.  However, I have run this command with other larger data frames all 
>> at once with no warnings, so I am not sure why it is not working now.
>> 
>> Any help is appreciated!  Thanks! :-)
>> 
>> Britt
>> 
>> Commands Run:
>> 
>> #read in the data frame
>> problem.data.boxcox <- read.csv(“problem.data.boxcox.csv")
>> 
>> #run a power transformation  (I do not run that on the first column because 
>> it is just sample ids)
>> 
>> problem.data.boxcox.pT <- powerTransform(problem.data.boxcox[,-1])
>> 
>> Warning message:
>> In estimateTransform(x, y, NULL, ...) :
>>  Convergence failure: return code = 1
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> On Jun 10, 2015, at 2:15 PM, John Fox  wrote:
>>> 
>>> Dear Brittany,
>>> 
>>> As explained in ?powerTransform, this function uses optim() to optimize a 
>>> generalized Box-Cox criterion. For explanation of return codes, see ?optim. 
>>> 
>>> In particular, code 1 indicates that the maximum number of iterations was 
>>> exceeded. Although you might try increasing the permitted number of 
>>> iterations or otherwise tweaking the arguments to optim(), your problem is 
>>> probably ill-conditioned in some manner that is impossible to know without 
>>> more information, such as your data.
>>> 
>>> I hope this helps,
>>> John
>>> 
>>> 
>>> John Fox, Professor
>>> McMaster University
>>> Hamilton, Ontario, Canada
>>> http://socserv.mcmaster.ca/jfox/
>>> 
>>> 
>>> On Wed, 10 Jun 2015 10:54:30 -0600
>>> Brittany Demmitt  wrote:
 Hello,
 
 I am trying to use the powerTransform function in the package car to 
 identify the lambda: transform my data.  However, I receive the following 
 warning:
 
 Warning message:
 In estimateTransform(x, y, NULL, ...) :
 Convergence failure: return code = 1
 
 I can not find a description of what return code =1  means for the car 
 package.  How do I look that up, or does anyone know what the warning 
 means?
 
 Thank you so much!
 
 Brittany
[[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] Boxplot function error-help required

2015-06-11 Thread David Winsemius

On Jun 11, 2015, at 2:44 PM, MacQueen, Don wrote:

> In addition to the other answers, I would suggest that the next time you
> get the "could not find function" message, try like this:
> 
> help.search('Boxplot')

 Spencer Graves uses RSiteSearch() as the underlying function for sos::findFn

-- 
David.
> 
> Among the output from that you should see
> 
>  graphics::boxplot Box Plots
> 
> which should lead you to "boxplot" instead of "Boxplot".
> 
> 
> You may see considerably more output from help.search(), depending on what
> packages you have installed. For example, when I did it, I found that the
> car package has a function named "Boxplot".
> 
> -Don
> 
> 
> -- 
> Don MacQueen
> 
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> 925-423-1062
> 
> 
> 
> 
> 
> On 6/11/15, 4:20 AM, "Kris Singh"  wrote:
> 
>> Dear Sirm/Madam,
>> 
>> Just wondering if someone could help me.  I've tried running a code on R
>> and the code includes the following:
>> 
>>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>> 
>> But I receive the following  error message:
>> 
>> *Error: could not find function "Boxplot"*
>> 
>> I have tried installing all the packages but keep getting teh same error
>> message.  The code runs on my supervisors R program and produces a
>> boxplot,
>> but doesn't on mine and am wondering if someone could assist me.
>> 
>> Thanks in advance,
>> Kris
>> 
>> -- 
>> *Kris Singh*
>> Provisional Psychologist
>> 
>> MPsych (Clinical Neuropsychology) / PhD Candidate
>> Sanders Building, Room 1.10
>> University of Western Australia
>> 35 Stirling Highway
>> Crawley WA 6009
>> 
>> Phone: (08) 6488 1418
>> Email: kris.si...@research.uwa.edu.au
>> 
>>  [[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.

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.


Re: [R] powerTransform Convergence erro

2015-06-11 Thread John Fox
Dear Brittany,

There is an essentially perfect linear dependency among the variables in your 
data (note the last eigenvalue, which is 0 within rounding error):

> eigen(cor(problem.data.boxcox[,-1]), only.values=TRUE)
$values
 [1]  3.644257e+00  1.821582e+00  1.712152e+00  1.205091e+00  1.007231e+00  
9.231163e-01  9.048724e-01
 [8]  8.718398e-01  8.379187e-01  7.371353e-01  6.334100e-01  5.235629e-01  
4.757997e-01  4.246831e-01
[15]  2.773471e-01 -2.802502e-16

In addition, some of your variables have many tied values at the bottom of 
their distributions, making them very poor candidates for normalizing power 
transformations; for example,

> sum(problem.data.boxcox$variable2 == 1)
[1] 626

I hope this helps,
 John


John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/



On Thu, 11 Jun 2015 09:37:57 -0600
 Brittany Demmitt  wrote:
> Hi John,
> 
> Thank you so much for the info!  I have attached the data in .csv format that 
> is giving me the warning along with the command that I am running.  It i a 
> data frame with 1510 sample IDs and then their values for 16 variables.  I am 
> trying to transform the 16 variables.  I do not receive the warning when I 
> run each variable independently, just when I run the entire dataframe at 
> once.  However, I have run this command with other larger data frames all at 
> once with no warnings, so I am not sure why it is not working now.
> 
> Any help is appreciated!  Thanks! :-)
> 
> Britt
> 
> Commands Run:
> 
> #read in the data frame
> problem.data.boxcox <- read.csv(“problem.data.boxcox.csv")
> 
> #run a power transformation  (I do not run that on the first column because 
> it is just sample ids)
> 
> problem.data.boxcox.pT <- powerTransform(problem.data.boxcox[,-1])
> 
> Warning message:
> In estimateTransform(x, y, NULL, ...) :
>   Convergence failure: return code = 1
> 
> 
> 
> 
> 
> 
> 
> 
> 
> > On Jun 10, 2015, at 2:15 PM, John Fox  wrote:
> > 
> > Dear Brittany,
> > 
> > As explained in ?powerTransform, this function uses optim() to optimize a 
> > generalized Box-Cox criterion. For explanation of return codes, see ?optim. 
> > 
> > In particular, code 1 indicates that the maximum number of iterations was 
> > exceeded. Although you might try increasing the permitted number of 
> > iterations or otherwise tweaking the arguments to optim(), your problem is 
> > probably ill-conditioned in some manner that is impossible to know without 
> > more information, such as your data.
> > 
> > I hope this helps,
> > John
> > 
> > 
> > John Fox, Professor
> > McMaster University
> > Hamilton, Ontario, Canada
> > http://socserv.mcmaster.ca/jfox/
> > 
> > 
> > On Wed, 10 Jun 2015 10:54:30 -0600
> > Brittany Demmitt  wrote:
> >> Hello,
> >> 
> >> I am trying to use the powerTransform function in the package car to 
> >> identify the lambda: transform my data.  However, I receive the following 
> >> warning:
> >> 
> >> Warning message:
> >> In estimateTransform(x, y, NULL, ...) :
> >>  Convergence failure: return code = 1
> >> 
> >> I can not find a description of what return code =1  means for the car 
> >> package.  How do I look that up, or does anyone know what the warning 
> >> means?
> >> 
> >> Thank you so much!
> >> 
> >> Brittany
> >>[[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] Boxplot function error-help required

2015-06-11 Thread David Winsemius

On Jun 11, 2015, at 2:19 PM, John Kane wrote:

> Well it might have worked for your supervisor but I don't see how.  
> 
> As was mentioned it is boxplot , not Boxplot and the rest of the syntax looks 
> dodgy to say the least.

There is a "Boxplot" function in package 'car' and it has a labels argument 
which would be partially matched by a label argument, since it precedes the 
dots in the arglist.

So I would try this:


library(car)
Boxplot(~Acc_S$Acc, label=Acc_S$Subj)

-- 
David.

> 
> Try 
> boxplot(Acc_S$Subj ~ Acc_S$Acc)
> 
> I don't see how label = will work , ?boxplot says it should be names = and as 
> the code stands even that would be redundant.  
> 
> In any case here is a quick and dirty example that seems to work. 
> 
> dat1  <-  data.frame(aa = sample(letters[1:4], 20, replace = TRUE), bb = 
> rnorm(20), cc = rnorm(20) )
> boxplot(dat1$bb~ dat1$aa, names = c("alpha", "beta", "gamma", "delta"))
> 
> 
> Have a look at 
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>  and http://adv-r.had.co.nz/Reproducibility.html
> for some suggestions on how to ask questions here.
> 
> Good luck
> 
> 
> 
> John Kane
> Kingston ON Canada
> 
> 
>> -Original Message-
>> From: kris.si...@research.uwa.edu.au
>> Sent: Thu, 11 Jun 2015 19:20:46 +0800
>> To: r-help@r-project.org
>> Subject: [R] Boxplot function error-help required
>> 
>> Dear Sirm/Madam,
>> 
>> Just wondering if someone could help me.  I've tried running a code on R
>> and the code includes the following:
>> 
>>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>> 
>> But I receive the following  error message:
>> 
>> *Error: could not find function "Boxplot"*
>> 
>> I have tried installing all the packages but keep getting teh same error
>> message.  The code runs on my supervisors R program and produces a
>> boxplot,
>> but doesn't on mine and am wondering if someone could assist me.
>> 
>> Thanks in advance,
>> Kris
>> 
>> --
>> *Kris Singh*
>> Provisional Psychologist
>> 
>> MPsych (Clinical Neuropsychology) / PhD Candidate
>> Sanders Building, Room 1.10
>> University of Western Australia
>> 35 Stirling Highway
>> Crawley WA 6009
>> 
>> Phone: (08) 6488 1418
>> Email: kris.si...@research.uwa.edu.au
>> 
>>  [[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.

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.


Re: [R] Boxplot function error-help required

2015-06-11 Thread MacQueen, Don
In addition to the other answers, I would suggest that the next time you
get the "could not find function" message, try like this:

 help.search('Boxplot')

Among the output from that you should see

  graphics::boxplot Box Plots

which should lead you to "boxplot" instead of "Boxplot".


You may see considerably more output from help.search(), depending on what
packages you have installed. For example, when I did it, I found that the
car package has a function named "Boxplot".

-Don


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 6/11/15, 4:20 AM, "Kris Singh"  wrote:

>Dear Sirm/Madam,
>
>Just wondering if someone could help me.  I've tried running a code on R
>and the code includes the following:
>
>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>
>But I receive the following  error message:
>
>*Error: could not find function "Boxplot"*
>
>I have tried installing all the packages but keep getting teh same error
>message.  The code runs on my supervisors R program and produces a
>boxplot,
>but doesn't on mine and am wondering if someone could assist me.
>
>Thanks in advance,
>Kris
>
>-- 
>*Kris Singh*
>Provisional Psychologist
>
>MPsych (Clinical Neuropsychology) / PhD Candidate
>Sanders Building, Room 1.10
>University of Western Australia
>35 Stirling Highway
>Crawley WA 6009
>
>Phone: (08) 6488 1418
>Email: kris.si...@research.uwa.edu.au
>
>   [[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] Boxplot function error-help required

2015-06-11 Thread John Kane
Well it might have worked for your supervisor but I don't see how.  

As was mentioned it is boxplot , not Boxplot and the rest of the syntax looks 
dodgy to say the least.

Try 
boxplot(Acc_S$Subj ~ Acc_S$Acc)

I don't see how label = will work , ?boxplot says it should be names = and as 
the code stands even that would be redundant.  

In any case here is a quick and dirty example that seems to work. 

 dat1  <-  data.frame(aa = sample(letters[1:4], 20, replace = TRUE), bb = 
rnorm(20), cc = rnorm(20) )
boxplot(dat1$bb~ dat1$aa, names = c("alpha", "beta", "gamma", "delta"))


Have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html
 for some suggestions on how to ask questions here.

Good luck



John Kane
Kingston ON Canada


> -Original Message-
> From: kris.si...@research.uwa.edu.au
> Sent: Thu, 11 Jun 2015 19:20:46 +0800
> To: r-help@r-project.org
> Subject: [R] Boxplot function error-help required
> 
> Dear Sirm/Madam,
> 
> Just wondering if someone could help me.  I've tried running a code on R
> and the code includes the following:
> 
>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
> 
> But I receive the following  error message:
> 
> *Error: could not find function "Boxplot"*
> 
> I have tried installing all the packages but keep getting teh same error
> message.  The code runs on my supervisors R program and produces a
> boxplot,
> but doesn't on mine and am wondering if someone could assist me.
> 
> Thanks in advance,
> Kris
> 
> --
> *Kris Singh*
> Provisional Psychologist
> 
> MPsych (Clinical Neuropsychology) / PhD Candidate
> Sanders Building, Room 1.10
> University of Western Australia
> 35 Stirling Highway
> Crawley WA 6009
> 
> Phone: (08) 6488 1418
> Email: kris.si...@research.uwa.edu.au
> 
>   [[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.


Re: [R] Problem with Volcanoplot

2015-06-11 Thread John Kane
Do you already have an R package that will do a  Spearman
Correlation Volcano plot ?

What do the data look like?

Have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html
for some suggestions on how to ask a question on the R-help list.


Welcome to R and the R-help list.

John Kane
Kingston ON Canada


> -Original Message-
> From: gabinpier...@yahoo.fr
> Sent: Thu, 11 Jun 2015 15:05:34 + (UTC)
> To: r-help@r-project.org
> Subject: [R] Problem with Volcanoplot
> 
> Hi all,
> I have a data frame composed by 25 numerical variables. I want to do a
> Spearman Correlation Volcano plot (i. e. x = correlation coefficient and
> y = -log10(p value))
> I'm a begginer in R, so how can I do this ?
> PS : Sorry for my English, this is not my mother tongue.
> 
> Thank you !
>   [[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 MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas 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.


Re: [R] Problem with Volcanoplot

2015-06-11 Thread Bert Gunter
Start by going through an R tutorial or two? You need to do some minimal
homework BEFORE posting here.

Cheers,
Bert

Bert Gunter

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

On Thu, Jun 11, 2015 at 8:05 AM, Pierlot Gabin 
wrote:

> Hi all,
> I have a data frame composed by 25 numerical variables. I want to do a
> Spearman Correlation Volcano plot (i. e. x = correlation coefficient and y
> = -log10(p value))
> I'm a begginer in R, so how can I do this ?
> PS : Sorry for my English, this is not my mother tongue.
>
> Thank you !
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

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


Re: [R] Boxplot function error-help required

2015-06-11 Thread Richard M. Heiberger
R is case sensitive.

try "boxplot" not "Boxplot"

On Thu, Jun 11, 2015 at 7:20 AM, Kris Singh
 wrote:
> Dear Sirm/Madam,
>
> Just wondering if someone could help me.  I've tried running a code on R
> and the code includes the following:
>
>> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)
>
> But I receive the following  error message:
>
> *Error: could not find function "Boxplot"*
>
> I have tried installing all the packages but keep getting teh same error
> message.  The code runs on my supervisors R program and produces a boxplot,
> but doesn't on mine and am wondering if someone could assist me.
>
> Thanks in advance,
> Kris
>
> --
> *Kris Singh*
> Provisional Psychologist
>
> MPsych (Clinical Neuropsychology) / PhD Candidate
> Sanders Building, Room 1.10
> University of Western Australia
> 35 Stirling Highway
> Crawley WA 6009
>
> Phone: (08) 6488 1418
> Email: kris.si...@research.uwa.edu.au
>
> [[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.


[R] Problem in ksvm prediction

2015-06-11 Thread bharath
Dear all,

I am using ksvm in R for SVM classification. I trained the SVM classifier
with prob.model=TRUE. I have the two following outputs when I predicted.

1) label<-predict(model, TestData)
 I have classification accuracy about 93%, where as in another mode

2) Probvalues<-predict(model, TestData, type="probabilities")
label<-max.col(Probvalues)

  I have the classification accuracy of 74%.

 I don't why there is a difference in two modes. It will be better if have
predict probability scores also for me.

Please let me know how to rectify the error or what could be the reason for
this difference?

Thanks in Advance

With Regards

Bharath Bhushan D



--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-in-ksvm-prediction-tp4708504.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] Problem with Volcanoplot

2015-06-11 Thread Pierlot Gabin
Hi all, 
I have a data frame composed by 25 numerical variables. I want to do a Spearman 
Correlation Volcano plot (i. e. x = correlation coefficient and y = -log10(p 
value))
I'm a begginer in R, so how can I do this ?
PS : Sorry for my English, this is not my mother tongue.

Thank you !
[[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] poLCA - Latent Class Analysis - How long should analysis take?

2015-06-11 Thread Steven King
This is the script i am working from.

library(poLCA) f <-
cbind(bq70,bq72_1,bq72_2,bq72_3,bq72_4,bq72_5,bq72_6,bq72_7,bq73a_1,bq73a_2,bq73a_3,bq73a_4)~
zq88+zq89+dm_zq101_2+dm_zq101_3+dm_zq101_4+dm_zq101_5+dm_zq101_6+dm_zq101_7+dm_zq101_8+dm_zq101_9
for(i in 2:14){max_II<--100 min_bic<-10 for(j in 1:1024){
res<-poLCA(f,BESDATA,nclass=i,maxiter =1000,tol =
1e-5,na.rm=FALSE,probs.start=NULL,nrep=1,verbose=TRUE,calc.se=TRUE) if(res
bichttps://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] Quantile regression model with nonparametric effect and interaction

2015-06-11 Thread Waltl, Sofie (sofie.wa...@uni-graz.at)
The idea is to move from regional dummies interacted with time dummies (model 
1) to a smooth spline (defined on longitudes and latitudes) interacted with 
time dummies (model 2), i.e.,

Model 1: Log p ~ X\beta + REGION*YEAR
Model 2: Log p ~ X\beta + f(long, lat)*YEAR

Estimating the f's in a loop therefore does not really help...

-Original Message-
From: Roger Koenker [mailto:rkoen...@illinois.edu] 
Sent: Donnerstag, 11. Juni 2015 15:33
To: Waltl, Sofie (sofie.wa...@uni-graz.at)
Cc: r-help@r-project.org
Subject: Re: [R] Quantile regression model with nonparametric effect and 
interaction

The main effect trend seems rather dangerous,  why not just estimate the f's in 
a loop?

url:www.econ.uiuc.edu/~rogerRoger Koenker
emailrkoen...@uiuc.eduDepartment of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Urbana, IL 61801


> On Jun 11, 2015, at 1:57 AM, Waltl, Sofie (sofie.wa...@uni-graz.at) 
>  wrote:
> 
> Dear all,
> 
> I would like to estimate a quantile regression model including a 
> bivariate nonparametric term which should be interacted with a dummy 
> variable, i.e., log p ~ year + f(a,b):year.
> I tried to use Roger Koenker's quantreg package and the functions rqss and 
> qss but it turns out that interactions are not possible in this setting. Also 
> weights are not implemented yet to build a work-around. I am looking for 
> something like the by-statement in Simon Wood's package mgcv. Does anything 
> comparable exist?
> I am grateful for any help on this issue.
> 
> Kind regards,
> S. Waltl
> 
> 
>   [[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] graphs, need urgent help (deadline :( )

2015-06-11 Thread Jim Lemon
Rosa Oliveira wrote:

> Dear Jim,
>
> when I run your code (even the one you send me, not in my data), I get:
>
> Don't know how to automatically pick scale for object of type function. 
> Defaulting to continuous
> Error in data.frame(x = c(0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1,  :
>  arguments imply differing number of rows: 24, 0

Well, let's agree on the data first. Using your original dataset:

my.data<-read.table(text="region sample factora factorb factorc
 0.1  10  0.895   0.903   0.378
 0.2  10  0.811   0.865   0.688
 0.1  20  0.735   0.966   0.611
 0.2  20  0.777   0.732   0.653
 0.1  30  0.600   0.778   0.694
 0.2  30  0.466   174.592 0.461
 0.1  40  0.446   0.432   0.693
 0.2  40  0.392   0.294   0.686",header=TRUE)
library(plotrix)
par(tcl=-0.1)
gap.plot(x=rep(seq(10,45,by=5),3),
 y=unlist(my.data[,c("factora","factorb","factorc")]),
 main="A plot of factorial mystery",
 gap=c(1.1,174),ylim=c(0,175),ylab="factor score",xlab="Group",
 xticlab=c(" \n0.1\n10"," \n0.2\n10"," \n0.1\n20"," \n0.2\n20",
  " \n0.1\n30"," \n0.2\n30"," \n0.1\n40"," \n0.2\n40"),
 ytics=c(0,0.5,1,174.59),pch=rep(1:3,each=8),col=rep(c(4,2,3),each=8))
mtext(c("Region","Sample"),side=1,at=6,line=c(0,1))
lines(seq(10,45,by=5),my.data$factora,col=4)
lines(seq(10,45,by=5),my.data$factorb[c(1:5,NA,7,8)],col=2)
lines(seq(10,45,by=5),my.data$factorc,col=3)
legend(18,1.8,c("factora","factorb","factorc"),pch=1:3,col=c(4,2,3))

This produces a plot, and I realize that it is not the one you
describe. As before, if you can let us know what is wrong with it,
maybe we can fix it.

Jim

__
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] Boxplot function error-help required

2015-06-11 Thread Kris Singh
Dear Sirm/Madam,

Just wondering if someone could help me.  I've tried running a code on R
and the code includes the following:

> Boxplot(~Acc_S$Acc, label=Acc_S$Subj)

But I receive the following  error message:

*Error: could not find function "Boxplot"*

I have tried installing all the packages but keep getting teh same error
message.  The code runs on my supervisors R program and produces a boxplot,
but doesn't on mine and am wondering if someone could assist me.

Thanks in advance,
Kris

-- 
*Kris Singh*
Provisional Psychologist

MPsych (Clinical Neuropsychology) / PhD Candidate
Sanders Building, Room 1.10
University of Western Australia
35 Stirling Highway
Crawley WA 6009

Phone: (08) 6488 1418
Email: kris.si...@research.uwa.edu.au

[[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] Different behavior of model.matrix between R 3.2 and R3.1.1

2015-06-11 Thread Therneau, Terry M., Ph.D.

Frank,
  I'm not sure what is going on.  The following test function works for me in both 3.1.1 
and 3.2, i.e, the second model matrix has fewer columns.  As I indicated to you earlier, 
the coxph code removes the strata() columns after creating X because I found it easier to 
correctly create the assign attribute.


  Can you create a worked example?

require(survival)
testfun <- function(formula, data) {
tform <- terms(formula, specials="strata")
mf <- model.frame(tform, data)

terms2 <- terms(mf)
strat <- untangle.specials(terms2, "strata")
if (length(strat$terms)) terms2 <- terms2[-strat$terms]
X <- model.matrix(terms2, mf)
X
}

tdata <- data.frame(y= 1:10, zed = 1:10, grp = factor(c(1,1,1,2,2,2,1,1,3,3)))

testfun(y ~ zed*grp, tdata)

testfun(y ~ strata(grp)*zed, tdata)


Terry T.

- original message --

For building design matrices for Cox proportional hazards models in the
cph function in the rms package I have always used this construct:

Terms <- terms(formula, specials=c("strat", "cluster", "strata"), data=data)
specials <- attr(Terms, 'specials')
stra<- specials$strat
Terms.ns <- Terms
 if(length(stra)) {
   temp <- untangle.specials(Terms.ns, "strat", 1)
   Terms.ns <- Terms.ns[- temp$terms]#uses [.terms function
 }
X <- model.matrix(Terms.ns, X)[, -1, drop=FALSE]

The Terms.ns logic removes stratification factor "main effects" so that
if a stratification factor interacts with a non-stratification factor,
only the interaction terms are included, not the strat. factor main
effects. [In a Cox PH model stratification goes into the nonparametric
survival curve part of the model].

Lately this logic quit working; model.matrix keeps the unneeded main
effects in the design matrix.  Does anyone know what changed in R that
could have caused this, and possibly a workaround?


---

__
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] Quantile regression model with nonparametric effect and interaction

2015-06-11 Thread Roger Koenker
The main effect trend seems rather dangerous,  why not just estimate the f’s in 
a loop?

url:www.econ.uiuc.edu/~rogerRoger Koenker
emailrkoen...@uiuc.eduDepartment of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Urbana, IL 61801


> On Jun 11, 2015, at 1:57 AM, Waltl, Sofie (sofie.wa...@uni-graz.at) 
>  wrote:
> 
> Dear all,
> 
> I would like to estimate a quantile regression model including a bivariate 
> nonparametric term which should be interacted with a dummy variable, i.e.,
> log p ~ year + f(a,b):year.
> I tried to use Roger Koenker's quantreg package and the functions rqss and 
> qss but it turns out that interactions are not possible in this setting. Also 
> weights are not implemented yet to build a work-around. I am looking for 
> something like the by-statement in Simon Wood's package mgcv. Does anything 
> comparable exist?
> I am grateful for any help on this issue.
> 
> Kind regards,
> S. Waltl
> 
> 
>   [[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] Summarizing data based on Date

2015-06-11 Thread Shivi82
Thank you John for spending time on this query and helping out.

It really helped me and finally i am able to achieve the desired results.
Thanks a ton to all others as well to spending time and furbishing solution.

Regards, Shivi



--
View this message in context: 
http://r.789695.n4.nabble.com/Summarizing-data-based-on-Date-tp4708328p4708500.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] Issue with mcapply

2015-06-11 Thread AROONALOK PYNE
Thanks a lot Rainer

On Thu, Jun 11, 2015 at 4:24 PM, Rainer M Krug  wrote:

>
> Again: please keep this on r-help!
>
> AROONALOK PYNE  writes:
>
> > Hi,
> >
> > My system has 4GB memory. On running htop command on linux terminal,  for
> > c(999), a() rug on single cpu core showed stats for 100% cpu
> > utilization. On reaching b(), the entire system hanged (no response and
> the
> > cpu utilization froze at 100%, RAM utilization never crossed 1.5 GB)
>
> Please read up on memory allocation in R. top (and htop) are not
> appropriate to see if R has memory or not as vectors need to be
> allocated in consecutive blocks.
>
> There have been several questions about this on this list.
>
> Cheers,
>
> Rainer
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :   +33 - (0)9 53 10 27 44
> Cell:   +33 - (0)6 85 62 59 98
> Fax :   +33 - (0)9 58 10 27 44
>
> Fax (D):+49 - (0)3 21 21 25 22 44
>
> email:  rai...@krugs.de
>
> Skype:  RMkrug
>
> PGP: 0x0F52F982
>



-- 
*AROONALOK PYNE*

BE Graduate
Department Of Computer Science And Engineering
Jadavpur University, Kolkata-32
India

[[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] Issue with mcapply

2015-06-11 Thread Rainer M Krug

Again: please keep this on r-help!

AROONALOK PYNE  writes:

> Hi,
>
> My system has 4GB memory. On running htop command on linux terminal,  for
> c(999), a() rug on single cpu core showed stats for 100% cpu
> utilization. On reaching b(), the entire system hanged (no response and the
> cpu utilization froze at 100%, RAM utilization never crossed 1.5 GB)

Please read up on memory allocation in R. top (and htop) are not
appropriate to see if R has memory or not as vectors need to be
allocated in consecutive blocks.

There have been several questions about this on this list.

Cheers,

Rainer

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


signature.asc
Description: PGP signature
__
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] Fwd: Issue with mcapply

2015-06-11 Thread AROONALOK PYNE
-- Forwarded message --
From: AROONALOK PYNE 
Date: Thu, Jun 11, 2015 at 3:49 PM
Subject: Re: Issue with mcapply
To: Rainer M Krug 


Hi,

My system has 4GB memory. On running htop command on linux terminal,  for
c(999), a() rug on single cpu core showed stats for 100% cpu
utilization. On reaching b(), the entire system hanged (no response and the
cpu utilization froze at 100%, RAM utilization never crossed 1.5 GB)



-- 
*AROONALOK PYNE*

BE Graduate
Department Of Computer Science And Engineering
Jadavpur University, Kolkata-32
India

[[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] Fwd: Issue with mcapply

2015-06-11 Thread AROONALOK PYNE
-- Forwarded message --
From: AROONALOK PYNE 
Date: Thu, Jun 11, 2015 at 2:25 PM
Subject: Re: Issue with mcapply
To: Rainer M Krug 


R version 3.0.2 (2013-09-25)


Large value : 999


I rerun the code as c(1000) for which your machine works fine but
my code still hangs on reaching b(). I am running it from Linux
Terminal.


On Thu, Jun 11, 2015 at 2:15 PM, Rainer M Krug  wrote:

> AROONALOK PYNE  writes:
>
> > Please check this code :
> >
> > library(parallel)
> > workerFunc <- function(n) { return(n^2) }
> > a <- function(){
> >   CurrentTime <- Sys.time()
> >   res <- lapply(values, workerFunc)
> >   TimeTaken <- Sys.time() - CurrentTime
> >   print(TimeTaken)
> > }
> > b <- function(){
> >   CurrentTime <- Sys.time()
> >   numWorkers <- detectCores()
> >   res <- mclapply(values, workerFunc, mc.cores = numWorkers-2)
> >   TimeTaken <- Sys.time() - CurrentTime
> >   print(TimeTaken)
> > }
> > c <- function(n){
> >   values <<- 1:n
> >   print("Evaluating a : ")
> >   a()
> >   print("Evaluating b : ")
> >   b()
> > }
> >
> > For large values of n, the code calculates a() but the hangs indefinitely
> > on reaching b(). How do I correct it ?
> > I am using Ubuntu 14.04 and core i7 Processor
>
> Which version of R and what are "large values"?
>
> I just did the following successfully:
>
> ,
> | > c(100)
> | [1] "Evaluating a : "
> | Time difference of 0.0002059937 secs
> | [1] "Evaluating b : "
> | Time difference of 0.02037406 secs
> | > c(1000)
> | [1] "Evaluating a : "
> | Time difference of 0.001929998 secs
> | [1] "Evaluating b : "
> | Time difference of 0.01943302 secs
> | > c(100)
> | [1] "Evaluating a : "
> | Time difference of 1.822959 secs
> | [1] "Evaluating b : "
> | Time difference of 1.46111 secs
> | > c(1000)
> | [1] "Evaluating a : "
> | Time difference of 23.55863 secs
> | [1] "Evaluating b : "
> | Time difference of 15.90938 secs
> | >
> `
>
> Cheers,
>
> Rainer
> --
> Rainer M. Krug
> email: Rainerkrugsde
> PGP: 0x0F52F982
>



-- 
*AROONALOK PYNE*

BE Graduate
Department Of Computer Science And Engineering
Jadavpur University, Kolkata-32
India





-- 
*AROONALOK PYNE*

BE Graduate
Department Of Computer Science And Engineering
Jadavpur University, Kolkata-32
India

[[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] Issue with mcapply

2015-06-11 Thread Rainer M Krug
Please keep this on the r-help mailing list.

AROONALOK PYNE  writes:

> R version 3.0.2 (2013-09-25)
>
>
> Large value : 999
>
>
> I rerun the code as c(1000) for which your machine works fine but
> my code still hangs on reaching b(). I am running it from Linux
> Terminal.

Might be memory allocation issue (hardware)? I have 1GB of memory. If I
am not mistaken, all the data is copied into different R threads when
using mclapply - so the memory requirement is much bigger.

Cheers,

Rainer


>
>
> On Thu, Jun 11, 2015 at 2:15 PM, Rainer M Krug  wrote:
>
>> AROONALOK PYNE  writes:
>>
>> > Please check this code :
>> >
>> > library(parallel)
>> > workerFunc <- function(n) { return(n^2) }
>> > a <- function(){
>> >   CurrentTime <- Sys.time()
>> >   res <- lapply(values, workerFunc)
>> >   TimeTaken <- Sys.time() - CurrentTime
>> >   print(TimeTaken)
>> > }
>> > b <- function(){
>> >   CurrentTime <- Sys.time()
>> >   numWorkers <- detectCores()
>> >   res <- mclapply(values, workerFunc, mc.cores = numWorkers-2)
>> >   TimeTaken <- Sys.time() - CurrentTime
>> >   print(TimeTaken)
>> > }
>> > c <- function(n){
>> >   values <<- 1:n
>> >   print("Evaluating a : ")
>> >   a()
>> >   print("Evaluating b : ")
>> >   b()
>> > }
>> >
>> > For large values of n, the code calculates a() but the hangs indefinitely
>> > on reaching b(). How do I correct it ?
>> > I am using Ubuntu 14.04 and core i7 Processor
>>
>> Which version of R and what are "large values"?
>>
>> I just did the following successfully:
>>
>> ,
>> | > c(100)
>> | [1] "Evaluating a : "
>> | Time difference of 0.0002059937 secs
>> | [1] "Evaluating b : "
>> | Time difference of 0.02037406 secs
>> | > c(1000)
>> | [1] "Evaluating a : "
>> | Time difference of 0.001929998 secs
>> | [1] "Evaluating b : "
>> | Time difference of 0.01943302 secs
>> | > c(100)
>> | [1] "Evaluating a : "
>> | Time difference of 1.822959 secs
>> | [1] "Evaluating b : "
>> | Time difference of 1.46111 secs
>> | > c(1000)
>> | [1] "Evaluating a : "
>> | Time difference of 23.55863 secs
>> | [1] "Evaluating b : "
>> | Time difference of 15.90938 secs
>> | >
>> `
>>
>> Cheers,
>>
>> Rainer
>> --
>> Rainer M. Krug
>> email: Rainerkrugsde
>> PGP: 0x0F52F982
>>

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


signature.asc
Description: PGP signature
__
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] Issue with mcapply

2015-06-11 Thread Rainer M Krug
AROONALOK PYNE  writes:

> Please check this code :
>
> library(parallel)
> workerFunc <- function(n) { return(n^2) }
> a <- function(){
>   CurrentTime <- Sys.time()
>   res <- lapply(values, workerFunc)
>   TimeTaken <- Sys.time() - CurrentTime
>   print(TimeTaken)
> }
> b <- function(){
>   CurrentTime <- Sys.time()
>   numWorkers <- detectCores()
>   res <- mclapply(values, workerFunc, mc.cores = numWorkers-2)
>   TimeTaken <- Sys.time() - CurrentTime
>   print(TimeTaken)
> }
> c <- function(n){
>   values <<- 1:n
>   print("Evaluating a : ")
>   a()
>   print("Evaluating b : ")
>   b()
> }
>
> For large values of n, the code calculates a() but the hangs indefinitely
> on reaching b(). How do I correct it ?
> I am using Ubuntu 14.04 and core i7 Processor

Which version of R and what are "large values"?

I just did the following successfully:

,
| > c(100)
| [1] "Evaluating a : "
| Time difference of 0.0002059937 secs
| [1] "Evaluating b : "
| Time difference of 0.02037406 secs
| > c(1000)
| [1] "Evaluating a : "
| Time difference of 0.001929998 secs
| [1] "Evaluating b : "
| Time difference of 0.01943302 secs
| > c(100)
| [1] "Evaluating a : "
| Time difference of 1.822959 secs
| [1] "Evaluating b : "
| Time difference of 1.46111 secs
| > c(1000)
| [1] "Evaluating a : "
| Time difference of 23.55863 secs
| [1] "Evaluating b : "
| Time difference of 15.90938 secs
| >
`

Cheers,

Rainer
-- 
Rainer M. Krug
email: Rainerkrugsde
PGP: 0x0F52F982


signature.asc
Description: PGP signature
__
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] Summarizing data based on Date

2015-06-11 Thread PIKAL Petr
Hi

I (wrongly) understood that Shivi82 wanted to summarise on month values. 
Therefore

format(test$CR_DT,"%m")

shall give you month number and list is required by aggregate.

All the problem was  in

test$CHG_WT

which seems to be a factor (for whatever reason)

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of John
> Kane
> Sent: Tuesday, June 09, 2015 6:42 PM
> To: Shivi82; r-help@r-project.org
> Subject: Re: [R] Summarizing data based on Date
>
> Hi,
>
> As David said have a look at str(test). You have a factor in there or
> else that weird "list(format(test$CR_DT,"%m"))" command in aggregate()
> is mucking things up.  What is "list(format(test$CR_DT,"%m"))" intended
> to do?  No ,a quick test says it is mucking something else up and not
> giving the us the factor problem.
>
> Here is your sample data and what I think is what you are trying to do.
> Note the data is supplied in dput() format which is the preferred way
> to supply sample data to the R-help list.  See
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-
> reproducible-example and http://adv-r.had.co.nz/Reproducibility.html
> for more information.  I used lubridate's dmy() function rather than
> as.Date() to format the dates.
>
> dat1  <-  structure(list(dd = structure(c(1426204800, 142776,
> 1426377600, 1426550400, 1426550400, 1426032000, 1426032000,
> 1426723200), tzone = "UTC", class = c("POSIXct", "POSIXt")), wt = c(0,
> 0, 0, 770, 3.73, 70, 10, 500)), .Names = c("dd", "wt"), row.names =
> c(NA, -8L), class = "data.frame")
>
> str(dat1)
>
> aggregate(dat1$wt, list(dat1$dd), sum)
>
>
> John Kane
> Kingston ON Canada
>
>
> > -Original Message-
> > From: shivibha...@ymail.com
> > Sent: Tue, 9 Jun 2015 05:01:23 -0700 (PDT)
> > To: r-help@r-project.org
> > Subject: Re: [R] Summarizing data based on Date
> >
> > Hi Petr
> >
> > I researched a lot over the net and R manual as well based on which I
> > revamped my code and came to the code as:
> > test$CR_DT <- as.Date(test$CR_DT, '%d-%b-%y')
> >
> > iii<- aggregate(test$CHG_WT,list(format(test$CR_DT,"%m")),FUN=sum)
> >
> > However it still gives me the error as below:
> > Error in Summary.factor(c(1L, 1L, 1L, 3286L, 1646L, 3241L, 1L, 1L,
> > 1307L,
> > :
> >   ‘sum’ not meaningful for factors.
> >
> > If could you guide on how to achieve the desired output. Thanks.
> >
> >
> >
> > --
> > View this message in context:
> > http://r.789695.n4.nabble.com/Summarizing-data-based-on-Date-
> tp4708328
> > p4708384.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.
>
> 
> TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if5
> Capture screenshots, upload images, edit and send them to your friends
> through IMs, post on Twitter®, Facebook®, MySpace™, LinkedIn® – FAST!
>
> __
> 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 a

[R] Issue with mcapply

2015-06-11 Thread AROONALOK PYNE
Please check this code :

library(parallel)
workerFunc <- function(n) { return(n^2) }
a <- function(){
  CurrentTime <- Sys.time()
  res <- lapply(values, workerFunc)
  TimeTaken <- Sys.time() - CurrentTime
  print(TimeTaken)
}
b <- function(){
  CurrentTime <- Sys.time()
  numWorkers <- detectCores()
  res <- mclapply(values, workerFunc, mc.cores = numWorkers-2)
  TimeTaken <- Sys.time() - CurrentTime
  print(TimeTaken)
}
c <- function(n){
  values <<- 1:n
  print("Evaluating a : ")
  a()
  print("Evaluating b : ")
  b()
}

For large values of n, the code calculates a() but the hangs indefinitely
on reaching b(). How do I correct it ?
I am using Ubuntu 14.04 and core i7 Processor

-- 
*AROONALOK PYNE*

BE Graduate
Department Of Computer Science And Engineering
Jadavpur University, Kolkata-32
India

[[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] graphs, need urgent help (deadline :( )

2015-06-11 Thread Don McKenzie
Thanks John!  My eyes aren't good enough to see that. I actually checked (I 
thought). This was the default window on Mac console, for others who might care.

Sent from my iPad

> On Jun 10, 2015, at 6:17 PM, John Kane  wrote:
> 
> You have curly quotes rather than plain ones here : 
> col=4,type=“l”,xlab=“Region”,ylab=“factor")
> 
> 
> 
> John Kane
> Kingston ON Canada
> 
> -Original Message-
> From: d...@u.washington.edu
> Sent: Wed, 10 Jun 2015 11:32:59 -0700
> To: rosit...@gmail.com
> Subject: Re: [R] graphs, need urgent help (deadline :( )
> 
> You were caught by a mysterious issue that I don’t understand either.
> 
> plot(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.a[therapy.df$sample==50],col=4,type=“l”,xlab=“Region”,ylab=“factor")
> 
> Error: unexpected input in 
> "plot(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.a[therapy.df$sample==50],col=4,type=‚”
> 
> but if I change the order of arguments to plot(), it’s fine
> 
> plot(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.a[therapy.df$sample==50],type="l",col=4,xlab="Region",ylab="factor”)
> 
> I don’t know what to tell you.  If someone wiser than I is still reading, 
> maybe s(he) can explain.  Possibly a bug has crept into the call to “par”, 
> but “bugs" suspected by non-experts like me usually turn out to be naive user 
> errors.  
> 
> For your purposes, use the one that works.  :-)
> 
> On Jun 10, 2015, at 11:03 AM, Rosa Oliveira  wrote:
> 
> Sorry,
> 
> I taught I attached the cvs file :)
> 
> 
> 
> Don,
> 
> I tried, but I got an error:
> 
>> my.data$Region
> 
>  [1]  1  2  3  4  5  6  7  8  9 10  1  2  3  4  5  6  7  8  9 10  1  2  3  4  
> 5  6  7  8  9 10
> 
>> my.data$sample
> 
>  [1]   50   50   50   50   50   50   50   50   50   50  250  250  250  250  
> 250  250  250  250  250  250 1000 1000 1000 1000 1000 1000 1000 1000
> 
> [29] 1000 1000
> 
>> my.data$factor.a
> 
>  [1] 0.895 0.811 0.685 0.777 0.600 0.466 0.446 0.392 0.256 0.198 0.136 0.121 
> 0.875 0.777 0.685 0.626 0.550 0.466 0.384 0.330 0.060 0.138 0.065
> 
> [24] 0.034 0.931 0.124 0.060 0.028 0.017 0.014
> 
>> plot(my.data$Region[my.data$sample==50],my.data$factor.a[my.data$sample==50],col=4,type=“l”,xlab=“Region”,ylab=“factor")
> 
> Error: unexpected input in 
> "plot(my.data$Region[my.data$sample==50],my.data$factor.a[my.data$sample==50],col=4,type=�”
> 
> I’m really naive, right?
> 
> 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 
> [https://pt.linkedin.com/in/rosacsoliveira]
> 
> 
> "Many admire, few know"
> Hippocrates
> 
> On 10 Jun 2015, at 18:10, Don McKenzie  wrote:
> 
> For a legend, try (untested)
> 
> legend(0.15,0.9,c("factora","factorb","factorc"),col=c(4,2,3),lty=1)
> 
> If it overlaps data points move the first two arguments (0.15 and 0.9) 
> around, or change the “ylim” argument in the plot() to ~1.2.
> 
> to avoid clutter, put the line-types information in the figure caption (IMO)
> 
> On Jun 10, 2015, at 10:03 AM, Don McKenzie  wrote:
> 
> On Jun 10, 2015, at 9:08 AM, Rosa Oliveira  wrote:
> 
> Dear All,
> 
> I attach my data.
> 
> Dear Jim, 
> 
> when I run your code (even the one you send me, not in my data), I get: 
> 
> Don't know how to automatically pick scale for object of type function. 
> Defaulting to continuous
> 
> Error in data.frame(x = c(0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1,  : 
> 
>   arguments imply differing number of rows: 24, 0
> 
> Dear Don,
> 
> It’s meant that I will have 12 lines: 
> 
> 3 factors - lines colors
> 
> with 3 different values of “sample” for each - line types
> 
> [Three colors, one for each factor,
> and  three line types (lty=1,2,3), one for eachvalue of “sample - preferable 
> dash, thin and thick).
> 
> in the X - I should have region (because I have 10 regions)
> 
> for each region I have the outcome of 3 different treatments (factor)
> 
> for each region and each treatment I have 3 different sample size.
> 
> But in your original post you had 4 sample sizes: 10,20,30,40.
> 
> I need to “see” the the influence of the region in the treatment outcome for 
> each sample size.
> 
> So, at the end I should have 9 lines
> 
> 3 red (1 dash, 1 thin, 1 thick) - concerning factor a (dash for sample size 
> 50, thin for sample size 250 and thick for sample size 1000)
> 
> 3 blue (1 dash, 1 thin, 1 thick) - concerning factor b (dash for sample size 
> 50, thin for sample size 250 and thick for sample size 1000)
> 
> 3 green (1 dash, 1 thin, 1 thick) - concerning factor c (dash for sample size 
> 50, thin for sample size 250 and thick for sample size 1000)
> 
> Hope this time is clear.
> 
> I also though about doing 3 different graphs, each one for 1 di

[R] Quantile regression model with nonparametric effect and interaction

2015-06-11 Thread Waltl, Sofie (sofie.wa...@uni-graz.at)
Dear all,

I would like to estimate a quantile regression model including a bivariate 
nonparametric term which should be interacted with a dummy variable, i.e.,
log p ~ year + f(a,b):year.
I tried to use Roger Koenker's quantreg package and the functions rqss and qss 
but it turns out that interactions are not possible in this setting. Also 
weights are not implemented yet to build a work-around. I am looking for 
something like the by-statement in Simon Wood's package mgcv. Does anything 
comparable exist?
I am grateful for any help on this issue.

Kind regards,
S. Waltl


[[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] Finding index of specific values in a data.frame

2015-06-11 Thread Kevin Kowitski
Oh I see, I'm sorry I just plopped it in GitHub for ease of help, I didn't 
notice I put it under coursera work. This task is not related to coursera, I 
will separate it out. 

-Kevin

Sent from my iPhone

> On Jun 10, 2015, at 3:21 PM, David Winsemius  wrote:
> 
> 
>> On Jun 10, 2015, at 9:41 AM, Kevin Kowitski wrote:
>> 
>> Hey everyone, 
>> 
>>  I am new to R and I am trying to find the index of all of the values in a 
>> data.frame.   I have a .csv file that outputs pass, fail, error, and 
>> indeterminate readings.  I have passed the data from the .csv to a 
>> data.frame, have performed the proper matching criteria to generate a 
>> data.frame of 0's and 1's, and am outputting the total 1's (therefore 
>> matches) found.  I would also like to find the index of these values so that 
>> I can output a matrix containing the date and data point which has produced 
>> that match. Can anyone help set me in the right direction?
>> 
>> here is a github link to the code I have already generated for more clarity 
>> on the project:
>> 
>> https://github.com/KevinKowitski/datasciencecoursera/blob/master/ErrorCount.R
> 
> I think the coursera homework assignments are supposed to be discussed in a 
> course-provided web-mediated mailing list.
> 
> It's unclear from the presentation why the `which` and `%in%` do not provide 
> a solution. 
>> 
>> Thank you, 
>> Kevin
>> __
>> 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-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] Finding index of specific values in a data.frame

2015-06-11 Thread Kevin Kowitski
I did not realize that there is a coursers assignment similar to this. I am 
running this for data analysis at work, not for coursers. However I will look 
through the link you provided and see if it is applicable. 

Thanks,
Kevin

Sent from my iPhone

> On Jun 10, 2015, at 3:21 PM, David Winsemius  wrote:
> 
> 
>> On Jun 10, 2015, at 9:41 AM, Kevin Kowitski wrote:
>> 
>> Hey everyone, 
>> 
>>  I am new to R and I am trying to find the index of all of the values in a 
>> data.frame.   I have a .csv file that outputs pass, fail, error, and 
>> indeterminate readings.  I have passed the data from the .csv to a 
>> data.frame, have performed the proper matching criteria to generate a 
>> data.frame of 0's and 1's, and am outputting the total 1's (therefore 
>> matches) found.  I would also like to find the index of these values so that 
>> I can output a matrix containing the date and data point which has produced 
>> that match. Can anyone help set me in the right direction?
>> 
>> here is a github link to the code I have already generated for more clarity 
>> on the project:
>> 
>> https://github.com/KevinKowitski/datasciencecoursera/blob/master/ErrorCount.R
> 
> I think the coursera homework assignments are supposed to be discussed in a 
> course-provided web-mediated mailing list.
> 
> It's unclear from the presentation why the `which` and `%in%` do not provide 
> a solution. 
>> 
>> Thank you, 
>> Kevin
>> __
>> 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-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] graphs, need urgent help (deadline :( )

2015-06-11 Thread Rosa Oliveira
Dear Don, thank you very much.

I really wasn’t being able to figure the problem.

You were a big (huge) help.

Seeing the graphs, I think I’ll try to put the 3 settings (sample size)  in 
different graphs.

I’ll try to use trellis graphs :) using sample size as the “factor”

Thank you very much ;)

 


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

> On 10 Jun 2015, at 20:07, Don McKenzie  wrote:
> 
> Here is code that IS tested.  I am sending Rosa the (ugly) output in a 
> separate file.  Crazy problems with argument order; I never figured out
> exactly what was wrong.
> 
> 
> # therapy plot
> 
> 
>  
> plot(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.a[therapy.df$sample==50],xlab="Region",ylab="factor",type="l",col=4,ylim=c(0,1.5))
> lines(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.b[therapy.df$sample==50],col=2)
> lines(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.c[therapy.df$sample==50],col=3)
> 
> lines(therapy.df$Region[therapy.df$sample==250],therapy.df$factor.a[therapy.df$sample==250],col=4,lty=2)
> lines(therapy.df$Region[therapy.df$sample==250],therapy.df$factor.b[therapy.df$sample==250],col=2,lty=2)
> lines(therapy.df$Region[therapy.df$sample==250],therapy.df$factor.c[therapy.df$sample==250],col=3,lty=2)
> 
> lines(therapy.df$Region[therapy.df$sample==1000],therapy.df$factor.a[therapy.df$sample==1000],col=4,lty=3)
> lines(therapy.df$Region[therapy.df$sample==1000],therapy.df$factor.b[therapy.df$sample==1000],col=2,lty=3)
> lines(therapy.df$Region[therapy.df$sample==1000],therapy.df$factor.c[therapy.df$sample==1000],col=3,lty=3)
> 
> legend(7,1.4,c("factor.a","factor.b","factor.c"),col=c(4,2,3),lty=1)
> 
> 
> 
>> On Jun 10, 2015, at 11:03 AM, Rosa Oliveira > > wrote:
>> 
>> Sorry,
>> 
>> I taught I attached the cvs file :)
>> 
>> 
>> 
>> 
>> Don,
>> 
>> I tried, but I got an error:
>> 
>> > my.data$Region
>>  [1]  1  2  3  4  5  6  7  8  9 10  1  2  3  4  5  6  7  8  9 10  1  2  3  4 
>>  5  6  7  8  9 10
>> > my.data$sample
>>  [1]   50   50   50   50   50   50   50   50   50   50  250  250  250  250  
>> 250  250  250  250  250  250 1000 1000 1000 1000 1000 1000 1000 1000
>> [29] 1000 1000
>> > my.data$factor.a
>>  [1] 0.895 0.811 0.685 0.777 0.600 0.466 0.446 0.392 0.256 0.198 0.136 0.121 
>> 0.875 0.777 0.685 0.626 0.550 0.466 0.384 0.330 0.060 0.138 0.065
>> [24] 0.034 0.931 0.124 0.060 0.028 0.017 0.014
>> 
>> 
>> > plot(my.data$Region[my.data$sample==50],my.data$factor.a[my.data$sample==50],col=4,type=“l”,xlab=“Region”,ylab=“factor")
>> Error: unexpected input in 
>> "plot(my.data$Region[my.data$sample==50],my.data$factor.a[my.data$sample==50],col=4,type=�”
>> 
>> 
>> I’m really naive, right?
>> 
>> 
>> 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
>> 
>>> On 10 Jun 2015, at 18:10, Don McKenzie  wrote:
>>> 
>>> For a legend, try (untested)
>>> 
>>> legend(0.15,0.9,c("factora","factorb","factorc"),col=c(4,2,3),lty=1)
>>> 
>>> If it overlaps data points move the first two arguments (0.15 and 0.9) 
>>> around, or change the “ylim” argument in the plot() to ~1.2.
>>> 
>>> to avoid clutter, put the line-types information in the figure caption (IMO)
>>> 
>>> 
 On Jun 10, 2015, at 10:03 AM, Don McKenzie  wrote:
 
 
> On Jun 10, 2015, at 9:08 AM, Rosa Oliveira  wrote:
> 
> Dear All,
> 
> 
> I attach my data.
> 
> Dear Jim, 
> 
> when I run your code (even the one you send me, not in my data), I get: 
> 
> Don't know how to automatically pick scale for object of type function. 
> Defaulting to continuous
> Error in data.frame(x = c(0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1,  : 
>   arguments imply differing number of rows: 24, 0
> 
> 
> 
> Dear Don,
> 
> It’s meant that I will have 12 lines: 
> 3 factors - lines colors
> with 3 different values of “sample” for each - line types
> 
> 
> [Three colors, one for each factor,
> and  three line types (lty=1,2,3), one for eachvalue of “sample - 
> preferable dash, thin and thick).
> 
> 
> in the X - I should have region (because I have 10 regions)
> for each region I have the outcome of 3 different treatments (factor)
> f