Re: [R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in read.table()?

2021-02-15 Thread Parkhurst, David F.
I’ve got it working now given help from several people.  Yes, I’ve used windows 
since it first came out, and DOS before that.  I switched to a Mac maybe 18 
months ago when MS said they wouldn’t support windows 7 any more, and I didn’t 
like my wife’s windows 10.  I’m still learning (and have just taken up R after 
not using it for years.). The Apple support people have taught me a lot!

From: Peter West 
Date: Monday, February 15, 2021 at 8:30 AM
To: Parkhurst, David F. 
Cc: r-sig-mac@r-project.org 
Subject: Re: [R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in 
read.table()?
David,

I thought I saw advice on this issue already that noted you could not use 
backslashes in file paths on a Mac. Have you tried with 
“/Users/DFP/Desktop/Monroe319Ecoli.txt”?  Do you come from a Windows background?

Peter
—
mailto:p...@ehealth.id.au
“Why does this generation seek a sign? Truly, I say to you, no sign will be 
given to this generation.”


On 30 Jan 2021, at 6:25 am, Parkhurst, David F. <mailto:parkh...@indiana.edu> 
wrote:

I�ve tried for over an hour to figure this out with no luck.  I�ve moved the 
text file (created from excel) to the desktop to simplify the path.  If I click 
on the file and ask Get Info, it lists �Where� as  iCloud Drive > Desktop.  If 
I copy that to the clipboard and paste that into a read.table command in the R 
interface, it comes up as /Users/DFP/Desktop.  But if I try 
read.table("\\Users\\DFP\\Desktop\\Monroe319Ecoli.txt"), I get No such file or 
directory.  How can I get that file into a data frame?

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in read.table()?

2021-02-15 Thread Parkhurst, David F.
Wow.  That looks useful, especially when I don�t want to put the file to be 
read on the desktop.  Thanks.

From: Ben Tupper 
Date: Monday, February 15, 2021 at 8:52 AM
To: Parkhurst, David F. 
Cc: r-sig-mac@r-project.org 
Subject: Re: [R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in 
read.table()?
Hi,

https://stat.ethz.ch/R-manual/R-devel/library/base/html/file.path.html

See the note at the bottom.  It's liberating in many ways that R handles the 
underlying details for you - use the forward slash and you'll be good to go 
without regard to the platform.

I think using file.path() is the best way to go. Just do something like the 
following...

filename <- file.path("Users", "DFP",  "Desktop",  "Monroe319Ecoli.txt")
x <- read.table(filename)

Cheers,
Ben


On Mon, Feb 15, 2021 at 8:14 AM Parkhurst, David F. 
mailto:parkh...@indiana.edu>> wrote:
I�ve tried for over an hour to figure this out with no luck.  I�ve moved the 
text file (created from excel) to the desktop to simplify the path.  If I click 
on the file and ask Get Info, it lists �Where� as  iCloud Drive > Desktop.  If 
I copy that to the clipboard and paste that into a read.table command in the R 
interface, it comes up as /Users/DFP/Desktop.  But if I try 
read.table("\\Users\\DFP\\Desktop\\Monroe319Ecoli.txt"), I get No such file or 
directory.  How can I get that file into a data frame?

[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org<mailto:R-SIG-Mac@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


--
Ben Tupper
Bigelow Laboratory for Ocean Science
East Boothbay, Maine
http://www.bigelow.org/
https://eco.bigelow.org


[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in read.table()?

2021-02-15 Thread Parkhurst, David F.
Thanks.  As I’ve said elsewhere, I thought I had seen in something I read that 
those double backslashes were required in a Mac. 

From: Peter Dalgaard 
Date: Monday, February 15, 2021 at 8:31 AM
To: Parkhurst, David F. 
Cc: r-sig-mac@r-project.org 
Subject: Re: [R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in 
read.table()?
Just use forward slashes, backslashes is a Windows thing. I.e.

read.table("/Users/DFP/Desktop/Monroe319Ecoli.txt")

should do it. A generic trick is

x <- file.choose()
dd <- read.table(x)

(and then possible have a look at x)

-pd

> On 29 Jan 2021, at 21:25 , Parkhurst, David F.  wrote:
> 
> I�ve tried for over an hour to figure this out with no luck.  I�ve moved the 
> text file (created from excel) to the desktop to simplify the path.  If I 
> click on the file and ask Get Info, it lists �Where� as  iCloud Drive > 
> Desktop.  If I copy that to the clipboard and paste that into a read.table 
> command in the R interface, it comes up as /Users/DFP/Desktop.  But if I try 
> read.table("/Users\DFP\Desktop\Monroe319Ecoli.txt"), I get No such file or 
> directory.  How can I get that file into a data frame?
> 
>    [[alternative HTML version deleted]]
> 
> ___
> R-SIG-Mac mailing list
> R-SIG-Mac@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com








___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] I'm new to R in a Mac. How do I specify the path in read.table()?

2021-02-15 Thread Parkhurst, David F.
I�ve tried for over an hour to figure this out with no luck.  I�ve moved the 
text file (created from excel) to the desktop to simplify the path.  If I click 
on the file and ask Get Info, it lists �Where� as  iCloud Drive > Desktop.  If 
I copy that to the clipboard and paste that into a read.table command in the R 
interface, it comes up as /Users/DFP/Desktop.  But if I try 
read.table("\\Users\\DFP\\Desktop\\Monroe319Ecoli.txt"), I get No such file or 
directory.  How can I get that file into a data frame?

[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] Unable to change some members of a vector

2021-02-13 Thread Parkhurst, David F.
I have a problem I don’t know how to deal with.  I’ve used read.table to create 
the data frame called msPdf.  It contains three vectors:  month, site, conc.  
Some of the site values look like this:  MLH\xca.  I was able to change that 
with this command: msPdf$site[13]="MLH”.  That seems to have been allowed 
because some of the other sites are simply MLH.  But the system won’t let me 
make the same kind of change in another case:
 msPdf$site[29]="MUH”.  When I ask for that, I get 
Warning message:
In `[<-.factor`(`*tmp*`, 29, value = c(5L, 2L, 1L, 11L, 5L, 12L,  :
  invalid factor level, NA generated
> #13  May MLH\xca 0.007
Then if I enter msPdf$site[29], I get this response:
[1] 
Levels: CrCr LMO MCE MCH MFSC MLE MLH MLH\xca MUE MUH\xca NFSC SFSC

In other words, although other sites that were just plain MLH, there were not 
other sites that were just plain MUH.
How can I fix this problem?  I have no idea why excel added those \xca bits to 
a few of the site values.

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] Problem with read.table in my Mac. "No such file or directory"

2021-02-13 Thread Parkhurst, David F.
Thanks.  I switched from years using PCs about a year ago when MS would no 
longer support Windows 7.  I have missed seeing extensions on files (probably 
.txt for this one).  It�s good to learn that I can change that.

From: Bryan Hanson 
Date: Saturday, February 13, 2021 at 3:37 PM
To: Parkhurst, David F. 
Cc: r-sig-mac@r-project.org 
Subject: Re: [R-SIG-Mac] Problem with read.table in my Mac. "No such file or 
directory"
Try

list.files()

to see the names of the files in the current directory, and make certain you 
are where you think you are, the file is there, has the name you think it has 
etc.  You may need to add the extension, presumably something like �.csv� to 
your read.table call.

A possible point of confusion is that  you may have your Mac set to not display 
file extensions, and life is generally easier in my opinion if those extensions 
are turned on.   Plenty of advice on the internet as to how to turn this on for 
all files.

Bryan

> On Feb 13, 2021, at 1:29 PM, Parkhurst, David F.  wrote:
>
> I�m still having trouble with read.table, as follows (and there IS a plain 
> text document called moabsitechem in this directory:
>> getwd()
> [1] "/Users/DFP/Documents/Documents - David�s iMac/ae/FriendsMonroe"
>> read.table("moabsitechem")
> Error in file(file, "rt") : cannot open the connection
> In addition: Warning message:
> In file(file, "rt") :
>   cannot open file 'moabsitechem': No such file or directory
>
> How can I fix this problem?
>
> ___
> R-SIG-Mac mailing list
> R-SIG-Mac@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] Problem with read.table in my Mac. "No such file or directory"

2021-02-13 Thread Parkhurst, David F.
I’m still having trouble with read.table, as follows (and there IS a plain text 
document called moabsitechem in this directory:
> getwd()
[1] "/Users/DFP/Documents/Documents - David’s iMac/ae/FriendsMonroe"
> read.table("moabsitechem")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'moabsitechem': No such file or directory

How can I fix this problem?

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] How to find the path for a file to be read with read.table() in a Mac

2021-02-13 Thread Parkhurst, David F.
Ah.  That will simplify the process a lot!

From: Duncan Murdoch 
Date: Saturday, February 13, 2021 at 10:52 AM
To: Parkhurst, David F. , r-sig-mac@r-project.org 

Subject: Re: [R-SIG-Mac] How to find the path for a file to be read with 
read.table() in a Mac
On 13/02/2021 10:42 a.m., Parkhurst, David F. wrote:
> I�ve several times to figure this out with no luck.  I�ve moved a tab 
> delimited text file (created from excel) to the desktop to simplify the path. 
>  If I click on the file and ask Get Info, it lists �Where� as  iCloud Drive > 
> Desktop.  If I copy that to the clipboard and paste that into a read.table 
> command in the R console, it comes up as /Users/DFP/Desktop.  But if I try 
> read.table("\\Users\\DFP\\Desktop\\moabsitechem"),
>  I get No such file or directory.  How can I get that file into a data frame?
>
> Is there some place in my Mac that I can put the file so I could enter just 
> the file name, and not the whole path?

Sorry, forget to answer your actual question:

You can use getwd() to find the working directory.  If you put the file
there, you won't need to specify the path.

Duncan Murdoch

[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] How to find the path for a file to be read with read.table() in a Mac

2021-02-13 Thread Parkhurst, David F.
Thank you.  I thought I�d seen in some book that in a Mac, one had to specify 
paths in the way I tried.

From: Duncan Murdoch 
Date: Saturday, February 13, 2021 at 10:49 AM
To: Parkhurst, David F. , r-sig-mac@r-project.org 

Subject: Re: [R-SIG-Mac] How to find the path for a file to be read with 
read.table() in a Mac
On 13/02/2021 10:42 a.m., Parkhurst, David F. wrote:
> I�ve several times to figure this out with no luck.  I�ve moved a tab 
> delimited text file (created from excel) to the desktop to simplify the path. 
>  If I click on the file and ask Get Info, it lists �Where� as  iCloud Drive > 
> Desktop.  If I copy that to the clipboard and paste that into a read.table 
> command in the R console, it comes up as /Users/DFP/Desktop.  But if I try 
> read.table("\\Users\\DFP\\Desktop\\moabsitechem"),
>  I get No such file or directory.  How can I get that file into a data frame?
>
> Is there some place in my Mac that I can put the file so I could enter just 
> the file name, and not the whole path?

It doesn't make sense to use backslashes in the path:  macOS will see
those as part of the name, not as path separators.  Just use
read.table("/Users/DFP/Desktop/moabsitechm") if that's the filename.

Duncan Murdoch


[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] How to find the path for a file to be read with read.table() in a Mac

2021-02-13 Thread Parkhurst, David F.
I’ve several times to figure this out with no luck.  I’ve moved a tab delimited 
text file (created from excel) to the desktop to simplify the path.  If I click 
on the file and ask Get Info, it lists “Where” as  iCloud Drive > Desktop.  If 
I copy that to the clipboard and paste that into a read.table command in the R 
console, it comes up as /Users/DFP/Desktop.  But if I try 
read.table("\\Users\\DFP\\Desktop\\moabsitechem"), I get No such file or 
directory.  How can I get that file into a data frame?

Is there some place in my Mac that I can put the file so I could enter just the 
file name, and not the whole path?

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] Problem with dot chart examples in my Mac

2021-02-07 Thread Parkhurst, David F.
 I�m trying to see the result of the dotchart example, i.e. dotchart(VADeaths, 
main = "Death Rates in Virginia - 1940").
When I enter that and hit return, a blank Quartz 2 [*] window comes up.  I�ve 
checked, and the VADeaths data are present.
What should I do to actually see the result of that call?
David


[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] Question about stripchart

2021-02-02 Thread Parkhurst, David F.
I’ll try that.  Thank you again.

From: Richard M. Heiberger 
Date: Tuesday, February 2, 2021 at 5:20 PM
To: Parkhurst, David F. , r-sig-mac@r-project.org 

Subject: Fw: Question about stripchart
months<-c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

monames.factor <- factor(monamescon$monames, levels=months)
stripchart(conc~monames.factor, data=monamescon, vert=TRUE)

read the help file
?factor

and see that the levels factor must contain unique values.

Please always keep the list as a recipient when you respond.
This question belongs on r-h...@r-project.org
because it is not Macintosh specific.
Any followup should be sent to r-h...@r-project.org



From: Parkhurst, David F. 
Sent: Tuesday, February 2, 2021 4:29 PM
To: Richard M. Heiberger
Subject: Re: Question about stripchart

Hmm.  I’m guessing that this might work with my stripchart problem:

Define 
months<-c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

Then use mofac<-factor(months, months)

Then set up a vector of 73 elements like

mos<-c(mofac[4],mofac[4],…,mofac[12])

Then my call to stripchart would be (conc~mos, …)

Is that what I need to do?


From: Richard M. Heiberger 
Date: Monday, February 1, 2021 at 9:10 PM
To: Parkhurst, David F. 
Subject: Re: Question about stripchart
month.factor <- factor(month.name, month.name)


> month.name
 [1] "January"   "February"  "March" "April" "May"   "June"
 [7] "July"  "August""September" "October"   "November"  "December"
> class(month.name)
[1] "character"
> month.factor <- factor(month.name, month.name)
> levels(factor(month.name))
 [1] "April" "August""December"  "February"  "January"   "July"
 [7] "June"  "March" "May"   "November"  "October"   "September"
> levels(factor(month.factor))
 [1] "January"   "February"  "March" "April" "May"   "June"
 [7] "July"  "August""September" "October"   "November"  "December"
>


From: R-SIG-Mac  on behalf of Parkhurst, David 
F. 
Sent: Monday, February 1, 2021 8:53 PM
To: r-sig-mac@r-project.org
Subject: [R-SIG-Mac] Question about stripchart

I have E. coli data (variable �conc�) for 73 dates over months from Apr through 
Dec (variable �monames�).  The data are in order from the April through 
December, and are in a data.frame titled "monamescon�.  When I run 
stripchart(conc~monames, data=monamescon, vert=TRUE), the months come out in 
alphabetical order along the x axis.  How can I get them to come out in time 
order instead?


[[alternative HTML version deleted]]

[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] Question about stripchart

2021-02-01 Thread Parkhurst, David F.
I have E. coli data (variable �conc�) for 73 dates over months from Apr through 
Dec (variable �monames�).  The data are in order from the April through 
December, and are in a data.frame titled "monamescon�.  When I run 
stripchart(conc~monames, data=monamescon, vert=TRUE), the months come out in 
alphabetical order along the x axis.  How can I get them to come out in time 
order instead?


[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac