read csv in r code example

Example 1: write csv in r

df <- data.frame(name = c("Jon", "Bill", "Maria"),
                 age = c(23, 41, 32))

write.csv(df,"C:\\Users\\Ron\\Desktop\\MyData.csv", row.names = FALSE)

Example 2: read csv in r

data <- read.csv("input.csv")
print(data)

Example 3: r write to csv

write.csv(Your DataFrame,"Path where you'd like to export the DataFrame\\File Name.csv", row.names = FALSE)

Example 4: how to import csv file in r

read.csv("yourdata.csv", sep = ';')

Example 5: read csv in r

library(readr) 
data <- read_csv("input.csv")

Example 6: r studio parse csv

# Import the data and look at the first six rows
carSpeeds <- read.csv(file = 'data/car-speeds.csv')
head(carSpeeds)

Tags:

Misc Example