<div dir="ltr">Good morning Amy,<div><br></div><div>Jonathon was spot on about using str() to help check your data before you start running any analysis.</div><div><br></div><div>To your question and a solution, I noticed you shared X and Y in a csv file but the R mean command you gave expressed X and Y as separate objects and not part of the same dataframe.  My code response here places X and Y in the same dataframe since that is the default when importing a csv file.  I call this dataframe d. My code also assumes you are in the same working directory as your csv file.  Using str() I found that d$Y imported fine but d$X did not exist. Instead variable X imported as ï..X or d$ï..X . I'm not sure why this happened since the first row X and Y look fine when opened in a basic text editor.  Not sure if it a row labels issue as Jonathon mentioned since read.csv() has the header=TRUE option by default.  However, in my code below I changed ï..X to X and things worked well from there.</div><div><br></div><div>d <- read.csv("CommuteandStressModified.csv")<br>str(d)<br></div><div>mean(Y) # does not work because Y is part of d<br>mean(d$Y) # = 4.55<br>mean(X)  # not found because it column name is ï..X</div><div># fix column X label<br>colnames(d)[1] <- "X"<br>mean(d$X)   # = 39.85<br></div><div><br></div><div>Good luck!</div><div><br></div><div>Best,</div><div>Shawn<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="1"><div><span style="font-family:arial,sans-serif"><font size="1"><b><span><span style="color:rgb(0,0,0);font-family:Futura;font-size:x-small">________________________</span></span></b></font></span></div><div><span style="font-family:arial,sans-serif"><font size="1"><b>Shawn Janzen</b> ●</font></span><span style="font-family:arial,sans-serif"> Instructor & PhD candidate</span><span><font size="1"><font size="1"> </font></font></span><span style="font-family:arial,sans-serif"><font size="1"><font size="1"> </font></font></span><span style="font-family:arial,sans-serif"><font size="1"><font size="1"><font size="1"><font size="1">&</font></font></font> CASCI Fellow & STC Coordinator</font></span><font size="1"><span style="font-family:arial,sans-serif"><font size="1">●</font></span></font><span style="font-family:arial,sans-serif"> (he/him/his)</span></div></font><font size="1"><div><span style="font-family:arial,sans-serif">University of Maryland<span><font size="1"><font size="1"> </font></font></span></span><span style="font-family:arial,sans-serif"><span><font size="1"><font size="1"><span><font size="1"><span style="font-family:arial,sans-serif"><font size="1">●</font></span></font></span></font> </font></span>College of Information Studies (iSchool)</span><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">4161 Fieldhouse Drive (Patuxent Building)<span><font size="1"><font size="1"> </font></font></span></span><span style="font-family:arial,sans-serif"><span><font size="1"><span><font size="1"><span style="font-family:arial,sans-serif"><font size="1">●</font></span></font></span> </font></span>Room 1109-K<span><font size="1"><font size="1"> </font></font></span></span><span style="font-family:arial,sans-serif"><span><font size="1"><font size="1"><span><font size="1"><span style="font-family:arial,sans-serif"><font size="1">●</font></span></font></span></font> College Park, MD 20742</font></span></span></div><div><font size="1"><p class="MsoNormal"><span style="font-family:arial,sans-serif"><a href="http://www.ischool.umd.edu" target="_blank">www.ischool.umd.edu</a> <span></span></span><span style="font-family:arial,sans-serif"><span><font size="1"><span><font size="1"><span style="font-family:arial,sans-serif"><font size="1">●</font></span></font></span> </font></span><font size="1"><a href="mailto:sjanzen@umd.edu" target="_blank">sjanzen@umd.edu</a> </font></span><span style="font-family:arial,sans-serif"><font size="1"><font size="1"> </font></font></span><span style="font-family:arial,sans-serif"><font size="1"><font size="1"><font size="1"><font size="1">●</font></font></font> </font></span><a href="http://casci.umd.edu" style="font-family:arial,sans-serif" target="_blank">casci.umd.edu</a><span style="font-family:arial,sans-serif"><font size="1"> </font></span><span style="font-family:arial,sans-serif"><font size="1"><font size="1"> </font></font></span><span style="font-family:arial,sans-serif"><font size="1"><font size="1"><font size="1"><font size="1">●</font></font></font> <a href="http://go.umd.edu/stc" target="_blank">go.umd.edu/stc</a></font></span></p></font><span style="font-family:arial,sans-serif"><span></span></span></div></font></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 7, 2021 at 3:17 PM Godfrey, Jonathan via BlindRUG <<a href="mailto:blindrug@nfbnet.org">blindrug@nfbnet.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Amy,<br>
<br>
This is the sort of question that is much better sorted out in person rather than waiting for the email world to wake up.<br>
<br>
I suspect the problem is the way the data is imported. Get into the habit of checking what the variable names are and what data type they come in as using str()<br>
In this situation, my first guess is that the first column of the original file is being used as the row labels for the data instead of being one of the two variables of a dataset that should have no data labels.<br>
<br>
HTH<br>
Jonathan<br>
<br>
<br>
<br>
-----Original Message-----<br>
From: BlindRUG <<a href="mailto:blindrug-bounces@nfbnet.org" target="_blank">blindrug-bounces@nfbnet.org</a>> On Behalf Of Amy Albin via BlindRUG<br>
Sent: Friday, 8 January 2021 8:41 AM<br>
To: <a href="mailto:blindrug@nfbnet.org" target="_blank">blindrug@nfbnet.org</a><br>
Cc: Amy Albin <<a href="mailto:amyralbin@gmail.com" target="_blank">amyralbin@gmail.com</a>><br>
Subject: [BlindRUG] What's wrong with this data set? Why is R recognizing the Y variable but not the X variable?<br>
<br>
Hello,<br>
<br>
I have 2 variables labeled "X and "Y". R is allowing me to do things like mean(Y) it says 4.55. But when I type<br>
mean(X)<br>
It says: error in mean(X): object X not found<br>
<br>
What's going on? Thank you.<br>
_______________________________________________<br>
BlindRUG mailing list<br>
<a href="mailto:BlindRUG@nfbnet.org" target="_blank">BlindRUG@nfbnet.org</a><br>
<a href="http://nfbnet.org/mailman/listinfo/blindrug_nfbnet.org" rel="noreferrer" target="_blank">http://nfbnet.org/mailman/listinfo/blindrug_nfbnet.org</a><br>
To unsubscribe, change your list options or get your account info for BlindRUG:<br>
<a href="http://nfbnet.org/mailman/options/blindrug_nfbnet.org/sjanzen%40umd.edu" rel="noreferrer" target="_blank">http://nfbnet.org/mailman/options/blindrug_nfbnet.org/sjanzen%40umd.edu</a><br>
The list archive can be viewed at:<br>
<a href="http://www.nfbnet.org/pipermail/blindrug_nfbnet.org" rel="noreferrer" target="_blank">http://www.nfbnet.org/pipermail/blindrug_nfbnet.org</a><br>
More information and useful links about using R as a blind person can be obtained at:<br>
<a href="http://R-Resources.massey.ac.nz" rel="noreferrer" target="_blank">http://R-Resources.massey.ac.nz</a><br>
<br>
Look for help using R commands by reading the accessible e-book "Let's Use R Now" compiled by Jonathan Godfrey at:<br>
<a href="http://R-Resources.massey.ac.nz/lurn/front.html" rel="noreferrer" target="_blank">http://R-Resources.massey.ac.nz/lurn/front.html</a><br>
</blockquote></div>