Skip to content

Help needed on R output

11 messages · peng chen, Linlin Yan, Menezes, Ian +5 more

#
+ "00000000000000000000000000000000",
+ "00000000010010010110111111101100",
+ "00000000100100101101000001011111",
+ "00000000110111000001000111100011",
+ "00000001001001010010010100001001",
+ "00000001011011011111101001101001")
+ cat ('rom_array := (\n');
+ for (i in 1:length(t)) {
+   cat('"', t[i], '"',
+     ifelse(i == length(t), '', ',\n'), sep='')
+ };
+ cat(')\n');
+ }
rom_array := (
"00000000000000000000000000000000",
"00000000010010010110111111101100",
"00000000100100101101000001011111",
"00000000110111000001000111100011",
"00000001001001010010010100001001",
"00000001011011011111101001101001")

        
On Tue, May 26, 2009 at 12:30 PM, peng chen <rogerchan2006 at gmail.com> wrote:
#
Hello

I'm unable to get R to connect to the internet at work and I'm guessing
its because of our proxy server. Is there any way to change how R
connects to the internet? How do I provide it the proxy address?

Thank you

Ian 

Confidential: This electronic message and all contents contain information from Syntel, Inc. which may be privileged, confidential or otherwise protected from disclosure. The information is intended to be for the addressee only. If you are not the addressee, any disclosure, copy, distribution or use of the contents of this message is prohibited. If you have received this electronic message in error, please notify the sender immediately and destroy the original message and all copies.
#
Stefan,

Thanks for the response

I'm using the GUI version of R in Windows. I usually just click the R
icon on my desktop, so Im not sure how I would use the --internet2
option? 

Ian Menezes



-----Original Message-----
From: Stefan Grosse [mailto:singularitaet at gmx.net] 
Sent: Tuesday, May 26, 2009 1:39 PM
To: Menezes, Ian
Cc: r-help at r-project.org
Subject: Re: [R] How R connects to the internet

On Tue, 26 May 2009 12:52:16 +0530 "Menezes, Ian"
<Ian_Menezes at Syntelinc.com> wrote:
MI> I'm unable to get R to connect to the internet at work and I'm
MI> guessing its because of our proxy server. Is there any way to
MI> change how R connects to the internet? How do I provide it the
MI> proxy address?

You haven't told which operating system you use. For windows there is
the option --internet2 for the Rgui.exe that uses the proxy settings of
the explorer. 

hth
Stefan

Confidential: This electronic message and all contents contain information from Syntel, Inc. which may be privileged, confidential or otherwise protected from disclosure. The information is intended to be for the addressee only. If you are not the addressee, any disclosure, copy, distribution or use of the contents of this message is prohibited. If you have received this electronic message in error, please notify the sender immediately and destroy the original message and all copies.

Confidential: This electronic message and all contents contain information from Syntel, Inc. which may be privileged, confidential or otherwise protected from disclosure. The information is intended to be for the addressee only. If you are not the addressee, any disclosure, copy, distribution or use of the contents of this message is prohibited. If you have received this electronic message in error, please notify the sender immediately and destroy the original message and all copies.
#
On Tue, 26 May 2009 12:52:16 +0530 "Menezes, Ian"
<Ian_Menezes at Syntelinc.com> wrote:
MI> I'm unable to get R to connect to the internet at work and I'm
MI> guessing its because of our proxy server. Is there any way to
MI> change how R connects to the internet? How do I provide it the
MI> proxy address?

You haven't told which operating system you use. For windows there is
the option --internet2 for the Rgui.exe that uses the proxy settings of
the explorer. 

hth
Stefan
#
peng chen wrote:
Hi Peng and others,
I assumed that you wanted to generate that (Pascal?) expression and you 
have a character or binary numeric vector of the six elements. Say that 
vector is named "binaryvector".

cat("rom_array := (\n")
ends<-c(rep("\",\n",5),"\")\n")
for(i in 1:length(binaryvector))
 cat("\"",binaryvector[i],ends[i],sep="")

should do what you want. However, I have two questions:

1) Why does cat put a newline at the end of a call with a sep argument 
with a newline in it? It doesn't put the sep argument after the last 
element of the vector, even though the help page says that it does.

2) The help page reads:

sep   a character vector of strings to append after each element.

but cat clearly uses only the first string of the vector. Am I reading 
this wrongly?

Jim
#
Menezes, Ian wrote:
You can edit the shortcut (right click and follow the menus), or install 
R with that option.

Duncan Murdoch
#
A simpler solution:
my.string <- c("00000000000000000000000000000000",
"00000000010010010110111111101100",
"00000000100100101101000001011111",
"00000000110111000001000111100011",
"00000001001001010010010100001001",
"00000001011011011111101001101001")

my.string <- paste(my.string, collapse="\",\n\"")

cat(paste("rom_array := (\n\"", my.string, "\")\n", sep=""))

Which produces:
rom_array := (
"00000000000000000000000000000000",
"00000000010010010110111111101100",
"00000000100100101101000001011111",
"00000000110111000001000111100011",
"00000001001001010010010100001001",
"00000001011011011111101001101001")

Search in the archives for character escaping to understand the syntax.

A simple example (notice the gradual additions):
aa <- "010"
cat(aa) # 010

bb <- "\"010"
cat(bb) # "010

cc <- "\"010\""
cat(cc) # "010"

Also read the help for ?paste, and notice the difference between the "sep"
and "collapse" arguments.

Hth,
Adrian
Linlin Yan wrote:

  
    
#
Did you mean this:
"00000000000000000000000000000000",
"00000000010010010110111111101100",
"00000000100100101101000001011111",
"00000000110111000001000111100011",
"00000001001001010010010100001001",
"00000001011011011111101001101001",

Try ?write.table to get the detail of the function please.
On Tue, May 26, 2009 at 9:33 PM, peng chen <rogerchan2006 at gmail.com> wrote: