Saturday, January 13, 2018

Coursera : Getting and Cleaning Data - Week 1 Quiz

Masa nak buat quiz 1

Question 3

Download the Excel spreadsheet on Natural Gas Aquisition Program here:
Read rows 18-23 and columns 7-15 into R and assign the result to a variable called dat
What is the value of sum(dat$Zip*dat$Ext,na.rm=T)?

Dapat error message berikut:
R is giving you an error -- could not find function
lepas tu x boleh load package xlsx , sangkut lak rjava 
library(rJava)
Error in get(Info[i, 1], envir = env) : 
  lazy-load database 'C:/Users/sony/Documents/R/win-library/3.1/rJava/R/rJava.rdb' is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
Error: package or namespace load failed for ‘rJava’

Penyelesaian:
Step 1:

Note that it is necessary to ‘manually download and install’ the 64 bit version of JAVA. By default, the download page gives a 32 bit version .
You can pick the exact version of Java you wish to install from this link. If you might (for some reason) work on both versions of R, you can install both version of Java (Installing the “Java Runtime Environment” is probably good enough for your needs).
(Source: Uwe Ligges)
Step 2:

This will call up this dialog box with edit rights for the PATH variable (and other system variables):
enter image description here

Step 4:
Dalam R
  Sys.setenv(JAVA_HOME="")

Installing and loading xlsx package

  • Install
install.packages("xlsx")
  • Load
library("xlsx")









No comments:

5 Faedah RTOS Linux Kernel - Apa Itu Sistem Operasi Masa Nyata (RTOS) di Malaysia

Di VIENNA dimana selepas 20 Tahun, Real-Time Linux Akhirnya Masuk ke Dalam Kernel Utama Linux. Itulah pada yang memahami bagaimana berkemban...