Hello
How can I input this data from the website to R studio
https://s3.amazonaws.com/udacity-hosted-downloads/ud651/pseudo_facebook.tsv
or is there any way that this data set can be downloaded directly to R studio?
One good way is to use the readr package. If you're new to R, you might want to take a look at the Data import chapter of R for Data Science.
library(readr)
df <- read_tsv("https://s3.amazonaws.com/udacity-hosted-downloads/ud651/pseudo_facebook.tsv")
df
#> # A tibble: 99,003 x 15
#> userid age dob_day dob_year dob_month gender tenure friend_count
#> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <dbl>
#> 1 2.09e6 14 19 1999 11 male 266 0
#> 2 1.19e6 14 2 1999 11 female 6 0
#> 3 2.08e6 14 16 1999 11 male 13 0
#> 4 1.20e6 14 25 1999 12 female 93 0
#> 5 1.73e6 14 4 1999 12 male 82 0
#> 6 1.52e6 14 1 1999 12 male 15 0
#> 7 1.14e6 13 14 2000 1 male 12 0
#> 8 1.68e6 13 4 2000 1 female 0 0
#> 9 1.37e6 13 1 2000 1 male 81 0
#> 10 1.71e6 13 2 2000 2 male 171 0
#> # ... with 98,993 more rows, and 7 more variables: friendships_initiated <dbl>,
#> # likes <dbl>, likes_received <dbl>, mobile_likes <dbl>,
#> # mobile_likes_received <dbl>, www_likes <dbl>, www_likes_received <dbl>
Created on 2020-06-10 by the reprex package (v0.3.0)
You can read the file into R directly from the URL without first downloading it. So if you are trying to make your code work, you could just run
pf <- read.csv('https://s3.amazonaws.com/udacity-hosted-downloads/ud651/pseudo_facebook.tsv', sep = '\t')
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.