R language data structure--2 matrix and data frame ②-dataframe

Source: Internet
Author: User

June 11, 2018 Night, today and noon did not sleep, but still do not feel sleepy. Also do not feel headache, in fact, a lot of things are divided by people. You do not have to take a nap, nap is to give the morning to work back to the bedroom especially tired people, is depending on the situation, not everyone has to take a nap every day, many things developed a habit is a drag, contrary to timely and move is wise. For example, early morning sleep is a good habit, nap if the afternoon will feel headache, should reflect on the appropriate for their own, a lot of things are also so. It's not good to force yourself.

Say more, say back, today speak the data frame Dataframe Note is that it is not date. Very IMPORTANT!!! It's useless to cry in a typo.

Creation of 1dataframe:

In fact, are not created, are directly read. Like Read.table.

But it's better to know.

Attention! The data frame does not require you to be sure that each element type is the same, except that each column is the same.

And then the index is the same as the matrix.

Look for the first row, the first row and the second column, respectively.

Note here [] and [[]] are not the same. One is to return dataframe, and one directly returns a vector.

And for Dataframe, there is a $ method. Effect, etc. agree to both brackets: [[]]

Also note that for Rstudio, you can view the Dataframe directly in the right environment. Click to view Oh!

And you can make changes to a dataframe by using fix () and edit (), or return a new data frame without changing it.

Other tips:

A dataframe can be loaded into the search environment through attach and detach.

2 access and changes to dataframe through with and within.

With cannot change dataframe

Within can, usage

A=within (a,{
Fx=2:11
Abc=2:11
})

At the same time there are transform and subset not much to talk about.

Let's get here today!

R language data structure--2 matrix and data frame ②-dataframe

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.