[R] interactive session
Niels Richard Hansen
Niels.R.Hansen+lists at math.ku.dk
Thu Sep 30 22:34:43 CEST 2010
On 30/09/10 22.23, Peter Dalgaard wrote:
> On 09/30/2010 03:33 PM, Pam wrote:
>> Thanks Niels but it won't do.. please copy and paste the 2 lines below together
>> to your console in order to see what I mean:
>>
>> cat("?"); a<-readLines(n=1)
>> b<-paste("t",a,sep="")
>>
>> anyone / any idea to overcome this problem?
>>
>> Best,
>> Fatih
>>
>
> You might want to source() a file with those lines rather than pasting
> them to the console. There's just no way you can retroactively insert
> text between two already submitted lines.
Exactly, it works when you source() the file.
- Niels
>
> You can do things like this, though
>
> {cat("?"); a<-readLines(n=1)
> "hey"
> b<-paste("t",a,sep="")}
>
> However, there's a catch
>
>> {cat("?"); a<-readLines(n=1)
> + "hey"
> + b<-paste("t",a,sep="")}
> ?ada
>> b
> [1] "tada"
>
> Notice that the "hey" doesn't print.
>
--
Niels Richard Hansen Web: www.math.ku.dk/~richard
Associate Professor Email: Niels.R.Hansen at math.ku.dk
Department of Mathematical Sciences nielsrichardhansen at gmail.com
University of Copenhagen Skype: nielsrichardhansen.dk
Universitetsparken 5 Phone: +45 353 20783 (office)
2100 Copenhagen Ø +45 2859 0765 (mobile)
Denmark
More information about the R-help
mailing list