[R] About scan

Joshua Wiley jwiley.psych at gmail.com
Wed Aug 18 07:00:32 CEST 2010


On Tue, Aug 17, 2010 at 9:20 PM, Stephen Liu <satimis at yahoo.com> wrote:
> ----- Original Message ----
>
> From: Joshua Wiley <jwiley.psych at gmail.com>
> To: Stephen Liu <satimis at yahoo.com>
> Cc: r-help at r-project.org
> Sent: Wed, August 18, 2010 12:10:51 PM
> Subject: Re: [R] About scan
>
> Hi Josh,
>
> Thanks for your advice.
>
> - snip -
>
>>> x <- scan()
>>1: 1 2 3 4 5
>>6:
>
> I tried it before.  It'll continue asking for input unless pressing [Ctrl]+c

That certainly works.  It will also stop after an empty line (hit
enter twice).  I think the examples in the documentation for ?scan
show much more practical uses.  If you are just typing in the data c()
seems easier in most cases.

>
>
> B.R.
> Stephen
>
>
>
> On Tue, Aug 17, 2010 at 8:42 PM, Stephen Liu <satimis at yahoo.com> wrote:
>> Hi folks,
>>
>>
>> I followed an online example to input data;
>>
>>> x = scan(1,2,3,4,5)
>> Error in scan(1, 2, 3, 4, 5) :
>>  either specify 'nmax' or 'n', but not both.
>>
>> It can't work.
>>
>>
>>> x = c(1,2,3,4,5)
>>> x
>> [1] 1 2 3 4 5
>>
>> It works.
>>
>>
>> Whether "scan" is replaced with "c" ?
>>
>>> ?c
>> .....
>> Usage:
>>     c(..., recursive=FALSE)
>>
>>
>> TIA
>>
>>
>> B.R.
>> Stephen L
>>
>>
>>
>> ______________________________________________
>> 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.
>>
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> University of California, Los Angeles
> http://www.joshuawiley.com/
>
>
>
>
> ______________________________________________
> 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list