It is often convenient to quickly set the working directory to a path
copied onto the windows clipboard. A simple trick I have been using for
a while is along the lines given in the previous posts.
setwd.clip-function()
{
options(warn=-1)
setwd(gsub(,/,readLines(clipboard)))
Hello,
I've seen this question asked in the archives but no clear reply or solution
provided. So, just to be sure it is not possible in R: Can I replace
backslashes with slashes in a string ?
I am writing a GUI for R with the Rpad library. I have a browse button for
data loading and Windows
On 04-Jan-06 yvonnick noel wrote:
Hello,
I've seen this question asked in the archives but no clear reply or
solution
provided. So, just to be sure it is not possible in R: Can I replace
backslashes with slashes in a string ?
I am writing a GUI for R with the Rpad library. I have a
On Wed, 4 Jan 2006, yvonnick noel wrote:
Hello,
I've seen this question asked in the archives but no clear reply or solution
provided.
I've seen the answer many times: what were you searching on?
So, just to be sure it is not possible in R: Can I replace
backslashes with slashes in a
Try
name-C:\\myfile.txt
name
[1] C:\\myfile.txt
gsub(([\\]),\\/,name)
[1] C:/myfile.txt
yvonnick noel [EMAIL PROTECTED] wrote:
Hello,
I've seen this question asked in the archives but no clear reply or solution
provided. So, just to be sure it is not possible in R: Can I replace
It would work with
gsub(,/,c:\\My Documents\\data.dat)
[1] c:/My Documents/data.dat
which of course is not your case :(
Absolutely. What I get from the interface is the string c:\My
Documents\data.dat and NOT the string c:\\My Documents\\data.dat. That is
why the solutions previously
You need one of
gsub(,/,c:\\My Documents\\data.dat)
gsub(\\,/,c:\\My Documents\\data.dat, fixed = TRUE)
chartr(\\, /, c:\\My Documents\\data.dat)
The string I get is an ASCII string in a web page, through the use of
an INPUT
type=file ... tag (with a browse button). This string is
On Wed, 4 Jan 2006, yvonnick noel wrote:
You need one of
gsub(,/,c:\\My Documents\\data.dat)
gsub(\\,/,c:\\My Documents\\data.dat, fixed = TRUE)
chartr(\\, /, c:\\My Documents\\data.dat)
The string I get is an ASCII string in a web page, through the use of an
INPUT
type=file ...
You really don't understand what I wrote (and it is in many places in
the R documentation). How are you getting that string into R?
OK. A practical example is probably necessary here. I have rewritten a small
Rpad page to show you what I mean. It is copied at the end of this post.
Just save
yvonnick noel [EMAIL PROTECTED] writes:
You need one of
gsub(,/,c:\\My Documents\\data.dat)
gsub(\\,/,c:\\My Documents\\data.dat, fixed = TRUE)
chartr(\\, /, c:\\My Documents\\data.dat)
The string I get is an ASCII string in a web page, through the use of
an INPUT
type=file
On 04-Jan-06 yvonnick noel wrote:
[...]
The string I get is an ASCII string in a web page, through
the use of an INPUT type=file ... tag (with a browse
button). This string is caught as is by R through the Rpad
interface (using tcltk as a mini local webserver).
So it is not manually input
Hi Yvonnick,
On 4 Jan 2006, [EMAIL PROTECTED] wrote:
I am writing a GUI for R with the Rpad library. I have a browse
button for data loading and Windows return a path string with
backslashes. I need to convert them into slashes to use the string
with read.table.
Can you provide some further
Ted,
For example, if I make a file names.txt with contents
c:\My Documents\data.dat
(even without quotes) then
A-readLines(names.txt,n=1)
A
[1] c:\\My Documents\\data.dat
so the result is now in the format such that gsub will work.
E.g.
gsub(,/,readLines(names.txt,n=1))
Hi!
I am trying to replace backslashes with slashes using gsub (R1.9.0 on XP)
gsub(,/,D:\Prog\R\rw1090\library\cluster\libs)
[1] D:ProgR\rw1090libraryclusterlibs
?
Sincerely Eryk
__
[EMAIL PROTECTED] mailing list
gsub(,/,D:\Prog\R\rw1090\library\cluster\libs)
[1] D:ProgR\rw1090libraryclusterlibs
Probably not the best way, but what about escaping all the backslashes in
the original string?
gsub(,/,D:\\Prog\\R\\rw1090\\library\\cluster\\libs)
__
[EMAIL
15 matches
Mail list logo