Data Reshaping Using R

A PHP Error was encountered

Severity: Warning

Message: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Filename: blog/post_details.php

Line Number: 38

Backtrace:

File: /home/solutio1/public_html/application/views/blog/post_details.php
Line: 38
Function: strtotime

File: /home/solutio1/public_html/application/controllers/Blog.php
Line: 14
Function: view

File: /home/solutio1/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Filename: blog/post_details.php

Line Number: 38

Backtrace:

File: /home/solutio1/public_html/application/views/blog/post_details.php
Line: 38
Function: date

File: /home/solutio1/public_html/application/controllers/Blog.php
Line: 14
Function: view

File: /home/solutio1/public_html/index.php
Line: 315
Function: require_once

2019-09-25
Manoj Pawar

 In R Data Reshaping is about to organized data into row and columns. Data reshaping is               widely used because it takes less time to extract data  from rows and column.Their are many       functions available in r. i.e split ,merge, melting and casting.

  • Join rows and columns in data frame.

Cbind() function is used to join multiple vectors to create data frame. Using rbind() function        we can merge two or more data frame.

     For Example:

     We can create two vector as city and state. we can combine two vector into one data frame.          i.e(address)

  > city<-c("mumbai","pune","delhi","hyderabad")
  > state<-c("maharashtra","maharashtra","haryana","telangana")
  > address<-cbind(city,state)
  > print(address)

     it will shows following result,

     city        state        
[1,] "mumbai"    "maharashtra"
[2,] "pune"      "maharashtra"
[3,] "delhi"     "haryana"    
[4,] "hyderabad" "telangana"  

     Again ,we can create one new dataframe with the same columns.

 
>new.address<data.frame(city=c("nanded","latur","noida"),state=c("maharashtra","maharashtra","uttar pradesh"))
> print(new.address)

   It will produce following outut:

    city         state
1 nanded   maharashtra
2  latur   maharashtra
3  noida uttar pradesh

     Combine rows from both the data frame using rbind().

  > all.address<-rbind(address,new.address)
  > print(all.address)

    When we execute the code it will generate following result .

       city         state
1    mumbai   maharashtra
2      pune   maharashtra
3     delhi       haryana
4 hyderabad     telangana
5    nanded   maharashtra
6     latur   maharashtra
7     noida uttar pradesh

 

 


About author

Card image cap
Manoj Pawar

I am data analyst and show you how visualization done using R language.!

-Data Analyst

0 Comments