google capstone data file import from mac desktop issue - r

I am very new to programming and am working on the Google Data Analytics Certificate. I have looked everywhere for assistance to my issue and nothing has worked. (I have watched videos, searched stack overflow, queried kaggle, etc.)
I am working on the bellabeat capstone project and have been able to download the data files to my mac desktop.
My issue is that I am unable to import these data files into r, which I am running locally on my machine.
Based on the breadcrumb trail of where my files are located, I have been trying to run this code:
dailyActivity_merged <- read.csv(~"⁨Macintosh HD⁩/Users/.../googlecapstone_bellabeat_data/Fitabase_Data_20160412to20160512/dailyActivity_merged.csv")
I have received this error:
Error: bidi formatting not allowed (line 1), use escapes instead (\u2068)
Based on the "escapes" reference in the error statement, I have tried to change "/" to this "" and that hasn't worked.
Could someone please point me in the direction for a solution? If there are tutors available somewhere, I would be interested in hearing about that as well.
Thanks in advance for your attention.
RB

Not sure if you need to explicitly define the file location for your project, but I usually don't. I use the following code to import files
dailyActivity_merged = read.csv(file.choose(),header = TRUE)
do not include anything in the parenthesis. You want to copy this line of code exactly.

Related

Trying to import data into R in a way that will allow anyone to access it when opening the markdown file/ accessing the html knit

I am currently working on a coding project and I am running into trouble with how i Should import the data set. We are supposed to have it read in a way so that our instructor can access our markdown file and be able to import the data and run the code without changing file paths. I know about using relative file paths to make it accessible to anyone, however I don't know how to get around the /users/owner part of the file path. Any help would be greatly appreciated and if you have any further questions feel free to ask.
I've tried changing the working directory to a certain folder that both I and my instructor have named the same thing, however, like I said above, when I use read.csv to import the data frame I am still forced to use the /users/owner filepath which obviously is specific to my computer.
I can understand your supervisor, I request the same from my students. My recommended solution is to put both data and R script (or the .Rmd file) in the same folder. Then one does not need to add a path in the read.csv (or similar) function.
If you use RStudio, move to the folder in the Files pane and then use the gear icon and select "Set as Working Directory".
Then send both files (.R or .Rmd) and the data to the supervisor, ideally as a zip file. The supervisor can then unpack it to an arbitrary folder and just double click to the .R/.Rmd file. The containing folder will then automatically become the working directory.
Other options are:
to use a subfolder for the data or
to put the data to a publicly readable internet location, e.g.
Github and read it directly from there.
The last option requires of course that the data have a free license.

Import old, odd format, text files into R

I'm on a wild goose chase and I hope someone here can help me. Someone at my institution had an old database program on mac that I believe was called "Panorama". They exported a file from that as .txt quite a few years ago and recently tried to import it into the latest "PanoramaX" program I guess (I'm getting some of this secondhand) and weren't able to do it. Also, I'm a pc guy and would be totally lost on mac. So being the data nerd they turned to me to see if I could salvage their data. I tend to use R to import other file sources and every option I've tried here didn't work: (though I'm sure I missed an option maybe)
I can't share the file because it has personally identifying info, but a screenshot of what it looks like in notepad may help:
Does anyone have any experience with these files? Or can tell what the delimiters are etc... so I could open it?

Is it possible for a server to provide the same file to 2 people, on who understands only UTF-8 and the other, only ISO8559?

INTRO:
I'm in a situation because when uploading an inventory upload feed to Amazon, in 2021, they still don't understand UTF-8 encoding.
Here we have a file, in a wordpress installation, as the image for a visual product.
Example url : https://wordpresssite.com/uploads/Café-à-la-crème.jpg
Wordpress displays it fine.
Amazon reads a bunch of gibberish and can't find the file and gives an error.
Can we leave the file name on the source server as is and yet do something in cPanel or in
the excel file that lists this URL in a way that Amazon can also read it?
Is this ultimately as simple as telling Excel to encode that column differently before uploading?
Thank you in advance!
UPDATE : What I am trying now, is to export the Excel to CSV and then run it through line by line using PHP with a combination of tricks hoping to do a passable job of it. From what I see, there are many ways that "sorta" work, but nothing is sure.
UPDATE 2 : I realize that this doesn't solve my problem, because if Amazon changes the file name, changing an "é" to an "e", then it won't find the image either, so I'll have to go through all the images and find the ones with accents that I'm using.
QUESTION ABOUT PROCEDURE : I haven't been able to quite understand the way things work. I thought originally that this is about trying to get help when stuck. I have explained the problem and code isn't necessary. If I'm wrong, please tell me how it changes THIS situation? I'm using Excel, WordPress and I have to lose the UTF-8 accented characters that seem to cause Amazon's systems such grief (no judgement to Amazon, except that this resistance to UTF-8 is giving me brain shudders at the moment).
MORE INFO: If this helps, I'm writing in English but certain art products have a lot of French and some German in their names. I thought my example sufficient to illustrate what I was up against.
My problem is not how to convert the code but how to put the steps together to do what I need. It's because this whole process is not a simple iconv vs utf_decode() in php that it's extra stressful. Once I get the big picture sorted, the smaller steps are written about in many places where I could find more specifc details if I needed.
I'm not snarking here, but it seems that this kind of comment is just kicking someone when they are down. You are not the first to make such a suggestion over the years but again, I am curious how I could have explained any more than I have already — in a way that pertains to my actual problem.
Thanks for your response.
That URI is not properly encoded as per RFC 3986 (see also Wikipedia: percent/URL encoding). You cannot expect a server to blindly assume a requested URI to be UTF-8 encoded, but you can expect every server to support percent encoding:
https://wordpresssite.com/uploads/Caf%C3%A9-%C3%A0-la-cr%C3%A8me.jpg
In PHP this can be achieved thru rawurlencode(); in JavaScript it would be encodeURI().
Not sure what you want with Excel and CSV, but from what I understood it is unrelated to your actual problem.

Python: File pointers

I am developing some tool by make use of python 3.4.2 shell. But i stopped while dealing with file pointers in python. Basically what i am doing is merging the file with another file. I came across scenario, wherein i will search for a string in the file, the other file content i need to merge should start from that string. So please could anyone suggest me on this??
How to move reversely in a file using python file commands?
i tried using seek() and tell() but didn't workout.
can i use seek(-5,1) to go back 5 bytes back and write from that position?All answers are appreciated. Thanks

How to open non .rda files in R

I am trying to do some work for my thesis which has me using the R programming language (and the R app on Mac OS Lion) for the first time. I had to download the files from here to work with but none of the files comes in .rda or .r they all come in different file extensions. Can someone please tell me how to either convert or use these files?
This page might be relevant to your interests. Also note that if you click on the link on that page that says "Analyze with GEO2R" you can get an R script created for you that will do some of the legwork for you. I would highly suggest reading the instructions on that page in order to get things prepared the way you want them to be.

Resources