Creating a script on Kaggle

Hello there RCommunity,

I am trying to create a markdown of my analysis process on Kaggle but am running into issues. I am trying to follow similar steps to Google Data Analytics: Capstone Project(Cyclistic) | Kaggle because I like the way it's laid out. But when I try to run codes on Kaggle I receive error messages and I'm just curious how. And I don't know how to bring up my results for things like str() but no reveal other results like loading libraries in. Here's the error code I received:

If you cannot read the picture, it says: File "/tmp/ipykernel_18/2421080172.py", line 2
"```{r}"
^ SyntaxError: invalid syntax

Thank you to anyone assisting me. I have my version currently private right now, but I can make it public if that would help establish the issue.

1 Like

Hi, you need modify the language.

Go to file

Select R language. The session restart and you could run the code.

Because the default is Python.

Hi @M_AcostaCH,

Thanks so much for your help! I do have an additional question. What code could I use to hide some results but show others? Like show the str() data in my markdown but not loading the packages? And why don't you have to use "r" "" when creating code?

Thanks for any assistance!

Im could recomend you work with Rstudio.

In this IDE you can run only specific line or part of code. Im dont know in this window of Kaggle.
But for example if you put # before a portion of code is not executed. You could disable some lines, but when there are many lines it would be a lot of work. Because this I recomend you use Rstudio.

library(tidyverse)
x<- 5
# this run the library and x object.

but if you put # before library

# library(tidyverse)
x<- 5
# this run the  x object.
1 Like

If I understand you correctly you just need to right click on the cell and choose "Hide Output Cell in Viewer"


Kaggle uses jupyter notebooks so to learn how to do anything on it you can simply google "How to do X in jupyter notebooks".

Because you are in a Jupyter Notebook not a markdown notebook, they do not use the same syntax

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.