An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130315/f75f085c/attachment.pl>
Writing a hyperlink to a csv file
7 messages · Brian Smith, John Kane, Jeff Newmiller +2 more
Well you can write it there but it won't do anything until read into some software that can interpret it as a url. A csv file is just plain text. John Kane Kingston ON Canada
-----Original Message-----
From: bsmith030465 at gmail.com
Sent: Fri, 15 Mar 2013 07:53:02 -0400
To: r-help at r-project.org
Subject: [R] Writing a hyperlink to a csv file
Hi,
I was wondering if it is possible to create a hyperlink in a csv file
using
R code and some package. For example, in the following code:
links <- cbind(rep('Click for Google',3),"google search address goes
here")
## R Mailing list blocks if I put the actual web address here
write.table(links,'test.csv',
sep=',',row.names=F,col.names=F)
the web address should be linked to 'Click for Google'.
many thanks!
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________ Send your photos by email in seconds... TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if3 Works in all emails, instant messengers, blogs, forums and social networks.
Le 15/03/13 12:53, Brian Smith a ?crit :
Hi,
I was wondering if it is possible to create a hyperlink in a csv file using
R code and some package. For example, in the following code:
links <- cbind(rep('Click for Google',3),"google search address goes here")
## R Mailing list blocks if I put the actual web address here
write.table(links,'test.csv',
sep=',',row.names=F,col.names=F)
the web address should be linked to 'Click for Google'.
The browseURL() function open your internet browser with the url
indicated as parameter:
browseURL("http://www.r-project.org")
But I am not sure how you want call it. You should be more precise about
the context you want to use it.
For example:
links <- data.frame(c(' for Google', ' for Bing'),
c("http://www.google.com", "http://www.bing.com"),
stringsAsFactors = FALSE)
cat("Choose an option:\n", paste(1:2, links[,1],"\n"))
f<-scan(nmax=1, quiet=TRUE)
browseURL(links[f,2])
Sincerely
Marc
__________________________________________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130316/399d37fa/attachment.pl>
What Excel does or does not recognize as a url in any particular instance is up to Excel. The CSV format itself has no concept of markup that would allow you to convey this idea. HTML does, and I think Excel can import HTML, but I have never tried intentionally using HTML as a data exchange format for Excel.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
Brian Smith <bsmith030465 at gmail.com> wrote:
Hi Marc, Thanks for the reply. The question is whether it is possible to write some text (with a hyperlink) to a csv file, such that when you open the file in excel, it shows the text as hyperlinked. I guess it boils down to whether there are any 'tags' that you can put in the csv/txt file so that excel recognizes it as hyperlinked text. Does that make sense? thanks! On Sat, Mar 16, 2013 at 4:16 AM, Marc Girondot <marc_grt at yahoo.fr> wrote:
Le 15/03/13 12:53, Brian Smith a ?crit : Hi,
I was wondering if it is possible to create a hyperlink in a csv
file
using
R code and some package. For example, in the following code:
links <- cbind(rep('Click for Google',3),"google search address goes
here")
## R Mailing list blocks if I put the actual web address here
write.table(links,'test.csv',
sep=',',row.names=F,col.names=**F)
the web address should be linked to 'Click for Google'.
The browseURL() function open your internet browser with the url
indicated
as parameter:
browseURL("http://www.r-**project.org <http://www.r-project.org>")
But I am not sure how you want call it. You should be more precise
about
the context you want to use it.
For example:
links <- data.frame(c(' for Google', ' for Bing'),
c("http://www.google.com", "http://www.bing.com"),
stringsAsFactors = FALSE)
cat("Choose an option:\n", paste(1:2, links[,1],"\n"))
f<-scan(nmax=1, quiet=TRUE)
browseURL(links[f,2])
Sincerely
Marc
--
______________________________**____________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr Web:
http://www.ese.u-psud.fr/epc/**conservation/Marc.html<http://www.ese.u-psud.fr/epc/conservation/Marc.html>
Skype: girondot
[[alternative HTML version deleted]] ------------------------------------------------------------------------
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Le 16/03/13 15:42, Jeff Newmiller a ?crit :
What Excel does or does not recognize as a url in any particular instance is up to Excel. The CSV format itself has no concept of markup that would allow you to convey this idea. HTML does, and I think Excel can import HTML, but I have never tried intentionally using HTML as a data exchange format for Excel.
I confirm that an URL is not recognized as url if in .csv file.
The solution if to generate .xml file in R in XML pakage and read it in
Excel.
The .xml file should be like:
<?xml version="1.0"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<Worksheet ss:Name="TEST">
<Table>
<Row ss:Index="3">
<Cell ss:Index="2" ss:HRef="http://www.google.com"><Data
ss:Type="String">http://www.google.com</Data></Cell>
</Row>
</Table>
</Worksheet>
</Workbook>
Sincerely
Marc
__________________________________________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot
1 day later
Besides what others have suggested, there are at some packages for writing Excel files directly, and either of those might have a way to write something that Excel will recognize as a hyperlink. xlsx, XLConnect are both Java-based; I would start with these. -Don
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 3/16/13 6:28 AM, "Brian Smith" <bsmith030465 at gmail.com> wrote:
>Hi Marc,
>
>Thanks for the reply.
>
>The question is whether it is possible to write some text (with a
>hyperlink) to a csv file, such that when you open the file in excel, it
>shows the text as hyperlinked. I guess it boils down to whether there are
>any 'tags' that you can put in the csv/txt file so that excel recognizes
>it
>as hyperlinked text.
>
>Does that make sense?
>
>thanks!
>
>On Sat, Mar 16, 2013 at 4:16 AM, Marc Girondot <marc_grt at yahoo.fr> wrote:
>
>> Le 15/03/13 12:53, Brian Smith a ?crit :
>>
>> Hi,
>>>
>>> I was wondering if it is possible to create a hyperlink in a csv file
>>> using
>>> R code and some package. For example, in the following code:
>>>
>>> links <- cbind(rep('Click for Google',3),"google search address goes
>>> here")
>>> ## R Mailing list blocks if I put the actual web address here
>>> write.table(links,'test.csv',
>>> sep=',',row.names=F,col.names=**F)
>>>
>>>
>>> the web address should be linked to 'Click for Google'.
>>>
>> The browseURL() function open your internet browser with the url
>>indicated
>> as parameter:
>> browseURL("http://www.r-**project.org <http://www.r-project.org>")
>>
>> But I am not sure how you want call it. You should be more precise about
>> the context you want to use it.
>> For example:
>>
>> links <- data.frame(c(' for Google', ' for Bing'),
>> c("http://www.google.com", "http://www.bing.com"),
>> stringsAsFactors = FALSE)
>> cat("Choose an option:\n", paste(1:2, links[,1],"\n"))
>> f<-scan(nmax=1, quiet=TRUE)
>>
>> browseURL(links[f,2])
>>
>> Sincerely
>> Marc
>>
>> --
>> ______________________________**____________________________
>> Marc Girondot, Pr
>>
>> Laboratoire Ecologie, Syst?matique et Evolution
>> Equipe de Conservation des Populations et des Communaut?s
>> CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079
>> B?timent 362
>> 91405 Orsay Cedex, France
>>
>> Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53
>> e-mail: marc.girondot at u-psud.fr
>> Web:
>>http://www.ese.u-psud.fr/epc/**conservation/Marc.html<http://www.ese.u-ps
>>ud.fr/epc/conservation/Marc.html>
>> Skype: girondot
>>
>>
>
> [[alternative HTML version deleted]]
>