R language reads the contents of the CSV

Source: Internet
Author: User

1992, the R language was born. The R language is the product of the PC and Linux era, and R is similar to the S language developed by Bell Labs, and R supports a range of analytical techniques, including statistical analysis, predictive modeling, and data visualization. Numerous expansion packages can be found on the Cran.

The preferred interface for R Software is the command line interface, which invokes the corresponding function function by writing a script. It also supports a graphical interface.

The R language can be used to do data mining, and we'll use it to read the contents of the birth2.csv.

Birth2.csv

ALGERIA, 36.4,14.6congo, 37.3,8egypt, 42.1,15.3ghana, 55.8,25.6ivory COAST, 56.1,33.1malag         ASY, 41.8,15.8morocco, 46.1,18.7tunisia, 41.7,10.1cambodia, 41.4,19.7ceylon, 35.8,8.5china , 34,11taiwan, 36.3,6.1hong KONG, 32.1,5.5india, 20.9,8.8indonesia, 27.7,10.2iraq, 20 .5,3.9france, 25,6.2japan, 17.3,7jordan, 46.3,6.4korea, 14.8,5.7malaysia, 33.5,6.4mongo        LIA, 39.2,11.2philllipines, 28.4,7.1syria, 26.2,4.3thailand, 34.8,7.9vietnam, 23.4,5.1canada , 24.8,7.8costa RICA, 49.9,8.5dominican R, 33,8.4guatemala, 47.7,17.3honduras, 46.6,9.7mexico, 45.1 , 10.5NICARAGUA, 42.9,7.1panama, 40.1,8united states, 21.7,9.6argentina, 21.8,8.1bolivia, 17.4,5.8braz       IL, 45,13.5chile, 33.6,11.8colombia, 44,11.7ecuador, 44.2,13.5peru, 27.7,8.2uruguay   , 22.5,7.8venezuela  , 42.8,6.7austria, 18.8,12.8belgium, 17.1,12.7britain, 18.2,12.2bulgaria, 16.4,8.2czechoslovakia, 16.9,9.5denmark, 17.6,19.8finland, 18.1,9.2france, 18.2,11.7e. Germany, 17.5,13.7w. Germany, 18.5,11.4greece, 17.4,7.8hungary, 13.1,9.9ireland, 22.3,11.9italy, 19,10.2netherla NDS, 20.9,8norway, 17.5,10poland, 19,7.5portugal, 23.5,10.8romania, 15.7,8.3spain, 21.5      , 9.1SWEDEN, 14.8,10.1switzerland, 18.9,9.6U.S.S.R. , 21.2,7.2yugoslavia, 21.4,8.9australia, 21.6,8.7new ZEALAND, 25.5,8.8

Load the appropriate packages with the built-in functions for R, loaded with the syntax: library (X); X indicates that the package

Lib2. R

Library (MASS) library (lpsolve) library (sampling) library (RODBC) library (Survival) Library (splines) Library (timedate) library (timeSeries) library (Norm) library (fbasics) library (rattle) library (ellipse Library (lattice) library (nnet) library (MICE) library (arules) library (colorspace) library (TSP) library (gclus) library (Scatterplot3d) library (GRID) library (VCD) library (seriation) library (cluster) library (mvtnorm) library (STATS4) Library (Modeltools) library (Multcomp) library (mclust) library (Flexmix) library (FPC)

In the Command Line window of the R software, enter the statement
SETWD ("D://r_work//data") #设置工作区间data4 = read.table ("Birth2.csv", Header=f, sep= ",")  #读取csv文件data4    # Content in the output vector data4

The effect is as follows:


Figure (1) reading the contents of a. csv file in R language



R language reads the contents of the CSV

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.