Re: [R] Precision of values > 53 bits

2017-07-20 Thread Ted Harding
On Thu, 2017-07-20 at 14:33 +0200, peter dalgaard wrote:
> > On 10 Jan 2013, at 15:56 , S Ellison  wrote:
> > 
> > 
> > 
> >> I am working with large numbers and identified that R looses 
> >> precision for such high numbers.
> > Yes. R uses standard 32-bit double precision.
> 
> 
> Well, for large values of 32... such as 64.

Hmmm ... Peter, as one of your compatriots (guess who) once solemnly
said to me:

  2 plus 2 is never equal to 5 -- not even for large values of 2.

Best wishes,
Ted.

__
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] dynamically create columns using a function

2017-07-20 Thread DIGHE, NILESH [AG/2362]
Hi,
I am writing a function to dynamically create column names and fill those 
columns with some basic calculations.  My function "demo_fn" takes argument 
"blup_datacut" and I like to use the contents of those arguments to dynamically 
create new columns in my dataset. Please note that I have another function 
called "calc_gg" within the function "demo_fn". Both functions are pasted below.
I have a for loop within my function and it appears to only create new column 
for the last value in the argument "blup_datacut" which makes me think that I 
am not storing the values coming out of for_loop correctly. I have 
"expected_results", dataset, & functions pasted below to reproduce my problem 
and expected results.
Any help will be greatly appreciate.


# dataset
dem<- structure(list(id = c("L1", "L2", "L3", "M1", "M2", "M3"), TEST_SET_NAME 
= c("A",
"A", "A", "B", "B", "B"), YLD_BE_REG1 = c(1467L, 1455L, 1382L,
1463L, 1466L, 1455L), YLD_BE_REG2 = c(1501L, 1441L, 1421L, 1482L,
1457L, 1490L), IS_GG = c("NO", "NO", "YES", "NO", "NO", "YES"
)), .Names = c("id", "TEST_SET_NAME", "YLD_BE_REG1", "YLD_BE_REG2",
"IS_GG"), class = "data.frame", row.names = c(NA, -6L))

# function demo_fn

demo_fn<- function (dat, blup_datacut = c("REG1", "REG2"))

{

for (i in seq_along(blup_datacut)) {

col_name_gg <- paste("GG", blup_datacut[i], sep = "_")

col_mean_gg <- paste("YLD_BE", blup_datacut[i], sep = "_")

dat2 <- calc_gg(dataset = dat, col = col_mean_gg, col_name = 
col_name_gg)

}

dat2

}


# function calc_gg

Calc_gg<- function (dataset, col, col_name)

{

mutate_call = lazyeval::interp(~round(((a - mean(a[IS_GG ==

"YES"], na.rm = TRUE))/mean(a[IS_GG == "YES"], na.rm = TRUE)) *

100, 1), a = as.name(col))

dataset %>% group_by(TEST_SET_NAME) %>% mutate_(.dots = 
setNames(list(mutate_call),

col_name)) %>% ungroup()

}


# run function
results_demo<- demo_fn(dat =  dem)

# expected results

structure(list(id = c("L1", "L2", "L3", "M1", "M2", "M3"), TEST_SET_NAME = 
c("A",

"A", "A", "B", "B", "B"), YLD_BE_REG1 = c(1467L, 1455L, 1382L,

1463L, 1466L, 1455L), YLD_BE_REG2 = c(1501L, 1441L, 1421L, 1482L,

1457L, 1490L), IS_GG = c("NO", "NO", "YES", "NO", "NO", "YES"

), GG_REG1 = c(6.2, 5.3, 0, 0.5, 0.8, 0), GG_REG2 = c(5.6, 1.4,

0, -0.5, -2.2, 0)), .Names = c("id", "TEST_SET_NAME", "YLD_BE_REG1",

"YLD_BE_REG2", "IS_GG", "GG_REG1", "GG_REG2"), row.names = c(NA,

-6L), class = "data.frame")

Thanks.
Nilesh
This email and any attachments were sent from a Monsanto email account and may 
contain confidential and/or privileged information. If you are not the intended 
recipient, please contact the sender and delete this email and any attachments 
immediately. Any unauthorized use, including disclosing, printing, storing, 
copying or distributing this email, is prohibited. All emails and attachments 
sent to or from Monsanto email accounts may be subject to monitoring, reading, 
and archiving by Monsanto, including its affiliates and subsidiaries, as 
permitted by applicable law. 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.


Re: [R] Installing rpy2 on Red Hat 6

2017-07-20 Thread Marc Schwartz

> On Jul 20, 2017, at 7:53 AM, Larry Martell  wrote:
> 
> I need to install rpy2 on RHEL6. The version of R in the 6 repos is
> 3.0, and rpy2 does not work with that version. I installed R 3.3.3
> following the directions here:
> https://oguya.ch/posts/2017-03-18-building-R-on-rhel-6/. But even with
> 3.3.3 it's still failing. Using pip it fails with:
> 
> /usr/local/lib64/R/lib/libR.a(CommandLineArgs.o): could not read
> symbols: Bad value
> 
> and installing from source it fails with:
> 
> /usr/bin/ld: cannot find -lr_utils
> 
> Anyone know how I can get rpy2 working on RHEL6?
> 
> (I did post to the rpy mailing list and also on SO, but did not get
> any answers.)
> 


Hi,

For future reference, posts regarding R and RHEL/Fedora and derivatives should 
to go R-SIG-Fedora:

  https://stat.ethz.ch/mailman/listinfo/r-sig-fedora

>From looking at the EPEL repo for RHEL 6:

  http://mirror.sjc02.svwh.net/fedora-epel/6/x86_64/

there are R 3.4.0 RPMS there since May. So:

  sudo yum install R

should get you R 3.4.0 if you have the EPEL repos properly configured.

>From a review of the rpy2 page, it would seem that 3.2+ should be ok. If so, I 
>would recommend installing the R RPMS for 3.4.0 from the EPEL and save 
>yourself the hassle and potential issues of building from source.

Regards,

Marc Schwartz


  
__
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] Installing rpy2 on Red Hat 6

2017-07-20 Thread Larry Martell
I need to install rpy2 on RHEL6. The version of R in the 6 repos is
3.0, and rpy2 does not work with that version. I installed R 3.3.3
following the directions here:
https://oguya.ch/posts/2017-03-18-building-R-on-rhel-6/. But even with
3.3.3 it's still failing. Using pip it fails with:

/usr/local/lib64/R/lib/libR.a(CommandLineArgs.o): could not read
symbols: Bad value

and installing from source it fails with:

/usr/bin/ld: cannot find -lr_utils

Anyone know how I can get rpy2 working on RHEL6?

(I did post to the rpy mailing list and also on SO, but did not get
any answers.)

__
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] Precision of values > 53 bits

2017-07-20 Thread peter dalgaard

> On 10 Jan 2013, at 15:56 , S Ellison  wrote:
> 
> 
> 
>> I am working with large numbers and identified that R looses 
>> precision for such high numbers.
> Yes. R uses standard 32-bit double precision.


Well, for large values of 32... such as 64.

-- 
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.