Re: [R] "--" < 0

2024-06-25 Thread avi.e.gross
Unfortunately, Adrian, even trying to coerce a string like "--" to numeric just 
produces an NA and comparison fails:

> as.numeric("--") < 0 
[1] NA
Warning message:
NAs introduced by coercion

The same is true of anything that is character as it cannot be coerced.

> as.numeric("anything") < 0 
[1] NA
Warning message:
NAs introduced by coercion

So, the only rational thing R can do is convert the zero to a character string 
and that has the usual problem as in:

> as.character(20) < as.character(9)
[1] TRUE

Can you suggest if there is any valid result in some cases like these? I mean, 
if we wrote a function like greater(first, second) and set it up so it analyzed 
the types of the arguments and tried various combinations of converting things 
to one of several possible types such as integer/numeric/character/logical/raw 
and examined the results of each while catching errors, what would be a right 
answer it could get?

My guess is that it may not be possible in some cases to give an answer other 
than that the two being compared are incompatible. The result of greater() 
could be neither TRUE, nor FALSE but something like one of the NA family or 
maybe a NaN or maybe the function would simply throw an error and fail.

I can picture many other scenarios such as asking it to compare two objects, 
perhaps the same type or different types, such as a list versus a matrix. 
Realistically, the ">" operator and other such operators are not designed to do 
deep analyses and be able to compare complex-objects component by component and 
recursively. 

So the result you show, is in some sense nonsense. It is so wrong that it is 
not even wrong. My intuition is that it is similar to this:

> NA + 5
[1] NA

Any computation containing a crucial NA, typically ends up with an NA result 
because once you introduce uncertainty, it propagates. So the result of 
comparing things that cannot be compared may well also be polluted and should 
come back as an NA, probably the default logical form, not something like 
NA_integer_ 

Since comparisons between random objects are something that can happen, I 
suspect there are functions already part of the R distribution or in some 
packages that behave better and can safely be used to ask if things can even be 
compared. But there may yet remain edge cases because of things like character 
strings that can be evaluated as numeric but may not be evaluated correctly if 
they are written in some way as in hexadecimal notation or scientific notation.


-Original Message-
From: R-help  On Behalf Of Adrian Dusa
Sent: Tuesday, June 25, 2024 4:59 AM
To: Martin Maechler 
Cc: r-help@r-project.org
Subject: Re: [R] "--" < 0

Oh I see...
It's not that "-7" gets coerced to numeric, but 0 gets coerced to "0".
Of course...

On Tue, Jun 25, 2024 at 11:02 AM Martin Maechler 
wrote:

> >>>>> Adrian Dusa
> >>>>> on Tue, 25 Jun 2024 10:56:07 +0300 writes:
>
> > Dear R fellows,
>
> >> From time to time, just when I thought I knew my R, I get
> >> bitten by some
> > small things that reminds one to constantly return to the
> > basics.
>
> > I knew for instance that "-1" < 0 is TRUE, presumably
> > because R first coerces to numeric before comparing with
> > 0.
>
> > But I did not expect that "--" < 0 is a TRUE statement.
> > (and the same holds for any string prepended by a minus
> > sign, e.g. "-a" < 0)
>
> > I would be grateful for an explanation, I'm sure that
> > something very obvious escapes me but it sure does seem
> > counter intuitive to me.
>
> > Best wishes, Adrian
>
> >   [[alternative HTML version deleted]]
>
> Nice, quiz, yes.
>
> You must have forgotten that all Op's (+,-, <= , &, | ..)
> must coerce to common type.
>
> ... and so does  c()  where coercion is defined a bit more.
>
> -->  does  c("--", 0)   give you a clue, now ?
>

[[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] "--" < 0

2024-06-25 Thread Adrian Dusa
Oh I see...
It's not that "-7" gets coerced to numeric, but 0 gets coerced to "0".
Of course...

On Tue, Jun 25, 2024 at 11:02 AM Martin Maechler 
wrote:

> > Adrian Dusa
> > on Tue, 25 Jun 2024 10:56:07 +0300 writes:
>
> > Dear R fellows,
>
> >> From time to time, just when I thought I knew my R, I get
> >> bitten by some
> > small things that reminds one to constantly return to the
> > basics.
>
> > I knew for instance that "-1" < 0 is TRUE, presumably
> > because R first coerces to numeric before comparing with
> > 0.
>
> > But I did not expect that "--" < 0 is a TRUE statement.
> > (and the same holds for any string prepended by a minus
> > sign, e.g. "-a" < 0)
>
> > I would be grateful for an explanation, I'm sure that
> > something very obvious escapes me but it sure does seem
> > counter intuitive to me.
>
> > Best wishes, Adrian
>
> >   [[alternative HTML version deleted]]
>
> Nice, quiz, yes.
>
> You must have forgotten that all Op's (+,-, <= , &, | ..)
> must coerce to common type.
>
> ... and so does  c()  where coercion is defined a bit more.
>
> -->  does  c("--", 0)   give you a clue, now ?
>

[[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] "--" < 0

2024-06-25 Thread peter dalgaard
Also notice that

> "+5" < 0
[1] TRUE

> as.numeric("+5") < 0
[1] FALSE

So the presumption is wrong. It is really about

> sort(c(0:3, "+", "-"))
[1] "-" "+" "0" "1" "2" "3"

-pd

> On 25 Jun 2024, at 10:02 , Martin Maechler  wrote:
> 
>> Adrian Dusa 
>>on Tue, 25 Jun 2024 10:56:07 +0300 writes:
> 
>> Dear R fellows,
> 
>>> From time to time, just when I thought I knew my R, I get
>>> bitten by some
>> small things that reminds one to constantly return to the
>> basics.
> 
>> I knew for instance that "-1" < 0 is TRUE, presumably
>> because R first coerces to numeric before comparing with
>> 0.
> 
>> But I did not expect that "--" < 0 is a TRUE statement.
>> (and the same holds for any string prepended by a minus
>> sign, e.g. "-a" < 0)
> 
>> I would be grateful for an explanation, I'm sure that
>> something very obvious escapes me but it sure does seem
>> counter intuitive to me.
> 
>> Best wishes, Adrian
> 
>>  [[alternative HTML version deleted]]
> 
> Nice, quiz, yes.
> 
> You must have forgotten that all Op's (+,-, <= , &, | ..)
> must coerce to common type.
> 
> ... and so does  c()  where coercion is defined a bit more.
> 
> -->  does  c("--", 0)   give you a clue, now ?
> 
> __
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.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] "--" < 0

2024-06-25 Thread Martin Maechler
> Adrian Dusa 
> on Tue, 25 Jun 2024 10:56:07 +0300 writes:

> Dear R fellows,

>> From time to time, just when I thought I knew my R, I get
>> bitten by some
> small things that reminds one to constantly return to the
> basics.

> I knew for instance that "-1" < 0 is TRUE, presumably
> because R first coerces to numeric before comparing with
> 0.

> But I did not expect that "--" < 0 is a TRUE statement.
> (and the same holds for any string prepended by a minus
> sign, e.g. "-a" < 0)

> I would be grateful for an explanation, I'm sure that
> something very obvious escapes me but it sure does seem
> counter intuitive to me.

> Best wishes, Adrian

>   [[alternative HTML version deleted]]

Nice, quiz, yes.

You must have forgotten that all Op's (+,-, <= , &, | ..)
must coerce to common type.

... and so does  c()  where coercion is defined a bit more.

-->  does  c("--", 0)   give you a clue, now ?

__
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] 0 rows> (or 0-length row.names)

2016-08-31 Thread Shivi Bhatia
Thank you Mark & Dunlap,

Will make changes to the variable as suggested. Thank you for your time &
assistance.

On Wed, Aug 31, 2016 at 9:16 PM, Mark Sharp  wrote:

> Shivi,
>
> Looking at the help from ?WOE, ?WOETable, and ?IV, your Y vector in all
> cases is to be categorical and it is numeric.
>
> Mark
>
>
> R. Mark Sharp, Ph.D.
> Director of Primate Records Database
> Southwest National Primate Research Center
> Texas Biomedical Research Institute
> P.O. Box 760549
> San Antonio, TX 78245-0549
> Telephone: (210)258-9476
> e-mail: msh...@txbiomed.org
>
>
> On Aug 31, 2016, at 5:37 AM, Shivi Bhatia  wrote:
> >
> > These are the packages i am using:
> > library(woe)  #WEIGHT OF EVIDENCE
> > library(InformationValue)  #INFORMATION VALUE
> >
> > The syntax used is :
> > WOE(X=SFDC1$log_caseage, Y=SFDC1$survey)
> > WOETable(X=SFDC1$case_age, Y=SFDC1$survey)
> > IV(X=SFDC1$case_age, Y=SFDC1$survey)
> >
> > On Wed, Aug 31, 2016 at 12:54 AM, Mark Sharp 
> wrote:
> > Shivi,
> >
> > What package(s) are you using. What functions are you using. How are you
> calling the functions. A reproducible sample has all of the actual code
> needed to create a representative error. There are multiple packages you
> could be using to look at weight of evidence and information value. For
> example, there is a WOE function in the Information package and a woe
> function in the woe package.
> >
> > Mark
> >
> >> On Aug 30, 2016, at 2:15 PM, Shivi Bhatia  wrote:
> >>
> >> Hi Mark,
> >> What i understand, probably when i run the WOE & IV to check
> significant variables that is where i get this error. Thanks for your
> assistance Mark really appreciate i will look into some other measure on
> this.
> >>
> >> On Wed, Aug 31, 2016 at 12:35 AM, Mark Sharp 
> wrote:
> >> Shivi,
> >>
> >> It is likely that William knows what you are trying to do because of
> his considerable experience, but I am not able to figure it out from what
> you have written. You have apparently sent the output from something like
> dput(SFDC[1:50, ]), but I still do not know what you did to get the error.
> >>
> >> I successfully assigned the structure you sent to the name SFDC and
> nothing seems amiss.
> >>
> >>
> >> Mark
> >>
> >> R. Mark Sharp, Ph.D.
> >> Director of Primate Records Database
> >> Southwest National Primate Research Center
> >> Texas Biomedical Research Institute
> >> P.O. Box 760549
> >> San Antonio, TX 78245-0549
> >> Telephone: (210)258-9476
> >> e-mail: msh...@txbiomed.org
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> > On Aug 30, 2016, at 12:32 PM, Shivi Bhatia 
> wrote:
> >> >
> >> > Hi William/ Mark,
> >> >
> >> > I am using WOE & IV (weight of evidence) reduce the number of
> independent
> >> > vars.
> >> > I have read this data as a csv file.
> >> > reproducible example for your reference please:
> >> >
> >> > structure(list(date = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 14L,
> >> > 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
> >> >
> >> ... truncated
> >> > __
> >> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> > https://stat.ethz.ch/mailman/listinfo/r-help
> >> > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> >> > and provide commented, minimal, self-contained, reproducible code.
> >>
> >> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
> transmitted, may contain privileged and confidential information and is
> intended solely for the exclusive use of the individual or entity to whom
> it is addressed. If you are not the intended recipient, you are hereby
> notified that any review, dissemination, distribution or copying of this
> e-mail and/or attachments is strictly prohibited. If you have received this
> e-mail in error, please immediately notify the sender stating that this
> transmission was misdirected; return the e-mail to sender; destroy all
> paper copies and delete all electronic copies from your system without
> disclosing its contents.
> >
> > CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
> transmitted, may contain privileged and confidential information and is
> intended solely for the exclusive use of the individual or entity to whom
> it is addressed. If you are not the intended recipient, you are hereby
> notified that any review, dissemination, distribution or copying of this
> e-mail and/or attachments is strictly prohibited. If you have received this
> e-mail in error, please immediately notify the sender stating that this
> transmission was misdirected; return the e-mail to sender; destroy all
> paper copies and delete all electronic copies from your system without
> disclosing its contents.
> >
>
> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
> transmitted, may contain privileged and confidential information and is
> intended solely for the exclusive use of the individual or entity to whom
> it is addressed. If you are not the i

Re: [R] 0 rows> (or 0-length row.names)

2016-08-31 Thread Mark Sharp
Shivi,

Looking at the help from ?WOE, ?WOETable, and ?IV, your Y vector in all cases 
is to be categorical and it is numeric.

Mark


R. Mark Sharp, Ph.D.
Director of Primate Records Database
Southwest National Primate Research Center
Texas Biomedical Research Institute
P.O. Box 760549
San Antonio, TX 78245-0549
Telephone: (210)258-9476
e-mail: msh...@txbiomed.org


On Aug 31, 2016, at 5:37 AM, Shivi Bhatia  wrote:
>
> These are the packages i am using:
> library(woe)  #WEIGHT OF EVIDENCE
> library(InformationValue)  #INFORMATION VALUE
>
> The syntax used is :
> WOE(X=SFDC1$log_caseage, Y=SFDC1$survey)
> WOETable(X=SFDC1$case_age, Y=SFDC1$survey)
> IV(X=SFDC1$case_age, Y=SFDC1$survey)
>
> On Wed, Aug 31, 2016 at 12:54 AM, Mark Sharp  wrote:
> Shivi,
>
> What package(s) are you using. What functions are you using. How are you 
> calling the functions. A reproducible sample has all of the actual code 
> needed to create a representative error. There are multiple packages you 
> could be using to look at weight of evidence and information value. For 
> example, there is a WOE function in the Information package and a woe 
> function in the woe package.
>
> Mark
>
>> On Aug 30, 2016, at 2:15 PM, Shivi Bhatia  wrote:
>>
>> Hi Mark,
>> What i understand, probably when i run the WOE & IV to check significant 
>> variables that is where i get this error. Thanks for your assistance Mark 
>> really appreciate i will look into some other measure on this.
>>
>> On Wed, Aug 31, 2016 at 12:35 AM, Mark Sharp  wrote:
>> Shivi,
>>
>> It is likely that William knows what you are trying to do because of his 
>> considerable experience, but I am not able to figure it out from what you 
>> have written. You have apparently sent the output from something like 
>> dput(SFDC[1:50, ]), but I still do not know what you did to get the error.
>>
>> I successfully assigned the structure you sent to the name SFDC and nothing 
>> seems amiss.
>>
>>
>> Mark
>>
>> R. Mark Sharp, Ph.D.
>> Director of Primate Records Database
>> Southwest National Primate Research Center
>> Texas Biomedical Research Institute
>> P.O. Box 760549
>> San Antonio, TX 78245-0549
>> Telephone: (210)258-9476
>> e-mail: msh...@txbiomed.org
>>
>>
>>
>>
>>
>>
>>
>> > On Aug 30, 2016, at 12:32 PM, Shivi Bhatia  wrote:
>> >
>> > Hi William/ Mark,
>> >
>> > I am using WOE & IV (weight of evidence) reduce the number of independent
>> > vars.
>> > I have read this data as a csv file.
>> > reproducible example for your reference please:
>> >
>> > structure(list(date = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 14L,
>> > 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
>> >
>> ... truncated
>> > __
>> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide 
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments 
>> transmitted, may contain privileged and confidential information and is 
>> intended solely for the exclusive use of the individual or entity to whom it 
>> is addressed. If you are not the intended recipient, you are hereby notified 
>> that any review, dissemination, distribution or copying of this e-mail 
>> and/or attachments is strictly prohibited. If you have received this e-mail 
>> in error, please immediately notify the sender stating that this 
>> transmission was misdirected; return the e-mail to sender; destroy all paper 
>> copies and delete all electronic copies from your system without disclosing 
>> its contents.
>
> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments 
> transmitted, may contain privileged and confidential information and is 
> intended solely for the exclusive use of the individual or entity to whom it 
> is addressed. If you are not the intended recipient, you are hereby notified 
> that any review, dissemination, distribution or copying of this e-mail and/or 
> attachments is strictly prohibited. If you have received this e-mail in 
> error, please immediately notify the sender stating that this transmission 
> was misdirected; return the e-mail to sender; destroy all paper copies and 
> delete all electronic copies from your system without disclosing its contents.
>

CONFIDENTIALITY NOTICE: This e-mail and any files and/or...{{dropped:10}}

__
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] 0 rows> (or 0-length row.names)

2016-08-31 Thread William Dunlap via R-help
I see the printout (not an "error") that you describe on the 2nd example
you gave:

> t2 <- WOETable(X=SFDC1$case_age, Y=SFDC1$survey)
> print(t2)
[1] GOODS BADS  TOTAL PCT_G PCT_B WOE   IV
<0 rows> (or 0-length row.names)

The result of WOETable is perfectly legal - it is a data.frame with no rows.

help(WOETable) says that the 'X' argument should be a "categorical variable
stored as factor" but the function does not check that that is true.  You
gave it a numeric (continuous) variable, case_age, and it misbehaved.  You
can turn case_age into a factor with the cut() function.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Aug 31, 2016 at 3:37 AM, Shivi Bhatia  wrote:

> These are the packages i am using:
> library(woe)  #WEIGHT OF EVIDENCE
> library(InformationValue)  #INFORMATION VALUE
>
> The syntax used is :
> WOE(X=SFDC1$log_caseage, Y=SFDC1$survey)
> WOETable(X=SFDC1$case_age, Y=SFDC1$survey)
> IV(X=SFDC1$case_age, Y=SFDC1$survey)
>
> On Wed, Aug 31, 2016 at 12:54 AM, Mark Sharp  wrote:
>
>> Shivi,
>>
>> What package(s) are you using. What functions are you using. How are you
>> calling the functions. A reproducible sample has all of the actual code
>> needed to create a representative error. There are multiple packages you
>> could be using to look at weight of evidence and information value. For
>> example, there is a WOE function in the Information package and a woe
>> function in the woe package.
>>
>> Mark
>>
>> On Aug 30, 2016, at 2:15 PM, Shivi Bhatia  wrote:
>>
>> Hi Mark,
>> What i understand, probably when i run the WOE & IV to check significant
>> variables that is where i get this error. Thanks for your assistance Mark
>> really appreciate i will look into some other measure on this.
>>
>> On Wed, Aug 31, 2016 at 12:35 AM, Mark Sharp  wrote:
>>
>>> Shivi,
>>>
>>> It is likely that William knows what you are trying to do because of his
>>> considerable experience, but I am not able to figure it out from what you
>>> have written. You have apparently sent the output from something like
>>> dput(SFDC[1:50, ]), but I still do not know what you did to get the error.
>>>
>>> I successfully assigned the structure you sent to the name SFDC and
>>> nothing seems amiss.
>>>
>>>
>>> Mark
>>>
>>> R. Mark Sharp, Ph.D.
>>> Director of Primate Records Database
>>> Southwest National Primate Research Center
>>> Texas Biomedical Research Institute
>>> P.O. Box 760549
>>> San Antonio, TX 78245-0549
>>> Telephone: (210)258-9476
>>> e-mail: msh...@txbiomed.org 
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> > On Aug 30, 2016, at 12:32 PM, Shivi Bhatia 
>>> wrote:
>>> >
>>> > Hi William/ Mark,
>>> >
>>> > I am using WOE & IV (weight of evidence) reduce the number of
>>> independent
>>> > vars.
>>> > I have read this data as a csv file.
>>> > reproducible example for your reference please:
>>> >
>>> > structure(list(date = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 14L,
>>> > 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
>>> >
>>> ... truncated
>>> > __
>>> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> > https://stat.ethz.ch/mailman/listinfo/r-help
>>> > PLEASE do read the posting guide http://www.R-project.org
>>> /posting-guide.html 
>>> > and provide commented, minimal, self-contained, reproducible code.
>>>
>>> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
>>> transmitted, may contain privileged and confidential information and is
>>> intended solely for the exclusive use of the individual or entity to whom
>>> it is addressed. If you are not the intended recipient, you are hereby
>>> notified that any review, dissemination, distribution or copying of this
>>> e-mail and/or attachments is strictly prohibited. If you have received this
>>> e-mail in error, please immediately notify the sender stating that this
>>> transmission was misdirected; return the e-mail to sender; destroy all
>>> paper copies and delete all electronic copies from your system without
>>> disclosing its contents.
>>>
>>
>> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
>> transmitted, may contain privileged and confidential information and is
>> intended solely for the exclusive use of the individual or entity to whom
>> it is addressed. If you are not the intended recipient, you are hereby
>> notified that any review, dissemination, distribution or copying of this
>> e-mail and/or attachments is strictly prohibited. If you have received this
>> e-mail in error, please immediately notify the sender stating that this
>> transmission was misdirected; return the e-mail to sender; destroy all
>> paper copies and delete all electronic copies from your system without
>> disclosing its contents.
>>
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch

Re: [R] 0 rows> (or 0-length row.names)

2016-08-31 Thread Shivi Bhatia
These are the packages i am using:
library(woe)  #WEIGHT OF EVIDENCE
library(InformationValue)  #INFORMATION VALUE

The syntax used is :
WOE(X=SFDC1$log_caseage, Y=SFDC1$survey)
WOETable(X=SFDC1$case_age, Y=SFDC1$survey)
IV(X=SFDC1$case_age, Y=SFDC1$survey)

On Wed, Aug 31, 2016 at 12:54 AM, Mark Sharp  wrote:

> Shivi,
>
> What package(s) are you using. What functions are you using. How are you
> calling the functions. A reproducible sample has all of the actual code
> needed to create a representative error. There are multiple packages you
> could be using to look at weight of evidence and information value. For
> example, there is a WOE function in the Information package and a woe
> function in the woe package.
>
> Mark
>
> On Aug 30, 2016, at 2:15 PM, Shivi Bhatia  wrote:
>
> Hi Mark,
> What i understand, probably when i run the WOE & IV to check significant
> variables that is where i get this error. Thanks for your assistance Mark
> really appreciate i will look into some other measure on this.
>
> On Wed, Aug 31, 2016 at 12:35 AM, Mark Sharp  wrote:
>
>> Shivi,
>>
>> It is likely that William knows what you are trying to do because of his
>> considerable experience, but I am not able to figure it out from what you
>> have written. You have apparently sent the output from something like
>> dput(SFDC[1:50, ]), but I still do not know what you did to get the error.
>>
>> I successfully assigned the structure you sent to the name SFDC and
>> nothing seems amiss.
>>
>>
>> Mark
>>
>> R. Mark Sharp, Ph.D.
>> Director of Primate Records Database
>> Southwest National Primate Research Center
>> Texas Biomedical Research Institute
>> P.O. Box 760549
>> San Antonio, TX 78245-0549
>> Telephone: (210)258-9476
>> e-mail: msh...@txbiomed.org 
>>
>>
>>
>>
>>
>>
>>
>> > On Aug 30, 2016, at 12:32 PM, Shivi Bhatia 
>> wrote:
>> >
>> > Hi William/ Mark,
>> >
>> > I am using WOE & IV (weight of evidence) reduce the number of
>> independent
>> > vars.
>> > I have read this data as a csv file.
>> > reproducible example for your reference please:
>> >
>> > structure(list(date = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 14L,
>> > 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
>> >
>> ... truncated
>> > __
>> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide http://www.R-project.
>> org/posting-guide.html 
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
>> transmitted, may contain privileged and confidential information and is
>> intended solely for the exclusive use of the individual or entity to whom
>> it is addressed. If you are not the intended recipient, you are hereby
>> notified that any review, dissemination, distribution or copying of this
>> e-mail and/or attachments is strictly prohibited. If you have received this
>> e-mail in error, please immediately notify the sender stating that this
>> transmission was misdirected; return the e-mail to sender; destroy all
>> paper copies and delete all electronic copies from your system without
>> disclosing its contents.
>>
>
> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
> transmitted, may contain privileged and confidential information and is
> intended solely for the exclusive use of the individual or entity to whom
> it is addressed. If you are not the intended recipient, you are hereby
> notified that any review, dissemination, distribution or copying of this
> e-mail and/or attachments is strictly prohibited. If you have received this
> e-mail in error, please immediately notify the sender stating that this
> transmission was misdirected; return the e-mail to sender; destroy all
> paper copies and delete all electronic copies from your system without
> disclosing its contents.
>

[[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] 0 rows> (or 0-length row.names)

2016-08-30 Thread William Dunlap via R-help
You need to show what R expressions you ran before running into this
problem, including calls to library() or require().

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Aug 30, 2016 at 12:15 PM, Shivi Bhatia  wrote:

> Hi Mark,
> What i understand, probably when i run the WOE & IV to check significant
> variables that is where i get this error. Thanks for your assistance Mark
> really appreciate i will look into some other measure on this.
>
> On Wed, Aug 31, 2016 at 12:35 AM, Mark Sharp  wrote:
>
>> Shivi,
>>
>> It is likely that William knows what you are trying to do because of his
>> considerable experience, but I am not able to figure it out from what you
>> have written. You have apparently sent the output from something like
>> dput(SFDC[1:50, ]), but I still do not know what you did to get the error.
>>
>> I successfully assigned the structure you sent to the name SFDC and
>> nothing seems amiss.
>>
>>
>> Mark
>>
>> R. Mark Sharp, Ph.D.
>> Director of Primate Records Database
>> Southwest National Primate Research Center
>> Texas Biomedical Research Institute
>> P.O. Box 760549
>> San Antonio, TX 78245-0549
>> Telephone: (210)258-9476
>> e-mail: msh...@txbiomed.org
>>
>>
>>
>>
>>
>>
>>
>> > On Aug 30, 2016, at 12:32 PM, Shivi Bhatia 
>> wrote:
>> >
>> > Hi William/ Mark,
>> >
>> > I am using WOE & IV (weight of evidence) reduce the number of
>> independent
>> > vars.
>> > I have read this data as a csv file.
>> > reproducible example for your reference please:
>> >
>> > structure(list(date = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 14L,
>> > 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
>> >
>> ... truncated
>> > __
>> > 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/posti
>> ng-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
>> transmitted, may contain privileged and confidential information and is
>> intended solely for the exclusive use of the individual or entity to whom
>> it is addressed. If you are not the intended recipient, you are hereby
>> notified that any review, dissemination, distribution or copying of this
>> e-mail and/or attachments is strictly prohibited. If you have received this
>> e-mail in error, please immediately notify the sender stating that this
>> transmission was misdirected; return the e-mail to sender; destroy all
>> paper copies and delete all electronic copies from your system without
>> disclosing its contents.
>>
>
>

[[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] 0 rows> (or 0-length row.names)

2016-08-30 Thread Mark Sharp
Shivi,

What package(s) are you using. What functions are you using. How are you 
calling the functions. A reproducible sample has all of the actual code needed 
to create a representative error. There are multiple packages you could be 
using to look at weight of evidence and information value. For example, there 
is a WOE function in the Information package and a woe function in the woe 
package.

Mark
On Aug 30, 2016, at 2:15 PM, Shivi Bhatia 
mailto:shivipm...@gmail.com>> wrote:

Hi Mark,
What i understand, probably when i run the WOE & IV to check significant 
variables that is where i get this error. Thanks for your assistance Mark 
really appreciate i will look into some other measure on this.

On Wed, Aug 31, 2016 at 12:35 AM, Mark Sharp 
mailto:msh...@txbiomed.org>> wrote:
Shivi,

It is likely that William knows what you are trying to do because of his 
considerable experience, but I am not able to figure it out from what you have 
written. You have apparently sent the output from something like 
dput(SFDC[1:50, ]), but I still do not know what you did to get the error.

I successfully assigned the structure you sent to the name SFDC and nothing 
seems amiss.


Mark

R. Mark Sharp, Ph.D.
Director of Primate Records Database
Southwest National Primate Research Center
Texas Biomedical Research Institute
P.O. Box 760549
San Antonio, TX 78245-0549
Telephone: (210)258-9476
e-mail: msh...@txbiomed.org







> On Aug 30, 2016, at 12:32 PM, Shivi Bhatia 
> mailto:shivipm...@gmail.com>> wrote:
>
> Hi William/ Mark,
>
> I am using WOE & IV (weight of evidence) reduce the number of independent
> vars.
> I have read this data as a csv file.
> reproducible example for your reference please:
>
> structure(list(date = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 14L,
> 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
>
... truncated
> __
> R-help@r-project.org mailing list -- To 
> UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

CONFIDENTIALITY NOTICE: This e-mail and any files and/or...{{dropped:23}}

__
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] 0 rows> (or 0-length row.names)

2016-08-30 Thread Shivi Bhatia
Hi Mark,
What i understand, probably when i run the WOE & IV to check significant
variables that is where i get this error. Thanks for your assistance Mark
really appreciate i will look into some other measure on this.

On Wed, Aug 31, 2016 at 12:35 AM, Mark Sharp  wrote:

> Shivi,
>
> It is likely that William knows what you are trying to do because of his
> considerable experience, but I am not able to figure it out from what you
> have written. You have apparently sent the output from something like
> dput(SFDC[1:50, ]), but I still do not know what you did to get the error.
>
> I successfully assigned the structure you sent to the name SFDC and
> nothing seems amiss.
>
>
> Mark
>
> R. Mark Sharp, Ph.D.
> Director of Primate Records Database
> Southwest National Primate Research Center
> Texas Biomedical Research Institute
> P.O. Box 760549
> San Antonio, TX 78245-0549
> Telephone: (210)258-9476
> e-mail: msh...@txbiomed.org
>
>
>
>
>
>
>
> > On Aug 30, 2016, at 12:32 PM, Shivi Bhatia  wrote:
> >
> > Hi William/ Mark,
> >
> > I am using WOE & IV (weight of evidence) reduce the number of independent
> > vars.
> > I have read this data as a csv file.
> > reproducible example for your reference please:
> >
> > structure(list(date = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 14L,
> > 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
> >
> ... truncated
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
> transmitted, may contain privileged and confidential information and is
> intended solely for the exclusive use of the individual or entity to whom
> it is addressed. If you are not the intended recipient, you are hereby
> notified that any review, dissemination, distribution or copying of this
> e-mail and/or attachments is strictly prohibited. If you have received this
> e-mail in error, please immediately notify the sender stating that this
> transmission was misdirected; return the e-mail to sender; destroy all
> paper copies and delete all electronic copies from your system without
> disclosing its contents.
>

[[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] 0 rows> (or 0-length row.names)

2016-08-30 Thread Mark Sharp
Shivi,

It is likely that William knows what you are trying to do because of his 
considerable experience, but I am not able to figure it out from what you have 
written. You have apparently sent the output from something like 
dput(SFDC[1:50, ]), but I still do not know what you did to get the error.

I successfully assigned the structure you sent to the name SFDC and nothing 
seems amiss.


Mark

R. Mark Sharp, Ph.D.
Director of Primate Records Database
Southwest National Primate Research Center
Texas Biomedical Research Institute
P.O. Box 760549
San Antonio, TX 78245-0549
Telephone: (210)258-9476
e-mail: msh...@txbiomed.org







> On Aug 30, 2016, at 12:32 PM, Shivi Bhatia  wrote:
>
> Hi William/ Mark,
>
> I am using WOE & IV (weight of evidence) reduce the number of independent
> vars.
> I have read this data as a csv file.
> reproducible example for your reference please:
>
> structure(list(date = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 14L,
> 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
>
... truncated
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

CONFIDENTIALITY NOTICE: This e-mail and any files and/or...{{dropped:10}}

__
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] 0 rows> (or 0-length row.names)

2016-08-30 Thread Shivi Bhatia
Hi William/ Mark,

I am using WOE & IV (weight of evidence) reduce the number of independent
vars.
I have read this data as a csv file.
reproducible example for your reference please:

structure(list(date = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 22L,
22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L,
30L, 30L, 30L, 30L), .Label = c("01-02-2016", "01-03-2016", "01-04-2016",
"01-05-2016", "01-06-2016", "01-11-2015", "01-12-2015", "02-01-2016",
"02-02-2016", "02-03-2016", "02-04-2016", "02-05-2016", "02-06-2016",
"02-11-2015", "02-12-2015", "03-01-2016", "03-02-2016", "03-03-2016",
"03-04-2016", "03-05-2016", "03-06-2016", "03-11-2015", "03-12-2015",
"04-01-2016", "04-02-2016", "04-03-2016", "04-04-2016", "04-05-2016",
"04-06-2016", "04-11-2015", "04-12-2015", "05-01-2016", "05-02-2016",
"05-03-2016", "05-04-2016", "05-05-2016", "05-06-2016", "05-11-2015",
"05-12-2015", "06-01-2016", "06-02-2016", "06-03-2016", "06-04-2016",
"06-05-2016", "06-06-2016", "06-11-2015", "06-12-2015", "07-01-2016",
"07-02-2016", "07-03-2016", "07-04-2016", "07-05-2016", "07-06-2016",
"07-11-2015", "07-12-2015", "08-01-2016", "08-02-2016", "08-03-2016",
"08-04-2016", "08-05-2016", "08-06-2016", "08-11-2015", "08-12-2015",
"09-01-2016", "09-02-2016", "09-03-2016", "09-04-2016", "09-05-2016",
"09-06-2016", "09-11-2015", "09-12-2015", "10-01-2016", "10-02-2016",
"10-03-2016", "10-04-2016", "10-05-2016", "10-06-2016", "10-11-2015",
"10-12-2015", "11-01-2016", "11-02-2016", "11-03-2016", "11-04-2016",
"11-05-2016", "11-11-2015", "11-12-2015", "12-01-2016", "12-02-2016",
"12-04-2016", "12-05-2016", "12-06-2016", "12-11-2015", "12-12-2015",
"13-01-2016", "13-02-2016", "13-03-2016", "13-04-2016", "13-05-2016",
"13-06-2016", "13-11-2015", "13-12-2015", "14-01-2016", "14-02-2016",
"14-03-2016", "14-04-2016", "14-05-2016", "14-06-2016", "14-11-2015",
"14-12-2015", "15-01-2016", "15-02-2016", "15-03-2016", "15-04-2016",
"15-05-2016", "15-06-2016", "15-11-2015", "15-12-2015", "16-01-2016",
"16-02-2016", "16-03-2016", "16-04-2016", "16-05-2016", "16-06-2016",
"16-11-2015", "16-12-2015", "17-01-2016", "17-02-2016", "17-03-2016",
"17-04-2016", "17-05-2016", "17-06-2016", "17-11-2015", "17-12-2015",
"18-01-2016", "18-02-2016", "18-03-2016", "18-04-2016", "18-05-2016",
"18-06-2016", "18-11-2015", "18-12-2015", "19-01-2016", "19-02-2016",
"19-03-2016", "19-04-2016", "19-05-2016", "19-06-2016", "19-11-2015",
"19-12-2015", "20-01-2016", "20-03-2016", "20-04-2016", "20-05-2016",
"20-06-2016", "20-11-2015", "20-12-2015", "21-01-2016", "21-02-2016",
"21-03-2016", "21-04-2016", "21-05-2016", "21-06-2016", "21-11-2015",
"21-12-2015", "22-01-2016", "22-02-2016", "22-03-2016", "22-04-2016",
"22-05-2016", "22-06-2016", "22-11-2015", "22-12-2015", "23-01-2016",
"23-02-2016", "23-03-2016", "23-04-2016", "23-05-2016", "23-06-2016",
"23-11-2015", "23-12-2015", "24-01-2016", "24-02-2016", "24-03-2016",
"24-04-2016", "24-05-2016", "24-06-2016", "24-11-2015", "24-12-2015",
"25-01-2016", "25-02-2016", "25-03-2016", "25-04-2016", "25-05-2016",
"25-06-2016", "25-11-2015", "25-12-2015", "26-01-2016", "26-02-2016",
"26-03-2016", "26-04-2016", "26-05-2016", "26-06-2016", "26-11-2015",
"27-01-2016", "27-02-2016", "27-03-2016", "27-04-2016", "27-05-2016",
"27-06-2016", "27-11-2015", "27-12-2015", "28-01-2016", "28-02-2016",
"28-03-2016", "28-04-2016", "28-05-2016", "28-06-2016", "28-11-2015",
"28-12-2015", "29-01-2016", "29-02-2016", "29-03-2016", "29-04-2016",
"29-05-2016", "29-06-2016", "29-11-2015", "29-12-2015", "30-01-2016",
"30-03-2016", "30-04-2016", "30-05-2016", "30-06-2016", "30-11-2015",
"30-12-2015", "31-01-2016", "31-03-2016", "31-05-2016", "31-12-2015"
), class = "factor"), month = structure(c(8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L), .Label = c("Apr",
"Dec", "Feb", "Jan", "Jun", "Mar", "May", "Nov"), class = "factor"),
day = c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 4L, 4L, 4L, 4L), agent = structure(c(30L, 203L,
191L, 127L, 114L, 170L, 41L, 79L, 173L, 247L, 26L, 247L,
23L, 145L, 280L, 101L, 130L, 173L, 62L, 217L, 145L, 140L,
251L, 115L, 62L, 233L, 254L, 85L, 245L, 203L, 174L, 30L,
247L, 238L, 41L, 242L, 267L, 62L, 43L, 127L, 163L, 217L,
275L, 105L, 79L, 191L, 110L, 86L, 247L, 23L), .Label = c("Aakash
Shivach",
"Aanchal Goel", "Abhishek Bisht", "Abhishek Mudireddy", "Abhishek
Singh2",
"Adam Boyle", "Aditi Gogia", "Afsal Backer", "Agam Sud",
"Aishwarya Ramisetti", "Ajay Gangavarapu", "Ajaz Shaikh",
"Akash Chandra", "Akash Jaiswal", "Akhil Jain", "Akhilesh Kumar",
"Akiko 

Re: [R] 0 rows> (or 0-length row.names)

2016-08-30 Thread William Dunlap via R-help
You did not say what operation gave you the error.

I can get that message (which is not an "error") if I print
an illegally constructed data.frame, one without the
row.names attribute.

> illegalDF <- structure(class="data.frame", list(ColumnA = 1:3))
> illegalDF
[1] ColumnA
<0 rows> (or 0-length row.names)
> str(illegalDF)
'data.frame':   0 obs. of  1 variable:
 $ ColumnA: int  1 2 3

Note how str() of the entire data.frame indirectly informs you of the
problem: the number of observations does not match the length of the
columns.

How did you make the data.frame?



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Aug 30, 2016 at 9:24 AM, Shivi Bhatia  wrote:

> I know this question has been asked zillion times but even after consulting
> Stack Overflow & other forum cant figure out the reason.
>
> I have one var in my data-set names case age. This variable is numeric as:
>
> class(SFDC$case_age)
>
> *numeric*
>
> however it throws this error:
>
> <0 rows> (or 0-length row.names)
> As checked this only happens either there is some space at the end of the
> variable name, or there are no values whereas this is a numeric variable
> with no missing values and has a total of 5400 observations.
>
> This var has a range from 0 to 240 in number of days for case variable
> hence i need to do a logarithm transformation & make it use in the model.
> Total unique obs are around 1500.
>
> Please advice.
>
> [[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] 0 rows> (or 0-length row.names)

2016-08-30 Thread Mark Sharp
Shivi,

Can you show the code that throws the error?
<0 rows> (or 0-length row.names)

Of course as always a reproducible sample would be great. Perhaps you can make 
a small subset of the data and use dput() to provide a defined object.

R. Mark Sharp, Ph.D.
Director of Primate Records Database
Southwest National Primate Research Center
Texas Biomedical Research Institute
P.O. Box 760549
San Antonio, TX 78245-0549
Telephone: (210)258-9476
e-mail: msh...@txbiomed.org

> On Aug 30, 2016, at 11:38 AM, Shivi Bhatia  wrote:
>
> Hi Mark,
>
> It gives me num [1:5083]. I have used head also to see first 10 obs:
>
> head(SFDC$case_age,10)
>  [1] 24.84  0.05 13.38  0.15 11.11  4.16  8.13  0.07  3.61  0.00
>
> Thanks.
>
> On Tue, Aug 30, 2016 at 10:05 PM, Mark Sharp  wrote:
> What do you get from
> str(SFDC$case_age)
>
> Mark
>
> R. Mark Sharp, Ph.D.
> Director of Primate Records Database
> Southwest National Primate Research Center
> Texas Biomedical Research Institute
> P.O. Box 760549
> San Antonio, TX 78245-0549
> Telephone: (210)258-9476
> e-mail: msh...@txbiomed.org
>
>
>
>
>
>
>
> > On Aug 30, 2016, at 11:24 AM, Shivi Bhatia  wrote:
> >
> > I know this question has been asked zillion times but even after consulting
> > Stack Overflow & other forum cant figure out the reason.
> >
> > I have one var in my data-set names case age. This variable is numeric as:
> >
> > class(SFDC$case_age)
> >
> > *numeric*
> >
> > however it throws this error:
> >
> > <0 rows> (or 0-length row.names)
> > As checked this only happens either there is some space at the end of the
> > variable name, or there are no values whereas this is a numeric variable
> > with no missing values and has a total of 5400 observations.
> >
> > This var has a range from 0 to 240 in number of days for case variable
> > hence i need to do a logarithm transformation & make it use in the model.
> > Total unique obs are around 1500.
> >
> > Please advice.
> >
> > [[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.
>
> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments 
> transmitted, may contain privileged and confidential information and is 
> intended solely for the exclusive use of the individual or entity to whom it 
> is addressed. If you are not the intended recipient, you are hereby notified 
> that any review, dissemination, distribution or copying of this e-mail and/or 
> attachments is strictly prohibited. If you have received this e-mail in 
> error, please immediately notify the sender stating that this transmission 
> was misdirected; return the e-mail to sender; destroy all paper copies and 
> delete all electronic copies from your system without disclosing its contents.
>




CONFIDENTIALITY NOTICE: This e-mail and any files and/or...{{dropped:10}}

__
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] 0 rows> (or 0-length row.names)

2016-08-30 Thread Shivi Bhatia
Hi Mark,

It gives me num [1:5083]. I have used head also to see first 10 obs:

head(SFDC$case_age,10)
 [1] 24.84  0.05 13.38  0.15 11.11  4.16  8.13  0.07  3.61  0.00

Thanks.

On Tue, Aug 30, 2016 at 10:05 PM, Mark Sharp  wrote:

> What do you get from
> str(SFDC$case_age)
>
> Mark
>
> R. Mark Sharp, Ph.D.
> Director of Primate Records Database
> Southwest National Primate Research Center
> Texas Biomedical Research Institute
> P.O. Box 760549
> San Antonio, TX 78245-0549
> Telephone: (210)258-9476
> e-mail: msh...@txbiomed.org
>
>
>
>
>
>
>
> > On Aug 30, 2016, at 11:24 AM, Shivi Bhatia  wrote:
> >
> > I know this question has been asked zillion times but even after
> consulting
> > Stack Overflow & other forum cant figure out the reason.
> >
> > I have one var in my data-set names case age. This variable is numeric
> as:
> >
> > class(SFDC$case_age)
> >
> > *numeric*
> >
> > however it throws this error:
> >
> > <0 rows> (or 0-length row.names)
> > As checked this only happens either there is some space at the end of the
> > variable name, or there are no values whereas this is a numeric variable
> > with no missing values and has a total of 5400 observations.
> >
> > This var has a range from 0 to 240 in number of days for case variable
> > hence i need to do a logarithm transformation & make it use in the model.
> > Total unique obs are around 1500.
> >
> > Please advice.
> >
> > [[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.
>
> CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments
> transmitted, may contain privileged and confidential information and is
> intended solely for the exclusive use of the individual or entity to whom
> it is addressed. If you are not the intended recipient, you are hereby
> notified that any review, dissemination, distribution or copying of this
> e-mail and/or attachments is strictly prohibited. If you have received this
> e-mail in error, please immediately notify the sender stating that this
> transmission was misdirected; return the e-mail to sender; destroy all
> paper copies and delete all electronic copies from your system without
> disclosing its contents.
>

[[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] 0 rows> (or 0-length row.names)

2016-08-30 Thread Mark Sharp
What do you get from
str(SFDC$case_age)

Mark

R. Mark Sharp, Ph.D.
Director of Primate Records Database
Southwest National Primate Research Center
Texas Biomedical Research Institute
P.O. Box 760549
San Antonio, TX 78245-0549
Telephone: (210)258-9476
e-mail: msh...@txbiomed.org







> On Aug 30, 2016, at 11:24 AM, Shivi Bhatia  wrote:
>
> I know this question has been asked zillion times but even after consulting
> Stack Overflow & other forum cant figure out the reason.
>
> I have one var in my data-set names case age. This variable is numeric as:
>
> class(SFDC$case_age)
>
> *numeric*
>
> however it throws this error:
>
> <0 rows> (or 0-length row.names)
> As checked this only happens either there is some space at the end of the
> variable name, or there are no values whereas this is a numeric variable
> with no missing values and has a total of 5400 observations.
>
> This var has a range from 0 to 240 in number of days for case variable
> hence i need to do a logarithm transformation & make it use in the model.
> Total unique obs are around 1500.
>
> Please advice.
>
> [[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.

CONFIDENTIALITY NOTICE: This e-mail and any files and/or...{{dropped:10}}

__
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] 0^0 computation in R : Why it is defined 1 in R ?

2014-05-26 Thread David Winsemius

On May 26, 2014, at 9:42 AM, Prof Brian Ripley wrote:

> On 26/05/2014 13:16, ritwi...@isical.ac.in wrote:
>> Dear R helpers,
>> 
>> 
>> today I found something interesting in R. 0^0 gives value 1 in R. But it
>> is undefined in mathematics. During debugging a R code, I found it and it
>> effects my program severely. So my question is why it is defined 1 in R?
>> Is there any particular reason or its a bug in the R software?
> 
> Try reading the help:
> 
> Users are sometimes surprised by the value returned, for example
> why ‘(-8)^(1/3)’ is ‘NaN’.  For double inputs, R makes use of IEC
> 60559 arithmetic on all platforms, together with the C system
> function ‘pow’ for the ‘^’ operator.  The relevant standards
> define the result in many corner cases.  In particular, the result
> in the example above is mandated by the C99 standard.  On many
> Unix-alike systems the command ‘man pow’ gives details of the
> values in a large number of corner cases.
> 
> See §F9.4.4 of the C99 standard.
> 

A related questi0n is why NaN^0 == 0 returns TRUE:

http://stackoverflow.com/questions/17863619/why-does-nan0-1/17864651

-- 
David.
> 
>> 
>> Here is one demo:
>> 
>> *
>> 
>> ff=function(u){
>>   return( x^0 * u)
>> }
>> 
>> x=0
>> zz=integrate(ff,lower=0,upper=1)$value
>> zz
>> 
>> 
>> 
>>> source('~/.active-rstudio-document')
>>> zz
>> [1] 0.5
>>> 
>> 
>> *
>> 
>> Looking forward to hear any response.
>> 
>> Regards,
>> 
>> Ritwik Bhattacharya
>> Indian Statistical Institute Kolkata
>> 
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
> PLEASE do 
> 

David Winsemius
Alameda, CA, USA

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


Re: [R] 0^0 computation in R : Why it is defined 1 in R ?

2014-05-26 Thread Jeff Newmiller
You might find searching the web on this topic educational. Consider [1] and 
[2], for example.

I doubt this will be changing, so you should do your exponentiation in a 
function that handles your special case.

By the way, as nice as RStudio might be, it is not R... it USES R. Examples 
like yours won't run as-is in vanilla R so are not really reproducible for 
(probably most) readers of this list. Please (re-)read the Posting Guide.

[1] http://mathforum.org/dr.math/faq/faq.0.to.0.power.html
[2] 
http://www.askamathematician.com/2010/12/q-what-does-00-zero-raised-to-the-zeroth-power-equal-why-do-mathematicians-and-high-school-teachers-disagree/
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On May 26, 2014 5:16:21 AM PDT, ritwi...@isical.ac.in wrote:
>Dear R helpers,
>
>
>today I found something interesting in R. 0^0 gives value 1 in R. But
>it
>is undefined in mathematics. During debugging a R code, I found it and
>it
>effects my program severely. So my question is why it is defined 1 in
>R?
>Is there any particular reason or its a bug in the R software?
>
>Here is one demo:
>
>*
>
>ff=function(u){
>  return( x^0 * u)
>}
>
>x=0
>zz=integrate(ff,lower=0,upper=1)$value
>zz
>
>
>
>> source('~/.active-rstudio-document')
>> zz
>[1] 0.5
>>
>
>*
>
>Looking forward to hear any response.
>
>Regards,
>
>Ritwik Bhattacharya
>Indian Statistical Institute Kolkata
>
>__
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] 0^0 computation in R : Why it is defined 1 in R ?

2014-05-26 Thread Prof Brian Ripley

On 26/05/2014 13:16, ritwi...@isical.ac.in wrote:

Dear R helpers,


today I found something interesting in R. 0^0 gives value 1 in R. But it
is undefined in mathematics. During debugging a R code, I found it and it
effects my program severely. So my question is why it is defined 1 in R?
Is there any particular reason or its a bug in the R software?


Try reading the help:

 Users are sometimes surprised by the value returned, for example
 why ‘(-8)^(1/3)’ is ‘NaN’.  For double inputs, R makes use of IEC
 60559 arithmetic on all platforms, together with the C system
 function ‘pow’ for the ‘^’ operator.  The relevant standards
 define the result in many corner cases.  In particular, the result
 in the example above is mandated by the C99 standard.  On many
 Unix-alike systems the command ‘man pow’ gives details of the
 values in a large number of corner cases.

See §F9.4.4 of the C99 standard.




Here is one demo:

*

ff=function(u){
   return( x^0 * u)
}

x=0
zz=integrate(ff,lower=0,upper=1)$value
zz




source('~/.active-rstudio-document')
zz

[1] 0.5




*

Looking forward to hear any response.

Regards,

Ritwik Bhattacharya
Indian Statistical Institute Kolkata

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


PLEASE do 


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] !0 + !0 == !0 - !0

2013-03-18 Thread Bert Gunter
Sam:

Yes.  Good point. (which is why my "??" was necessary).

-- Bert

On Mon, Mar 18, 2013 at 10:05 AM, Sam Steingold  wrote:

> > * Bert Gunter  [2013-03-17 20:30:56 -0700]:
> >
> > I also think it fair to say that all (??) languages have these sorts
> > of malapropisms due to operator precedence.
>
> Except for those languages which do _not_ have "operator precedence".
> Like, e.g., Lisp.
>
> --
> Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X
> 11.0.11103000
> http://www.childpsy.net/ http://openvotingconsortium.org
> http://jihadwatch.org
> http://palestinefacts.org http://mideasttruth.com http://camera.org
> DRM "access management" == prison "freedom management".
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

[[alternative HTML version deleted]]

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


Re: [R] !0 + !0 == !0 - !0

2013-03-18 Thread Sam Steingold
> * Bert Gunter  [2013-03-17 20:30:56 -0700]:
>
> I also think it fair to say that all (??) languages have these sorts
> of malapropisms due to operator precedence.

Except for those languages which do _not_ have "operator precedence".
Like, e.g., Lisp.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://openvotingconsortium.org http://jihadwatch.org
http://palestinefacts.org http://mideasttruth.com http://camera.org
DRM "access management" == prison "freedom management".

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


Re: [R] !0 + !0 == !0 - !0

2013-03-18 Thread Charles Berry
Ben Bolker  gmail.com> writes:


>   Maybe FAQ 7.31 was referred to not for its direct relevance but as
> a measure of the "old-hand-ness" of the people who will get the joke.


   !1i|!0

Chuck

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


Re: [R] !0 + !0 == !0 - !0

2013-03-18 Thread Ben Bolker
Bert Gunter  gene.com> writes:

> 
> But this has nothing to do with 7.31 and everything to do with operator
> precedence and automatic casting  from integers to logical and vice-versa.
> 
> I also think it fair to say that all (??) languages have these sorts of
> malapropisms due to operator precedence.
> 

  Maybe FAQ 7.31 was referred to not for its direct relevance but as
a measure of the "old-hand-ness" of the people who will get the joke.
I have to admit it took me a minute ...

  Ben Bolker

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


Re: [R] !0 + !0 == !0 - !0

2013-03-17 Thread Bert Gunter
But this has nothing to do with 7.31 and everything to do with operator
precedence and automatic casting  from integers to logical and vice-versa.

I also think it fair to say that all (??) languages have these sorts of
malapropisms due to operator precedence.

-- Bert

On Sun, Mar 17, 2013 at 7:17 PM, Charles Berry  wrote:

>
>
> Hi all,
>
> The subject line is TRUE.
>
> Today I accidentally typed rnorm(!0).
>
> My old eyes took a minute to focus clearly enough to see what I really
> typed and
> why I got '!0' random numbers instead of '10' random normal numbers.
>
> If the subject line is disturbing, be assured that this is TRUE:
>
>  !0^2 == !0 * !0  #  ;-)
>
> Anyway, I hope the hands who have been around long enough to know FAQ 7.31
> by
> heart and know why precedence of operators matters have a laugh.
>
> Best,
>
> Chuck
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

[[alternative HTML version deleted]]

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


Re: [R] !0 + !0 == !0 - !0

2013-03-17 Thread Patrick Burns

Chuck,

What an absolutely wonderful R Infernoism.

Pat

On 18/03/2013 02:17, Charles Berry wrote:



Hi all,

The subject line is TRUE.

Today I accidentally typed rnorm(!0).

My old eyes took a minute to focus clearly enough to see what I really typed and
why I got '!0' random numbers instead of '10' random normal numbers.

If the subject line is disturbing, be assured that this is TRUE:

  !0^2 == !0 * !0  #  ;-)

Anyway, I hope the hands who have been around long enough to know FAQ 7.31 by
heart and know why precedence of operators matters have a laugh.

Best,

Chuck

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



--
Patrick Burns
pbu...@pburns.seanet.com
twitter: @burnsstat @portfolioprobe
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of:
 'Impatient R'
 'The R Inferno'
 'Tao Te Programming')

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


Re: [R] < 0 x 0 matrix >

2009-09-05 Thread Ted Harding
On 05-Sep-09 10:00:26, Markku Karhunen wrote:
>> On 04-Sep-09 10:45:27, Markku Karhunen wrote:
>>> True. Should have read ?diag.
>>>
>>> However, this provokes a more general question: Is there some way I
>>> can declare some scalar and _all its functions_ as matrices?
>>>
>>> For instance, I would like to
>>>
>>> A = as.matrix(0.98)
>>> B = function(A)
>>> C = diag(sqrt(B))
>>>
>>> so that all scalars are explicitly [1,1] matrices.
>>> BR, Markku
>>
>> Hmmm, it might be a good idea to explain why you want to do this.
>> For instance:
>>
>>   M <- matrix(c(1,2,3,4),nrow=2)
>>   c <- matrix(2,nrow=1)
>>   c%*%M
>>   # Error in c %*% M : non-conformable arguments
>>   c*M
>>   # Error in c * M : non-conformable arrays
>>   c+M
>>   # Error in c + M : non-conformable arrays
>>
>> So what would you want to use the [1,1]-matrix scalars for, that
>> cannot be done just using them as numbers?
>>
>> Ted.
> 
> Broadly speaking, I would like to use the same code for multivariate  
> and univariate cases. For instance, I use the inverse Wishart  
> densities of MCMCpack. If I take diwish(x) of a scalar x, the  
> programme crashes, because diwish() by default checks  
> ncol(x)==nrow(x). However, I would like to have an inverse gamma  
> density.
> 
> Best,
> Markku

I see. In such a case, it might be worth wrapping diwish() inside
a function of your own, which tests for 'x' being a scalar and,
if it is, converting it to a 1x1 matrix within the function.
For example:

  diWish <- function(x){
if( all.equal(dim(x),c(1,1)) ) {X <- x} else
if( (is.vector(x))&(length(x)==1) ) X <- as.matrix(x)
diwish(X)
  }

(This may not be optimal, but it gives the idea).
Hoping this helps,
Ted.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 05-Sep-09   Time: 21:26:29
-- XFMail --

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


Re: [R] < 0 x 0 matrix >

2009-09-05 Thread Markku Karhunen




On 04-Sep-09 10:45:27, Markku Karhunen wrote:

True. Should have read ?diag.

However, this provokes a more general question: Is there some way I
can declare some scalar and _all its functions_ as matrices?

For instance, I would like to

A = as.matrix(0.98)
B = function(A)
C = diag(sqrt(B))

so that all scalars are explicitly [1,1] matrices.
BR, Markku


Hmmm, it might be a good idea to explain why you want to do this.
For instance:

  M <- matrix(c(1,2,3,4),nrow=2)
  c <- matrix(2,nrow=1)
  c%*%M
  # Error in c %*% M : non-conformable arguments
  c*M
  # Error in c * M : non-conformable arrays
  c+M
  # Error in c + M : non-conformable arrays

So what would you want to use the [1,1]-matrix scalars for, that
cannot be done just using them as numbers?

Ted.


Broadly speaking, I would like to use the same code for multivariate  
and univariate cases. For instance, I use the inverse Wishart  
densities of MCMCpack. If I take diwish(x) of a scalar x, the  
programme crashes, because diwish() by default checks  
ncol(x)==nrow(x). However, I would like to have an inverse gamma  
density.


Best,
Markku

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


Re: [R] < 0 x 0 matrix >

2009-09-04 Thread Ted Harding
On 04-Sep-09 10:45:27, Markku Karhunen wrote:
> True. Should have read ?diag.
> 
> However, this provokes a more general question: Is there some way I  
> can declare some scalar and _all its functions_ as matrices?
> 
> For instance, I would like to
> 
> A = as.matrix(0.98)
> B = function(A)
> C = diag(sqrt(B))
> 
> so that all scalars are explicitly [1,1] matrices.
> BR, Markku

Hmmm, it might be a good idea to explain why you want to do this.
For instance:

  M <- matrix(c(1,2,3,4),nrow=2)
  c <- matrix(2,nrow=1)
  c%*%M
  # Error in c %*% M : non-conformable arguments
  c*M
  # Error in c * M : non-conformable arrays
  c+M
  # Error in c + M : non-conformable arrays

So what would you want to use the [1,1]-matrix scalars for, that
cannot be done just using them as numbers?

Ted.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 04-Sep-09   Time: 14:51:52
-- XFMail --

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


Re: [R] < 0 x 0 matrix >

2009-09-04 Thread Markku Karhunen


True. Should have read ?diag.

However, this provokes a more general question: Is there some way I  
can declare some scalar and _all its functions_ as matrices?


For instance, I would like to

A = as.matrix(0.98)
B = function(A)
C = diag(sqrt(B))

so that all scalars are explicitly [1,1] matrices.

BR, Markku


On Fri, Sep 4, 2009 at 11:25 AM, Markku
Karhunen wrote:

Hi,

Does anybody know, what is going on here?


diag(sqrt(1))


    [,1]
[1,]    1


diag(sqrt(0.))


<0 x 0 matrix>


sqrt(1)


[1] 1


sqrt(0.)


[1] 0.5773214



 Read the help for diag yet?

'diag' has four distinct usages:
...
3.  'x' is a scalar (length-one vector) and the only argument
   it a square identity matrix of size given by the scalar.
...

So diag(0.1) becomes diag(0) which is a 0-size matrix. Try diag(2.4)

Barry




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


Re: [R] < 0 x 0 matrix >

2009-09-04 Thread Duncan Murdoch

Duncan Murdoch wrote:

baptiste auguie wrote:
  

it's documented as "unexpected"

?diag
Note

Using diag(x) can have unexpected effects if x is a vector that could be of
length one. Use diag(x, nrow = length(x)) for consistent behaviour.


And the result follows from this part,

else if (length(x) == 1L && nargs() == 1L) {
n <- as.integer(x)
x <- 1
}
  



Looks like the man page is wrong:  it says diag(0.9) should produce a 
1x1 matrix, but as the code shows, it produces a 0x0 one.

I'll fix it.
  


Oops, this has already been fixed.  I was looking at an old version of R 
on this laptop.


Duncan Murdoch

Duncan Murdoch
  

baptiste

2009/9/4 Markku Karhunen 

  


Hi,

Does anybody know, what is going on here?

 diag(sqrt(1))

[,1]

[1,]1


  

diag(sqrt(0.))

  


<0 x 0 matrix>


  

sqrt(1)

  


[1] 1


  

sqrt(0.)

  


[1] 0.5773214

BR, Markku Karhunen
researcher
University of Helsinki

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


  


  



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




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



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


Re: [R] < 0 x 0 matrix >

2009-09-04 Thread Duncan Murdoch

baptiste auguie wrote:

it's documented as "unexpected"

?diag
Note

Using diag(x) can have unexpected effects if x is a vector that could be of
length one. Use diag(x, nrow = length(x)) for consistent behaviour.


And the result follows from this part,

else if (length(x) == 1L && nargs() == 1L) {
n <- as.integer(x)
x <- 1
}
  


Looks like the man page is wrong:  it says diag(0.9) should produce a 
1x1 matrix, but as the code shows, it produces a 0x0 one.

I'll fix it.

Duncan Murdoch


baptiste

2009/9/4 Markku Karhunen 

  

Hi,

Does anybody know, what is going on here?

 diag(sqrt(1))

[,1]

[1,]1



diag(sqrt(0.))

  

<0 x 0 matrix>



sqrt(1)

  

[1] 1



sqrt(0.)

  

[1] 0.5773214

BR, Markku Karhunen
researcher
University of Helsinki

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






  



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



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


Re: [R] < 0 x 0 matrix >

2009-09-04 Thread baptiste auguie
it's documented as "unexpected"

?diag
Note

Using diag(x) can have unexpected effects if x is a vector that could be of
length one. Use diag(x, nrow = length(x)) for consistent behaviour.


And the result follows from this part,

else if (length(x) == 1L && nargs() == 1L) {
n <- as.integer(x)
x <- 1
}


baptiste

2009/9/4 Markku Karhunen 

> Hi,
>
> Does anybody know, what is going on here?
>
>  diag(sqrt(1))
>>
> [,1]
> [1,]1
>
>> diag(sqrt(0.))
>>
> <0 x 0 matrix>
>
>> sqrt(1)
>>
> [1] 1
>
>> sqrt(0.)
>>
> [1] 0.5773214
>
> BR, Markku Karhunen
> researcher
> University of Helsinki
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

http://newton.ex.ac.uk/research/emag
__

[[alternative HTML version deleted]]

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


Re: [R] < 0 x 0 matrix >

2009-09-04 Thread Duncan Murdoch

Markku Karhunen wrote:

Hi,

Does anybody know, what is going on here?
  


diag( x ) produces a round(x) x round(x) identity matrix when x is 
length 1.   (This is the third case listed on the man page ?diag).  See 
the note there about a safer form if you wanted a matrix with x on the 
diagonal.


Duncan Murdoch
  

diag(sqrt(1))


  [,1]
[1,]1
  

diag(sqrt(0.))


<0 x 0 matrix>
  

sqrt(1)


[1] 1
  

sqrt(0.)


[1] 0.5773214

BR, Markku Karhunen
researcher
University of Helsinki

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



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


Re: [R] < 0 x 0 matrix >

2009-09-04 Thread Barry Rowlingson
On Fri, Sep 4, 2009 at 11:25 AM, Markku
Karhunen wrote:
> Hi,
>
> Does anybody know, what is going on here?
>
>> diag(sqrt(1))
>
>     [,1]
> [1,]    1
>>
>> diag(sqrt(0.))
>
> <0 x 0 matrix>
>>
>> sqrt(1)
>
> [1] 1
>>
>> sqrt(0.)
>
> [1] 0.5773214
>

 Read the help for diag yet?

'diag' has four distinct usages:
...
3.  'x' is a scalar (length-one vector) and the only argument
   it a square identity matrix of size given by the scalar.
...

So diag(0.1) becomes diag(0) which is a 0-size matrix. Try diag(2.4)

Barry

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


Re: [R] < 0 x 0 matrix >

2009-09-04 Thread Romain Francois

On 09/04/2009 12:25 PM, Markku Karhunen wrote:


Hi,

Does anybody know, what is going on here?


diag(sqrt(1))

[,1]
[1,] 1

diag(sqrt(0.))

<0 x 0 matrix>

sqrt(1)

[1] 1

sqrt(0.)

[1] 0.5773214

BR, Markku Karhunen
researcher
University of Helsinki


Try this instead;

> diag( sqrt(.), 1, 1 )
  [,1]
[1,] 0.5773214

Romain

--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/xMdt : update on the ant package
|- http://tr.im/xHLs : R capable version of ant
`- http://tr.im/xHiZ : Tip: get java home from R with rJava

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