[R] Min , Max

R. Michael Weylandt michael.weylandt at gmail.com
Fri Apr 27 19:32:51 CEST 2012


Just a total guess but if h is the n-th element of listfile, do you
really mean to be taking the n-th element of h as well? It could be
that when you get to the second element h[n] becomes h[2] which
doesn't exist (h[1] obviously did)

If you do mean this, listfile is probably a list (possibly of lists)
so you want listfile[[n]] to get the n-th element (rather than a
sublist)

Hope this helps,
Michael

On Fri, Apr 27, 2012 at 1:28 PM, Jonsson <amen.alyaari at bordeaux.inra.fr> wrote:
> The piece of R code given above is meant to perform calculations for many
> files(12) in one folder.But I am getting this error:Error: subscript out of
> bounds.It finished reading the first file(successfully) but the error arose
> when it started to read the next file. Any suggestions why?. I think the
> problem is in this first loop: for (n in 1:length(listfile)) { h=listfile[n]
>       b=file.info(h[n])$size/67420/4
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Min-Max-tp4593065p4593279.html
> Sent from the R help mailing list archive at Nabble.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.



More information about the R-help mailing list