Any way to set number of decimal places?

10 views
Skip to first unread message

Bruce Miller

unread,
Aug 25, 2017, 4:51:58 PM8/25/17
to ded...@googlegroups.com
Hi all,

Ian et al. have helped a lot with setting up the extraction of data I need to do repetitively for bat calls.

I am using this code as my base and each run just changing the designated data (species code- Yellow) for the file name each time.


BatStats<-Deducer::descriptive.table (vars = d (Dur,TBC,Fmin,Fmax,BW,Fmean,Fk,Fc,Sc,Pmc),data= BatStats,func.names =c("Valid N","Minimum","Maximum","Mean","St. Deviation"),func.additional= list(p10=function(x) quantile(x, c(0.10), na.rm=TRUE),p25=function(x) quantile(x, c(0.25), na.rm=TRUE),p75=function(x) quantile(x, c(0.75),na.rm=TRUE),p90=function(x) quantile(x, c(0.90),na.rm=TRUE)))

## Write the results and change output name and directory for the call stats.

write.csv(BatStats,file="C:\\=Bat data working\\Acoustic Parameters\\Lasega_Stats.csv")


I assume there is a way to limit the output to 2 decimal places, but have not found how to do that.  Currently the CSV file is opened in Excel and then formatted for N= 2 decimal places.


If I can set that up in Deducer that will save a lot of repetitive steps.
Oh one other thing I assume can be done but again have not been able to find is how to change the column headings for the *csv write file from the default

strata..all.cases..Valid.N    strata..all.cases..Minimum    strata..all.cases..Maximum    strata..all.cases..Mean    strata..all.cases..St..Deviation    strata..all.cases..p10    strata..all.cases..p25    strata..all.cases..p75    strata..all.cases..p90
To what they actually are

Parameters    N    Min    Max    Mean    St.Dev    10%    25%    75%    90%

Thanks as always for guidance and help.

Bruce




rudolf....@gmail.com

unread,
Aug 29, 2017, 2:18:50 AM8/29/17
to Deducer
Instead of rounding in excel before importing you can import and in Deducer Menu go to Data Transform, select the variables to be transformed and Transformation, scroll down in Transformation to custom formula and enter there the R rounding function by typing in e.g.  round (x,2).

To display for instance the mean with 1 digits only it is possible to set the option before running deducer command
options(digits=1) 
then run mean function as usual

Hope that helps.
Rudolf

Bruce Miller

unread,
Sep 3, 2017, 9:55:20 AM9/3/17
to ded...@googlegroups.com
Trying to access Package Mgr in Deducer not working:
> JGR::package.manager()

java.lang.OutOfMemoryError: unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Unknown Source)
    at org.rosuda.JGR.MonitoredEval.run(JGR.java:968)
    at org.rosuda.JGR.JGR.timedEval(JGR.java:330)
    at org.rosuda.JGR.JGR.timedEval(JGR.java:322)
    at org.rosuda.JGR.RController.refreshPackages(RController.java:563)
    at org.rosuda.JGR.JGRPackageManager.refresh(JGRPackageManager.java:263)
    at
org.rosuda.JGR.JGRPackageManager.showInstance(JGRPackageManager.java:244)
    at org.rosuda.JRI.Rengine.rniRunMainLoop(Native Method)
    at org.rosuda.JRI.Rengine.run(Rengine.java:640)

I was working and nothing has changed that I am aware of.
So now I am puzzled.

Below is complete load listing:

R version 3.2.5 (2016-04-14) -- "Very, Very Secure Dishes"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>
Loading required package: JGR
Loading required package: rJava
Loading required package: JavaGD
Loading required package: iplots
starting httpd help server ... done
Loading required package: DeducerExtras
Loading required package: Deducer
Loading required package: ggplot2
Loading required package: car
Loading required package: MASS
Loading required package: irr
Loading required package: lpSolve


Bruce
Reply all
Reply to author
Forward
0 new messages