On Fri, Sep 24, 2010 at 4:16 PM, Struve, Juliane <j.str...@imperial.ac.uk>wrote:

>  Hi again,
>
> when applying the code to my real data I need to deal with a large number
> of individuals and massive data sets. I am using the code below to read in
> the data for different individuals, and would like to create the
> "Lines" within the loop. But "Lines" needs to have the variable Fish_ID
> somehow included in the name, as otherwise the string will be overwritten on
> each execution. How can I create a different "Lines" for each Fish_ID ? Or
> is there a better way of doing this ? Sorry, this is surely a beginner's
> question.
>
> Thank you very much for your help.
>
> Regards,
>
> Juliane
>
> ReleaseDates <- read.csv(file="ReleaseDates.csv",head=TRUE,sep=",")
> for (i in 1:length(ReleaseDates$Fish_ID)){
> Fish_ID <- ReleaseDates$Fish_ID[i]
> Data <- read.csv(paste(Fish_ID))
> Lines <- paste(Data$Date,Data$Distance)
> print Lines
> }
>
>
That was just an example.   The purpose of Lines was to make the example
self contained and reproducible. In reality you dont use Lines at all.  Also
your post suggested that they were in separate files since you had headings
on each one.  If that is not the case then you just read it all at once
using read.zoo.   z <- read.zoo(ReleaseDates.csv", split = "Fish_ID", header
= TRUE, sep = ",", ...whatever...)

There are three vignettes (pdf documents) that come with zoo.  Read them all
and read the help page of read.zoo.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to