On Tue, 17 Apr 2007, Petr Klasterecky wrote: > Patrick Callier napsal(a): >> rownames is the command you want, I think. >> >> rownames(A) <- seq(1:8) >> > > Yes. More generally > rownames(A) <- 1:length(A[,1])
Better rownames(A) <- seq_len(nrow(A)) which works correctly if the length is 0 or there are zero columns, and is self-explanatory. Whenever you use 1:n you need to consider what you want if n <= 0. > And keep in mind that nobody is going to help you next time, if you > won't give a clear and informative SUBJECT in your message. Here it > should have been something like 'wrong row names in subset' or > 'dataframe subset question' etc, certainly not 'please help me, it's > trivial'... > > Btw, there is something like the posting guide for this list (see footer). And please change the subject line to something appropriate when replying. > > Petr > > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [email protected] 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.
