SlideShare a Scribd company logo
1 of 26
Download to read offline
Osaka.R #4

                                  @phosphor m



                           2010    12   2




@phosphor m
              Osaka.R #4
1


2


3


4


5




@phosphor m
              Osaka.R #4
twitter: @phosphor m
     Osaka.R




@phosphor m
               Osaka.R #4
R
     R
     R




@phosphor m
              Osaka.R #4
R          R
              R

                         R     OS




@phosphor m
                  Osaka.R #4
@phosphor m
              Osaka.R #4
“   ”




“C”                        “Users”           “masahiro“


@phosphor m
              Osaka.R #4
C:                      .csv

      “C”                        “     ”       “
        .csv”
                                 Windows           
              ¥   mac                      /
      Windows




@phosphor m
                  Osaka.R #4
R


    C:/           /                .csv

    C:                              .csv

                                                             2

          2                               “C:      .csv”




    @phosphor m
                           Osaka.R #4
01   11   34



              01




@phosphor m
                   Osaka.R #4
11



                                “   ”




@phosphor m
                   Osaka.R #4
csv
                 Windows        Shift JIS Mac         UTF-8

                      Shift JIS UTF-8    2
              UTF-8                             Shift JIS


                 Windows       TeraPad   Mac      CotEditor



@phosphor m
                  Osaka.R #4
d1 <- read.csv("C:           .csv")


R




@phosphor m
              Osaka.R #4
d1 <- read.csv("C:         .csv")




@phosphor m
              Osaka.R #4
d1 <- read.csv("C:/        /   .csv")




@phosphor m
              Osaka.R #4
d1 <- read.csv("C:/        /
                               .csv")




@phosphor m
              Osaka.R #4
setwd("C:/     ")
d1 <- read.csv("           .csv")




@phosphor m
              Osaka.R #4
Windows

     Shift




@phosphor m
              Osaka.R #4
csv


      d1 <- read.csv("C:/             /       .csv")
      d1 <- read.csv("C:/             /       .csv", header = FALSE)
      d1 <- read.csv("C:/             /       .csv", na.strings = "NA")

           csv                 1                      header=FALSE

                                header=TRUE

           na.strings         NA



      @phosphor m
                        Osaka.R #4
d1 <- read.delim("C:/           /   .txt")

                                     read.delim
              read.csv




@phosphor m
                   Osaka.R #4
d1 <- read.delim("C:/           /   .txt")

                                     read.delim
              read.csv




@phosphor m
                   Osaka.R #4
R
                        csv

     Excel
              csv
                              foreign




@phosphor m
                Osaka.R #4
library(foreign)

d1 <- read.spss("C:/     /        .sav",
                to.data.frame = TRUE, use.missings = TRUE)
# SPSS
# to.data.frame data.frame
# use.missings

d1 <- read.dta("C:/        /       .dta")
# stata

d1 <- read.xport("C:/          /    .stx")
# SAS

@phosphor m
              Osaka.R #4
csV

write.csv(d1, file = "C:/      /      .csv",
          na = "NA", row.names=FALSE)

                       data.frame
     na       NA
     row.names=FALSE




@phosphor m
               Osaka.R #4
library(foreign)
write.dta(d1, "C:/      /        .dta")
write.foreign(d1, datafile = "C:/       /          .csv",
                   codefile = "C:/      /          .sps",
                   package = "SPSS")

     stata         write.dta
     write.foreign      csv +
              datafile    csv      codefile
              package      ”SPSS” ”Stata” ”SAS”

                                       write.csv



@phosphor m
                   Osaka.R #4
Windows          Shift JIS   UTF-8
                          csv




@phosphor m
                  Osaka.R #4

More Related Content

What's hot (20)

1file handling
1file handling1file handling
1file handling
 
PHP file handling
PHP file handling PHP file handling
PHP file handling
 
Pentesting drivenbyfoca slides
Pentesting drivenbyfoca slidesPentesting drivenbyfoca slides
Pentesting drivenbyfoca slides
 
Test2
Test2Test2
Test2
 
STACK REALIZATION IN ARM
STACK REALIZATION IN ARMSTACK REALIZATION IN ARM
STACK REALIZATION IN ARM
 
File in C programming
File in C programmingFile in C programming
File in C programming
 
File handling in c
File handling in cFile handling in c
File handling in c
 
SPARQL Tutorial
SPARQL TutorialSPARQL Tutorial
SPARQL Tutorial
 
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDYC UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
 
File Management
File ManagementFile Management
File Management
 
File handling in c
File handling in cFile handling in c
File handling in c
 
File operations in c
File operations in cFile operations in c
File operations in c
 
File in C Programming
File in C ProgrammingFile in C Programming
File in C Programming
 
File in c
File in cFile in c
File in c
 
File handling in c
File  handling in cFile  handling in c
File handling in c
 
File handling-c programming language
File handling-c programming languageFile handling-c programming language
File handling-c programming language
 
Php files
Php filesPhp files
Php files
 
The "Remede" as Anthology
The "Remede" as AnthologyThe "Remede" as Anthology
The "Remede" as Anthology
 
Module 03 File Handling in C
Module 03 File Handling in CModule 03 File Handling in C
Module 03 File Handling in C
 
File oparation in c
File oparation in cFile oparation in c
File oparation in c
 

Similar to Importing and exporting CSV files in R

FunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - StreamsFunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - Streamsdarach
 
Annotations as Linked Data with Fedora4 and Triannon
Annotations as Linked Data with Fedora4 and TriannonAnnotations as Linked Data with Fedora4 and Triannon
Annotations as Linked Data with Fedora4 and TriannonRobert Sanderson
 
Semantic Pipes (London Perl Workshop 2009)
Semantic Pipes (London Perl Workshop 2009)Semantic Pipes (London Perl Workshop 2009)
Semantic Pipes (London Perl Workshop 2009)osfameron
 
Love Your Command Line
Love Your Command LineLove Your Command Line
Love Your Command LineLiz Henry
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS charsbar
 
file_handling_in_c.ppt
file_handling_in_c.pptfile_handling_in_c.ppt
file_handling_in_c.pptyuvrajkeshri
 
Fast track to getting started with DSE Max @ ING
Fast track to getting started with DSE Max @ INGFast track to getting started with DSE Max @ ING
Fast track to getting started with DSE Max @ INGDuyhai Doan
 
R Introduction
R IntroductionR Introduction
R Introductionschamber
 
Use a packet capture program to capture some packets on your home PC
Use a packet capture program to capture some packets on your home PCUse a packet capture program to capture some packets on your home PC
Use a packet capture program to capture some packets on your home PCsteviesellars
 
An Introduction to RDF and the Web of Data
An Introduction to RDF and the Web of DataAn Introduction to RDF and the Web of Data
An Introduction to RDF and the Web of DataOlaf Hartig
 
Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Robert Lemke
 
Rdf In A Nutshell V1
Rdf In A Nutshell V1Rdf In A Nutshell V1
Rdf In A Nutshell V1Fabien Gandon
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphsandyseaborne
 

Similar to Importing and exporting CSV files in R (17)

FunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - StreamsFunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - Streams
 
Annotations as Linked Data with Fedora4 and Triannon
Annotations as Linked Data with Fedora4 and TriannonAnnotations as Linked Data with Fedora4 and Triannon
Annotations as Linked Data with Fedora4 and Triannon
 
Semantic Pipes (London Perl Workshop 2009)
Semantic Pipes (London Perl Workshop 2009)Semantic Pipes (London Perl Workshop 2009)
Semantic Pipes (London Perl Workshop 2009)
 
Love Your Command Line
Love Your Command LineLove Your Command Line
Love Your Command Line
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS
 
file_handling_in_c.ppt
file_handling_in_c.pptfile_handling_in_c.ppt
file_handling_in_c.ppt
 
Fast track to getting started with DSE Max @ ING
Fast track to getting started with DSE Max @ INGFast track to getting started with DSE Max @ ING
Fast track to getting started with DSE Max @ ING
 
R Introduction
R IntroductionR Introduction
R Introduction
 
Use a packet capture program to capture some packets on your home PC
Use a packet capture program to capture some packets on your home PCUse a packet capture program to capture some packets on your home PC
Use a packet capture program to capture some packets on your home PC
 
An Introduction to RDF and the Web of Data
An Introduction to RDF and the Web of DataAn Introduction to RDF and the Web of Data
An Introduction to RDF and the Web of Data
 
JavaScriptとLisp
JavaScriptとLispJavaScriptとLisp
JavaScriptとLisp
 
PPS PPT 2.pptx
PPS PPT 2.pptxPPS PPT 2.pptx
PPS PPT 2.pptx
 
IO Streams, Files and Directories
IO Streams, Files and DirectoriesIO Streams, Files and Directories
IO Streams, Files and Directories
 
Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0
 
Rdf In A Nutshell V1
Rdf In A Nutshell V1Rdf In A Nutshell V1
Rdf In A Nutshell V1
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
 
R stata
R stataR stata
R stata
 

More from Masahiro Hayashi

オレオレR-GUIを作りたい
オレオレR-GUIを作りたいオレオレR-GUIを作りたい
オレオレR-GUIを作りたいMasahiro Hayashi
 
初心者講習会資料(Osaka.R#7)
初心者講習会資料(Osaka.R#7)初心者講習会資料(Osaka.R#7)
初心者講習会資料(Osaka.R#7)Masahiro Hayashi
 
Rzパッケージの紹介
Rzパッケージの紹介Rzパッケージの紹介
Rzパッケージの紹介Masahiro Hayashi
 
重回帰職人の朝は早い
重回帰職人の朝は早い重回帰職人の朝は早い
重回帰職人の朝は早いMasahiro Hayashi
 
初心者講習会資料(Osaka.r#6)
初心者講習会資料(Osaka.r#6)初心者講習会資料(Osaka.r#6)
初心者講習会資料(Osaka.r#6)Masahiro Hayashi
 
Rzパッケージ―spssのようなデータ管理インターフェイス
Rzパッケージ―spssのようなデータ管理インターフェイスRzパッケージ―spssのようなデータ管理インターフェイス
Rzパッケージ―spssのようなデータ管理インターフェイスMasahiro Hayashi
 
初心者講習会資料(Osaka.R#5)
初心者講習会資料(Osaka.R#5)初心者講習会資料(Osaka.R#5)
初心者講習会資料(Osaka.R#5)Masahiro Hayashi
 

More from Masahiro Hayashi (9)

オレオレR-GUIを作りたい
オレオレR-GUIを作りたいオレオレR-GUIを作りたい
オレオレR-GUIを作りたい
 
はじめての「R」
はじめての「R」はじめての「R」
はじめての「R」
 
初心者講習会資料(Osaka.R#7)
初心者講習会資料(Osaka.R#7)初心者講習会資料(Osaka.R#7)
初心者講習会資料(Osaka.R#7)
 
Rzパッケージの紹介
Rzパッケージの紹介Rzパッケージの紹介
Rzパッケージの紹介
 
重回帰職人の朝は早い
重回帰職人の朝は早い重回帰職人の朝は早い
重回帰職人の朝は早い
 
初心者講習会資料(Osaka.r#6)
初心者講習会資料(Osaka.r#6)初心者講習会資料(Osaka.r#6)
初心者講習会資料(Osaka.r#6)
 
Rzパッケージ―spssのようなデータ管理インターフェイス
Rzパッケージ―spssのようなデータ管理インターフェイスRzパッケージ―spssのようなデータ管理インターフェイス
Rzパッケージ―spssのようなデータ管理インターフェイス
 
初心者講習会資料(Osaka.R#5)
初心者講習会資料(Osaka.R#5)初心者講習会資料(Osaka.R#5)
初心者講習会資料(Osaka.R#5)
 
RGtk2入門
RGtk2入門RGtk2入門
RGtk2入門
 

Importing and exporting CSV files in R

  • 1. Osaka.R #4 @phosphor m 2010 12 2 @phosphor m Osaka.R #4
  • 3. twitter: @phosphor m Osaka.R @phosphor m Osaka.R #4
  • 4. R R R @phosphor m Osaka.R #4
  • 5. R R R R OS @phosphor m Osaka.R #4
  • 6. @phosphor m Osaka.R #4
  • 7. ” “C” “Users” “masahiro“ @phosphor m Osaka.R #4
  • 8. C: .csv “C” “ ” “ .csv” Windows ¥ mac / Windows @phosphor m Osaka.R #4
  • 9. R C:/ / .csv C: .csv 2 2 “C: .csv” @phosphor m Osaka.R #4
  • 10. 01 11 34 01 @phosphor m Osaka.R #4
  • 11. 11 “ ” @phosphor m Osaka.R #4
  • 12. csv Windows Shift JIS Mac UTF-8 Shift JIS UTF-8 2 UTF-8 Shift JIS Windows TeraPad Mac CotEditor @phosphor m Osaka.R #4
  • 13. d1 <- read.csv("C: .csv") R @phosphor m Osaka.R #4
  • 14. d1 <- read.csv("C: .csv") @phosphor m Osaka.R #4
  • 15. d1 <- read.csv("C:/ / .csv") @phosphor m Osaka.R #4
  • 16. d1 <- read.csv("C:/ / .csv") @phosphor m Osaka.R #4
  • 17. setwd("C:/ ") d1 <- read.csv(" .csv") @phosphor m Osaka.R #4
  • 18. Windows Shift @phosphor m Osaka.R #4
  • 19. csv d1 <- read.csv("C:/ / .csv") d1 <- read.csv("C:/ / .csv", header = FALSE) d1 <- read.csv("C:/ / .csv", na.strings = "NA") csv 1 header=FALSE header=TRUE na.strings NA @phosphor m Osaka.R #4
  • 20. d1 <- read.delim("C:/ / .txt") read.delim read.csv @phosphor m Osaka.R #4
  • 21. d1 <- read.delim("C:/ / .txt") read.delim read.csv @phosphor m Osaka.R #4
  • 22. R csv Excel csv foreign @phosphor m Osaka.R #4
  • 23. library(foreign) d1 <- read.spss("C:/ / .sav", to.data.frame = TRUE, use.missings = TRUE) # SPSS # to.data.frame data.frame # use.missings d1 <- read.dta("C:/ / .dta") # stata d1 <- read.xport("C:/ / .stx") # SAS @phosphor m Osaka.R #4
  • 24. csV write.csv(d1, file = "C:/ / .csv", na = "NA", row.names=FALSE) data.frame na NA row.names=FALSE @phosphor m Osaka.R #4
  • 25. library(foreign) write.dta(d1, "C:/ / .dta") write.foreign(d1, datafile = "C:/ / .csv", codefile = "C:/ / .sps", package = "SPSS") stata write.dta write.foreign csv + datafile csv codefile package ”SPSS” ”Stata” ”SAS” write.csv @phosphor m Osaka.R #4
  • 26. Windows Shift JIS UTF-8 csv @phosphor m Osaka.R #4