R language Introductory video note--4--r data entry

Source: Internet
Author: User

The data input of R can be roughly three kinds:

1. Keyboard output

2. Import from a text file

3. Import data from Excel

One, from the keyboard input

First create a data frame, play, blind build a

MyData <-Data.frame (age =numeric (0), gender= character (0), weight=numeric (0)) #建一个空数据框, but the element type has been declared

MyData <-Edit (MyData) #可以进行编辑

Fix (MyData) #跟上面一样可以进行编辑, • is easier than edit

Ii. entering data from a text file

Data <-read.table ("path", header= true,sep= ",") #注意文件需要是ANSI编码的, it is necessary to note whether the contents of the file are separated by a space.

Iii. entering data from Excel

Data1 <-read.csv ("path, need to be aware of backslashes and slashes", header=ture,sep= ",") #文件用csv格式的 pretty good

R language Introductory video note--4--r data entry

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.