[R] Newbie in R: Reading .txt files and storing the 'numbers' in a vector
Patrick Connolly
p_connolly at slingshot.co.nz
Wed Jul 29 22:37:03 CEST 2009
On Wed, 29-Jul-2009 at 10:29AM +0200, Patrick Schorderet wrote:
>
> Hello everybody,
>
> I'm a newbie in R and just went through an introduction class recently.
Did you get the distinction between a vector and a dataframe?
>
> Here's my problem.
> I have 2 text files (.txt) with plain numbers ('doubles' for those who
> know c++) ordered into 2 columns as below:
>
> coordinate1 value1
> coordinate2 value2
> coordinate3 value3
> ... ...
> coordinateN valueN
>
> I would like to write a small programme in which i would:
> 1. take all values of file 1 and store them in a vector
I'm fairly certain you need a dataframe, hence the recommendation to
look at read.table.
> 2. substract to those all values of file 2 (one by one) and store the
> result in a new vector
> 3. Create a sliding window of chosen size and calculate the mathematical
> average and store these averages in a new vector
> 4. Plot the different graphes with a bar plot
Those will follow simply once you have the first part working.
HTH
--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
___ Patrick Connolly
{~._.~} Great minds discuss ideas
_( Y )_ Average minds discuss events
(:_~*~_:) Small minds discuss people
(_)-(_) ..... Eleanor Roosevelt
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
More information about the R-help
mailing list