Sunday, October 21, 2012

Part4: Debugging in R

  Debugging tools are built with R do not part of any package. There are couple of indications that something is not right. It could be a diagnostic message something to happed.Basically three type of main indications.
  1. message: A generic notification/diagnostic message produced by the message function; execution of the function continues 
  2. warning: An indication that something is wrong but not necessarily fatal;execution of the function continues generated by the warning function 
  3. error: An indication that a fatal problem has occurred; execution stops;produced by the stop function
condition: A generic concept for indicating that something unexpected can occur; programmers can create their own conditions

So this is our basic warning,  take a log of negative number

>log(-1)
[1] NaN
Warning message:
In log(-1) : NaNs produced

Tuesday, October 9, 2012

Part3: Reading and Writing Data in R


Reading Data   

Large data objects will usually be read as values from external files rather than entered during an R session at the keyboard. R input facilities are simple and their requirements are fairly strict and even rather inflexible. If variables are to be held mainly in data frames, as we strongly suggest they should be, an entire data frame can be read directly with the read.table() function. There is also a more primitive input function, scan(), that can be called directly. There are a few principal functions reading data into R. 
  1. read.table, read.csv, for reading tabular data

    The read.table function is one of the most commonly used functions for reading data. It has a few important arguments:
    • file, the name of a file, or a connection
    • header, logical indicating if the file has a header line
    • sep, a string indicating how the columns are separated
    • colClasses, a character vector indicating the class of each column in the dataset
    • nrows, the number of rows in the dataset
    • comment.char, a character string indicating the comment character
    • skip, the number of lines to skip from the beginning
    • stringsAsFactors, should character variables be coded as factors

    For small to moderately sized datasets, you can usually call read.table without specifying any other arguments
    data <- read.table("foo.txt")

    R will automatically skip lines that begin with a # and figure out how many rows there are (and how much memory needs to be allocated). Figure what type of variable is in each column of the table. Telling R all these things directly makes R run faster and more efficiently. read.csv is identical to read.table except that the default separator is a comma.

Sunday, September 30, 2012

Part2: R-Language Basics

 Data Types and Basic Operations:

1. Objects:
   In every computer language variables provide a means of accessing the data stored in memory. R does not provide direct access to the computer’s memory but rather provides a number of specialized data structures we will refer to as objects.These objects are referred to through symbols or variables.

R has five basic or atomic classes of objects:


  1. characters
  2. numeric(real numbers)
  3. integer
  4. complex
  5. logical(True or False)
2. Basic types:

2.1 Vectors:
The most basic object in R is vector. A vector can only contain objects of the same class. But the exception is a 'list', which is represent  as a vector but can contain objects of different classes. Empty vectors can be created with the vector() function.

 2.2 Lists:
Lists are another kind of data storage. Lists have elements, each of which can contain any type of R object, i.e. the elements of a list do not have to be of the same type.

Saturday, September 29, 2012

Part1: Introduction and Installation of R Programming Language

  R is really interesting  open source programming language and software environment for statistical computing and graphics. It compiles and run on wide verity  of UNIX platforms, Windows and Mac OS. It provides, among other things, a programming language, high level graphics, interfaces to other languages and debugging facilities.

 The source code for the R software environment is written primarily in C, Fortan, and R. R is freely available under the GNU General Public License. R uses a command line interface; however, Rstudio like graphical interface are available for use with R.



Wednesday, September 26, 2012

Simple Program to copy its input to output

This program copy anything to anything.Since the input and output can be redirected to any file or device.
   We can write a simple program to copy its input to output.we use low level I/O read and write system calls.we have collected function prototypes for the system calls into a file called syscalls.h.so we can include it in this program.but the name syscalls.h is not standard.In UNIX system "unistd.h" is used instead of "syscalls.h".The program code is below:














The parameter BUFSIZ is defined in "stdio.h"; Its value is  good size for the local system. if the file size is not a multiple of BUFSIZ, some read will return a smaller number of bytes to be written by write; the next call to read after that will return zero.

Friday, September 21, 2012

Git Basics and Using Github

Hi, this blog entry is for beginners who want to try out Git and GitHub. I am setting up this on Ubuntu .

What is Git and How is setting Up with Ubuntu? :


Git  is a distributed revision control and source code management (SCM) system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development.


Setting up Git in your system:

First install Git in your machine, Enter the command seen in Below in terminal(Alt+Shift+T):









You can test the installation by simply typing git.It should print out the instructions of Git

 












If you don't see this.then try to install Git again

Sunday, September 2, 2012

MY FIRST AVR PROGRAMMER IN LINUX


          It is simple to beginners...!.simple AVR Programmer will allow you to transfer hex programs to most ATMEL AVR microcontrollers in less time. It is more reliable one and built in short time.
          It consist of simple circuit serial programmer.You may also use this programmer as a stand alone in-circuit serial programmer that can be used to conveniently program AVR microcontrollers without removing them from the target circuit. This programmer is tested with Pony Prog software.my OS is linux, PonyProg version is also available for windows and Linux. The GUI version is simple for beginners. The link for linux version is Here
          After downloading, Login as root, execute the command "tar xfz ponyprog.tar.gz" and follow the instructions int the README file. PonyProg for Linux needs the V lib shared library v1.20 or later to work.

AVR Serial Programmer Circuit



Components required:

Resistors:

R1 = 4.7k
R2 = 10k
R3 = 4.7k
R4 = 15k
R5 = 10k

Diode:
D1 = 1N4148
D2 = 5.1V ZENER
D3 = 5.1V ZENER

Transistor:
Q1 = BC549

Connector: DB9 (to serial port of PC) 
Bread Board


Connection to target AVR microcontroller: