Dear all,
I have a data frame of dimension 720 columns by 360 rows, to which I am trying
to add numerical row and column labels to, using the 'sequence' command. The
original data, which I read in using 'read.table', had no such labels at all.
I've got as far as successfully using the sequence command and getting the
labels to display. However, I'm finding that for the minus numbers in
particular, the values aren't displaying correctly. For the value '-179.75' for
example, it displays as 'X.179.75'. Even for positive numbers, the 'X' prefix
appears at the start of the label (but without the '.').
I have tried numerous attempts at addressing this. I'm currently as far as
adopting the following approach; I'll show what I've done for just the column
headings - I've adopted the same approach for row headings, with the same
results/problem so far.
columnnames <- seq(from = -179.75, to = 179.75, length = 720)
as.numeric <- colnames(Jan)
colnames(Jan) <- make.names(columnnames)
N.B. 'Jan' (as in January) refers to the data frame in question.
So my thinking here is to assign the values to be used as column labels to
'columnnames', and use 'make.names' to assign these values to the column names
of the data frame. I've also tried changing 'colnames(Jan)' to be a numeric
class, as I was previously having problems assigning the values to the labels -
I think because by default 'colnames' is of class 'character vector'?
If anyone is able to suggest a way how I can solve the problem of the values
not being displayed as I'd hoped (namely, removing the 'X' and displaying '-'
for minus numbers), then I'd be very grateful.
Many thanks,
Steve
_________________________________________________________________
[[alternative HTML version deleted]]
______________________________________________
[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.