Wednesday, November 30

Data Visualization : Jump Start Plotting With R

Why is data visualization important?

Data Visualization is important because of the way the human brain processes information, using charts or graphs to visualize large amounts of complex data is easier than poring over spreadsheets or reports. Data visualization is a quick, easy way to convey concepts in a universal manner – and you can experiment with different scenarios by making slight adjustments.

Preparing your organization for data visualization technology requires that you first:

  • Understand the data you’re trying to visualize, including its size and cardinality (the uniqueness of data values in a column).
  • Determine what you’re trying to visualize and what kind of information you want to communicate.
  • Know your audience and understand how it processes visual information.
  • Use a visual that conveys the information in the best and simplest form for your audience.
 Here are some simple ways to plot data using R tools.


     
  1. Basic scatterplot - Main arguments x and y are vectors indicating 
    the x and y coordinates of the data points (in this case, 10).
    Code-
    plot(x = 1:10,
         y = 1:10,
         xlab = "My-XAxis",
         ylab = "My=YAxis",
         main = "Graph Title")
     
     
  2. Using Transparent Colors in plots - Example of basic plotting with color using "yarrr" package transparent color - Most plotting functions have a color argument
     (usually col) that allows you to specify the color of whatever your plotting.
    Code-
    plot(x = pirates$height, 
         y = pirates$weight, 
         col = yarrr::transparent("blue", trans.val = .9), 
         pch = 16, 
         main = "col = yarrr::transparent('blue', .9)") 
  3. Using default R Colors in plots - Most plotting functions have a color argument
     (usually col) that allows you to specify the color of whatever your plotting.
    Code
    plot(x = pirates$height, 
         y = pirates$weight, 
         col = "blue", 
         pch = 16, 
         main = "col ='blue'")
     
     
  4. Plotting scatterplot with arguments - Example of plotting with arguments. he plot() function makes a scatterplot from two vectors x 
    and y, where the x vector indicates the x (horizontal) values of the 
    points, and the y vector indicates the y (vertical) values. 
    Code
    plot(x = 1:10,                         # x-coordinates
         y = 1:10,                         # y-coordinates
         type = "p",                       # Just draw points (no lines)
         main = "My First Plot",
         xlab = "This is the x-axis label",
         ylab = "This is the y-axis label",
         xlim = c(0, 11),                  # Min and max values for x-axis
         ylim = c(0, 11),                  # Min and max values for y-axis
         col = "blue",                     # Color of the points
         pch = 16,                         # Type of symbol (16 means Filled circle)
         cex = 1)                           # Size of the symbols 
     
     
  5. Histograms are the most common way to plot a vector of numeric data.
    Code -
    hist(x = ChickWeight$weight,
         main = "Chicken Weights",
         xlab = "Weight",
         xlim = c(0, 500)) 
     
     
    
    
  6. Barplot typically shows summary statistics for different groups. 
    The primary argument to a barplot is height: a vector of numeric values which will generate the height of each bar.
    To add names below the bars, use the names.arg argument.  
    Code
    
    barplot(height = 1:5,  # A vector of heights
            names.arg = c("G1", "G2", "G3", "G4", "G5"), # A vector of names
            main = "Example Barplot", 
            xlab = "Group", 
            ylab = "Height")
     
     
  7. Pirateplot is a plot contained in the "yarrr package" written specifically by, and for R pirates The pirateplot is an easy-to-use function that, unlike barplots and boxplots, can easily show raw data, descriptive statistics, and inferential statistics in one plot.
     Code -


     yarrr::pirateplot(formula = weight ~ Time, # dv is weight, iv is Diet
                   data = ChickWeight,
                   main = "Pirateplot of chicken weights",
                   xlab = "Diet",
                   ylab = "Weight")
 

Finally, we can save these graphs as pdf file using pdf function of R
Code pdf(file = "D:\MyPlot.pdf",   # The directory you want to save the file in
    width = 4, # The width of the plot in inches
    height = 4) # The height of the plot in inches

# Step 2: Create the plot with R code
plot(x = 1:10,
     y = 1:10)
abline(v = 0) # Additional low-level plotting commands
text(x = 0, y = 1, labels = "Random text")

# Step 3: Run dev.off() to create the file!
dev.off()

  

Wednesday, November 9

Why Nano GPS Chip embedded Indian currency note cannot be a reality

The TV channels, news papers and social media has been talking about new Indian currency of 500 & 2000 INR denominations that were supposed to have Nano GPS chips! Great idea that could make life easier for the government but an impractical one. More ever it that would be illegal and breach of privacy law for a government to track currency notes real time using GPS technology.
              Anyway we are only interested in the technology part so lets discuss the technical feasibility of the idea. If it were not illegal for the government to trace currency in your pockets, cupboards, briefcases and other secret hiding places then it would be every governments dream project to implement so called 'nano GPS based currency notes' and ensure each note leaving the treasury is accounted for, that there are no fake notes in circulation and all the notes traveling across the world to exotic locations and the safe tax havens could be tracked by the government revenue agencies sitting in a room.  GPS technology requires a server that can position a device and a device that can use internet to send its location to the GPS server which means the 'Currency notes with GPS chips' would have to send signal to GPS server and for that they would require a power source and that is what makes the idea unimplementable, even if the countries law allowed tracking of currency.

Why would a government want to use GPS Chip in Currency notes if it were not against privacy laws?
  1. Every illegal activity involves paper money transaction to avoid leaving traces
  2. Illegal activities like drug trade, fake currency, terrorism, bribery are huge industries that are affecting economies of all countries
  3. Tracking of genuine/fake currency notes is not possible at point of services and so it is not easy to control the fake currency notes that get pumped into the economy
  4. Monitoring the high taxpayers (& non taxpayers) and their currency transactions would be possible if notes could be tracked
  5. Government can (and does) track all your electronic transactions but not the currency transactions without ability to track currency notes
As the Finance Minister said in future he would like more and more people to use electronic money to curb corruption and ensure all people pay taxes that are due to them. 

Saturday, October 8

Digital for Health Care : CBC Monitor application for Cancer Patients

We have been discussing Digital India, Digital World and yet one of the most important segment of our life, Health Care still lacks Digital initiatives. I have made a simple android application to help cancer patients keep track of their CBC and BCR-ABL records and get rid of the paper reports. Do share the CBC Monitor app with people who may find this application useful. The next version of the CBC Monitor will have more advanced features where you would be able to get reports converted to Graphical format by importing them from your mail or Google drive.

https://play.google.com/store/apps/details?id=com.smartmob.projects.activity 


Description from Google Play :
About CBC Monitor App
CBC Monitor is an app to maintain your CBC record (complete blood count) in your android mobile or tablet. The application is useful for people who have to keep track of their Complete Blood Count.
What is CBC or complete blood count?
A complete blood count (CBC) is a blood test used to evaluate your overall health and detect a wide range of disorders, including anemia, infection and leukemia (cancer).
How can CBC Monitor helps you?
1) You can Save all your CBC reports in digital format & get rid of the paper reports
2) You can view your CBC report in graphical format
3) You can compare each parameter of your CBC report across past reports
4) You can share the reports with your doctor, your hospital, your insurance company & your family directly from your mobile.
5) CML (Chronic myeloid leukemia) and Caner patient who have to do CBC test every month will find this application helpful to save their records, view then as a graph and share them with their doctor using phone, email, Whatsapp, Viber or any other communication software installed on their phone.
What mobile devices can I install CBC Monitor on?
Currently the CBC Monitor application can be installed on Android mobile and tablets from Android 4.0 (ICE_CREAM_SANDWICH) onward. If you are a cancer patient and are using an older version of android you can mail us and we can help create a custom application to get it working on your older Android phone - for no additional charges. It can also be used for non-cancer patient who want to maintain their CBC reports.
Support Email : smartmobileideas@gmail.com

MUSTREAD : How can you use Index Funds to help create wealth? HDFC MF Weekend Bytes

https://www.hdfcfund.com/knowledge-stack/mf-vault/weekend-bytes/how-can-you-use-index-funds-help-create-wealth?utm_source=Netcore...