Rmarkdownon Kaggle: Can you spot what's going on? - r

it's been a few days that im trying to run my Rmd on Kaggle, but it simply doesn't work.
The main reason (I guess) is that, somehow the console is reading the code as an R code, but im sure that I'm using Rmarkdown.
Therefore, the console reads a Text line as a code line, giving me the code error below:
Also, i tried to copy and edit other's people markdown, but i keep getting the same error line.
You can check my code here: https://www.kaggle.com/badluckmath/kernel4c85aae59c/edit/run/39891200
He's working perfectly on my Rstudio.
I'm looking for a huge help here, please!

I've been stuck with this for a week!
If i press the buttom to run code, it will simply give me this error message.
For that, i still don't know the solution. But since this is a premade Rmarkdown and i knew that it works, i simple used the Save (Commit) options and at the end, it worked.

Related

R console only shows text/comments

My R console seems to be stuck or something. It only shows the comments and doesn't execute the commands. I have had this more often. In the beginning R works fine and then at some point it stops working and only shows the comments. Is there a way to fix this?

What is causing my R script text to disappear?

I've encountered a very bizarre problem with my R scripts. I had a bunch saved in a folder, and after reinstalling R (which was itself having some issues), the rather large scripts I had can easily open in R, but appear to have no text on them (this is despite it clearly labeled as an R document in the folder and being 26kb). Yet when I upload my scripts in a message on Slack, it appears perfectly fine.
Here is what my R script looks like presently:
And this is what it should look like:
I'm thinking it has something to do with the way R is reading the text in the script, but I couldn't find any answers online that were helpful. I would greatly appreciate any advice, as I dont' want to have to recreate all of these using Slack of all things...
I figured it out with some tinkering and it was a rather simple fix that mirrored what I thought the issue was. Apparently my RStudio program was set to read the text in CP936 format. I set it to system default:
And viola! My text is now back!

Why can't read_csv use my directory/path?

I am having a problem with my read_csv. I have used this function with no problem but the path/directory I am using is a little different than normal and I can't figure it out by myself.
This is the code I have been using:
X2022_03_08_habit_and_OCD_clinical <- read_csv("Box/OCD: Habit or Learning?/experiment/data/raw/survey-data/2022-03-08_habit-and-OCD_clinical.csv")
I have tired tweaking this by not using the first two arguments with no luck. Has anyone used Box in a path before (Box is in my finder, like desktop would be). I also tried updating r for that first error code but maybe it didn't take, I am not sure how to update again.
Here is the error code I have been receiving:Error Message
I would appreciate any help and I apologize if there is a simple answer I have been missing!

Text line contains an invalid character

I am currently writing my bachelor thesis using Rmarkdown, and whenever i make changes I knit to PDF to check how it looks etc.
It worked perfectly until I wanted to check some small changes and after that I canĀ“t get it to knit, this is the error message I get:
output file: bbb.knit.md
! Text line contains an invalid character.
l.28 pdftitle={^^K
space{3.5in} Portfolio},
Error: Failed to compile bbb.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See bbb.log for more info.
Bare in mind that I am learning R while writing my thesis so I do have a very low level of knowledge. Does anyone have any suggestions for where the mistake might be? Line 28 has no text by the way.
I have read some suggestions about deleting the auxiliary file but I dont even know what that is or where to find it, or if it could cause me any problems deleting it.
Hope someone has some tips as wasting a lot of time on this is the last I need right now! Thanks
The solution was to change the title input in YAML from "\vspace{3.5in} Portfolio"
to only "Portfolio".

Compose.jl output issue

Ok recently I have been experimenting with Julia's compose.jl and have run into a somewhat confusing problem. I will run the standard code to initialize the package.
Pkg.add("Compose")
using Compose
compose(compose(context(), rectangle()), fill("tomato"))
And then run that code. Here is my problem: the code executes fine, it's the output that is strange. The typical output for this code would be a red rectangle. The output I get when this code is run is this:
Context(BoundingBox(Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,0.0),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,0.0),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),1.0,0.0),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,1.0)),UnitBox{Nothing,Nothing,Nothing,Nothing}(nothing,nothing,nothing,nothing,Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,0.0),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,0.0),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,0.0),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,0.0)),Rotation{Point{Measure{MeasureNil,MeasureNil},Measure{MeasureNil,MeasureNil}}}(0.0,Point{Measure{MeasureNil,MeasureNil},Measure{MeasureNil,MeasureNil}}(Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.5,0.0),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,0.5))),nothing,ListNode{ComposeNode}(Property{FillPrimitive}([FillPrimitive(AlphaColorValue{RGB{Float64},Float64}(RGB{Float64}(1.0,0.38823529411764707,0.2784313725490196),1.0))]),ListNode{ComposeNode}(Form{RectanglePrimitive{P<:Point{XM<:Measure{S,T},YM<:Measure{S,T}},M1<:Measure{S,T},M2<:Measure{S,T}}}(RectanglePrimitive[RectanglePrimitive{Point{Measure{MeasureNil,MeasureNil},Measure{MeasureNil,MeasureNil}},Measure{MeasureNil,MeasureNil},Measure{MeasureNil,MeasureNil}}(Point{Measure{MeasureNil,MeasureNil},Measure{MeasureNil,MeasureNil}}(Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,0.0),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,0.0)),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),1.0,0.0),Measure{MeasureNil,MeasureNil}(0.0,MeasureNil(),MeasureNil(),0.0,1.0))]),ListNull{ComposeNode}())),0,false,false,false,false,nothing,nothing,0.0)
a rather lengthy piece of text that doesn't show the shape... I am wondering if this is an error or if I am just doing something wrong. Does anyone know how to make this output what it should be?
One possibility to open an image through REPL would be through TerminalExtensions.jl. But generally I believe you have to write the image to a file and then open it. To save the file use this,
julia>draw(PNG("test.png", 10inch, 10inch), compose(compose(context(), rectangle()), fill("tomato")))

Resources