0

I have two csv files. Shown in pictures.

Files are shown in the following link.

https://drive.google.com/drive/folders/1bDr9-gywQuVCcfp18JIwoybecTY-VYvP?usp=sharing

Following code are the current code I did. Now I have to merge table by PdId column.

I need to have the overview of the San Francisco crime data.

Thanks

library(data.table)

fread("~/datasets/crime_location.csv")

fread("~/datasets/crime_detail.csv")

df1 <-("~/datasets/crime_location.csv")

df2 <-("~/datasets/crime_detail.csv")

楊東翰
  • 9
  • 1
  • 5

2 Answers2

0

You fread something into a variable. This is probably it.

library(data.table)
loc=fread("~/datasets/crime_location.csv")
det=fread("~/datasets/crime_detail.csv")
df3=merge(loc, det, by = 'PdId')
kana
  • 515
  • 5
  • 12
0

You can try this one.

library(dplyr)
df1 <- as.data.frame(df1)
df2 <- as.data.frame(df2)

df1$PdId <- as.character(df1$PdId)
df2$PdId <- as.character(df2$PdId)
df3 <- full_join(df1, df2, by = "PdId")
Kian
  • 100
  • 7