Compilation error, I don't know what happens, the code looks perfect.

I don't understand what is happening, can you help me?

###########################
> ### LIBRARIES #############
> 
> 
> library(dplyr)
> library(tidyr)
> library(rvest)
> library(quantmod)
> 
> 
> 
> 
> ##########################
> ##   kaggle DataSet    ##
> ##########################
> 
> ## Read CSV ##
> df1 <- read.csv("netflix_titles.csv"), header=T, sep = ',', encoding = "UTF-8")
Error: unexpected ',' in "df1 <- read.csv("netflix_titles.csv"),"
> 
> 
> ## Fix Duration and Cast columms ##
> ds_netflix_titles <-df1 %%
+   separate(duration,  into =c("duration_num", "duration_type"), sep = " ")
Error: object 'df1' not found

That parentheses shouldn't be there

df1 <- read.csv("netflix_titles.csv", header=T, sep = ',', encoding = "UTF-8")

BTW, R is an interpreted language so there is no compilation, it is just an execution error.

He interpreted but still giving error for not being able to make connection

###########################

LIBRARIES

library(dplyr)
library(tidyr)
library(rvest)
library(quantmod)

##########################

kaggle DataSet

##########################

Read CSV

df1 <- read.csv("netflix_titles.csv", header=T, sep = ',', encoding = "UTF-8")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'netflix_titles.csv': No such file or directory

Fix Duration and Cast columms

ds_netflix_titles <-df1 %%

  • separate(duration, into =c("duration_num", "duration_type"), sep = " ")
    Error: object 'df1' not found

You are not correctly specifying the file path, or the file is not located where you think it is.

I made the specification of the location to generate the eviromment but see what happened another error message, I think we are almost solving it!

> 
> ##########################
> ##   kaggle DataSet    ##
> ##########################
> 
> ## Read CSV ##
> df1 <- read.csv(C:\Users\Marcio\Documents\NETFLIX\bases\"netflix_titles.csv", header=T, sep = ',', encoding = "UTF-8")
Error: unexpected symbol in "df1 <- read.csv(C:\Users"
> 
> 
> ## Fix Duration and Cast columms ##
> ds_netflix_titles <-df1 %%
+   separate(duration,  into =c("duration_num", "duration_type"), sep = " ")
Error: object 'df1' not found
>

A path is a string. You have written it naked without quotemarks and you have it just touching the quoted file name. The path and the filename need to be together within a single set of quote marks, or else use file.path() function to tie different path elements together.

Did not work !

Read CSV

df1 <- file.path(C:\Users\Marcio\Documents\NETFLIX\bases"netflix_titles.csv", header=T, sep = ',', encoding = "UTF-8")
Error: unexpected symbol in "df1 <- file.path(C:\Users"

(mypath <- file.path(r"(C:\Users\Marcio\Documents\NETFLIX\bases)","netflix_titles.csv"))

df1 <- read.csv(mypath)

I did exactly what you suggested and it's still giving me an error.
##########################

kaggle DataSet

##########################

Read CSV

(mypath <- file.path(r"C:\Users\Marcio\Documents\NETFLIX\bases"netflix_titles.csv", header=T, sep = ',', encoding = "UTF-8"))
Error: malformed raw string literal at line 1
df1 <-read.csv(mypath)
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
object 'mypath' not found

Fix Duration and Cast columms

ds_netflix_titles <-df1 %%

  • separate(duration, into =c("duration_num", "duration_type"), sep = " ")
    Error: object 'df1' not found

Your code is quite different.

(mypath <- file.path(r"C:\Users\Marcio\Documents\NETFLIX\bases"netflix_titles.csv", header=T, sep = ',', encoding = "UTF-8"))
(mypath <- file.path(r"(C:\Users\Marcio\Documents\NETFLIX\bases)","netflix_titles.csv"))

remove all the readcsv style params at the end of file.path call which arent relevant or helpful.
Also the r string literal from C:\ the format is r"(somestring)" but you removed the brackets, also you dont seperate bases from netflix, whereas there is a clear break in mine.

Good luck !

Now the error is just a connection, I don't know what happens, can you tell?

(mypath <-file.path(r"(C:\Users\Marcio\Documents\NETFLIX\bases)","netflix_titles.csv", header =T,sep = ',', endcoding= "UTF-8" ))
[1] "C:\Users\Marcio\Documents\NETFLIX\bases/netflix_titles.csv/TRUE/,/UTF-8"

df1 <-read.csv(mypath)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'C:\Users\Marcio\Documents\NETFLIX\bases/netflix_titles.csv/TRUE/,/UTF-8': No such file or directory

Header etc, shouldnt be in the file.path, because it doesnt indicate the path. Remove it. Only have a path there.

Even using the parameters that you observed did not work, unless you test this code in RStudio and make the changes and expose me here to try to copy and implement in my environment.

Does this work?

library(dplyr)
library(tidyr)

## Read CSV ##
df1 <- read.csv("C:\Users\Marcio\Documents\NETFLIX\bases\netflix_titles.csv", header=T, sep = ',', encoding = "UTF-8")

## Fix Duration and Cast columms ##
ds_netflix_titles <- df1 %>%
    separate(duration,  into =c("duration_num", "duration_type"), sep = " ")

If you still can't make this work, I think you should take a basic R skills course first so you can get more comfortable with the basics of the language.

To be honest, I'm not a developer, I'm a Product Manager, but I need to understand analytics to better observe the effects of purchase and sales of consumer events. There's a video where this application runs easily but I don't know why in my environment it crashes.

Now it interprets but I don't see the Global Enviromment I don't see the connection.

##########################

kaggle DataSet

##########################

Read CSV

(mypath <-file.path(r"(C:\Users\Marcio\Documents\NETFLIX\bases/netflix_titles.csv))
df1 <-read.csv(mypath)

Fix Duration and Cast columms

ds_netflix_titles <-df1 %%
separate(duration, into =c("duration_num", "duration_type"), sep = " ")

Sorry but I don't understand what you mean with this, can you elaborate on what your problem is? Ideally, try to provide a proper REPRoducible EXample (reprex) illustrating your issue.

If the last thing in your console is a plus symbol + that signals that R is waiting for your code to be completed (i.e further typed in) before running. Why would it wait for more ? Because somewhere in the code you wrote a symbol that tells R you are starting to write something out, and for it to wait until you send a closing symbol that you stopped.

When i look closely at your screenshot your qoute marks in the path definition are unbalanced.

The first quote mark tells r that what follows is your desired string contents and if you dont follow up with a closing quote mark, then all the subsequent code is nothing but more content for your string.

Do not start commands on the console with a + sign, you have to remove all of those.

As I said, you should take a quick intro to R to avoid this kind of issues, otherwise your learning experience is going to be extremely frustrating, you are making a lot of very basic R syntax errors that would be easily avoidable if you take a little time to learn the very basics.