Installing R on Linux

R is very popular Statistical Analysis tool, scientific computing, general programming, and it also has packages for Machine Learning.

To install R on Linux (Ubuntu 14.04 LTS) follow the directions given at the CRAN Project page :

http://cran.r-project.org/bin/linux/ubuntu/README.html

Open Gnome Terminal and issue these commands:

  •  sudo apt-get update   (This will update the lists of software for APT Tool)
  • sudo apt-get install r-base  (This will install r-base or the core R Packages)
  • Once R is installed. Just type R at the command prompt to work with the R Core packages !
  • To work with RStudio, a popular graphical IDE for R, just type rstudio at the GNome Terminal to launch it. RStudio provides R Code run, package updates, package install, and advanced debugging capabilities.

Screenshot 2015-04-06 20:55:02 Screenshot 2015-04-06 21:27:21

Enjoy !

Advertisements

#how-to, #linux, #r-language

SQL | ORACLE | How-To | Snippets

SQL | ORACLE 10g+ |

To get the next N months (text) from a start Date.Here the Next 12 months given a start_date of 08/2013


  • select add_months( start_date, level-1 ) as monthName from (select to_date(’08/2013′,’mm-yyyy’) start_date,  ADD_MONTHS(to_date(’08/2013′, ‘mm-yyyy’), 12) end_date from dual)  connect by level <= months_between(trunc(end_date,’MM’), trunc(start_date,’MM’) )   * + 1;

To detect which tables are referencing a table via FKs


select table_name, constraint_name, status, owner
from all_constraints
where r_owner = :r_owner
and constraint_type = ‘R’
and r_constraint_name in
(
select constraint_name from all_constraints
where constraint_type in (‘P’, ‘U’)
and table_name = :r_table_name
and owner = :r_owner
)
order by table_name, constraint_name;

To detect and remove duplicates via self-join

SELF JOIN TO DETECT AND REMOVE DUPLICATES

select
FIELD_A,
FIELD_B,
FIELD_C
from
MY_TABLE  a
where
rowid >
(select min(rowid) from MY_TABLE b
where
b.FIELD_A = a.FIELD_A
and
b.FIELD_B = a.FIELD_B
and
b.FIELD_C = a.FIELD_C
);

#how-to, #oracle, #snippets, #sql