Re: [R] Col names in a data frame

2021-01-21 Thread Bernard Comcast
Thanks - I had seen that parameter but did not think the ( would be illegal but now I understand why it considers it illegal. Thanks again Bernard Sent from my iPhone so please excuse the spelling!" > On Jan 21, 2021, at 4:14 PM, Duncan Murdoch wrote: > > On 21/01/2021 3:58 p.m., Bernard Mc

Re: [R] Col names in a data frame

2021-01-21 Thread Bernard Comcast
Thanks - I had seen that parameter but did not think the ( would be illegal but now I understand why it considers it illegal. Thanks again Bernard Sent from my iPhone so please excuse the spelling!" > On Jan 21, 2021, at 4:14 PM, Duncan Murdoch wrote: > > On 21/01/2021 3:58 p.m., Bernard McG

Re: [R] Col names in a data frame

2021-01-21 Thread Jan T. Kim via R-help
it looks to me that the names are cranked through make.names for data frames case while that doesn't happen for matrices. Peeking into the `colnames<-` code supports this idea, but that in turn uses `names<-` which is a primitive and so defies further easy peeking. The data.frame function provides

Re: [R] Col names in a data frame

2021-01-21 Thread Sarah Goslee
Hi, data.frame() checks names by default to ensure that column names are legal, but there's an argument to change that. >From ?data.frame() check.names: logical. If ‘TRUE’ then the names of the variables in the data frame are checked to ensure that they are syntactically va

Re: [R] Col names in a data frame

2021-01-21 Thread Duncan Murdoch
On 21/01/2021 3:58 p.m., Bernard McGarvey wrote: Here is an example piece of code to illustrate an issue: rm(list=ls()) # Clear Workspace # Data1 <- matrix(data=rnorm(9,0,1),nrow=3,ncol=3) Colnames1 <- c("(A)","(B)","(C)") colnames(Data1) <- Colnames1 print(Data1) DataFrame1 <- data.frame(Data1)

Re: [R] Col names in a data frame

2021-01-21 Thread Jeff Newmiller
rm(list=ls()) is a bad practice... especially when posting examples. It doesn't clean out everything and it removes objects created by the user. Read ?data.frame, particularly regarding the check.names parameter. The intent is to make it easier to use DF$A notation, though DF$`(A)` is usable if

[R] Col names in a data frame

2021-01-21 Thread Bernard McGarvey
Here is an example piece of code to illustrate an issue: rm(list=ls()) # Clear Workspace # Data1 <- matrix(data=rnorm(9,0,1),nrow=3,ncol=3) Colnames1 <- c("(A)","(B)","(C)") colnames(Data1) <- Colnames1 print(Data1) DataFrame1 <- data.frame(Data1) print(DataFrame1) colnames(DataFrame1) <- Colnames

Re: [R] Col Names

2009-04-08 Thread jim holtman
Is this what you are looking for: > x Positions DEV.MSCI 04/30/1980 00:00:00.000 -0.0150328542 05/31/1980 00:00:00.000 0.0005087752 06/30/1980 00:00:00.000 0.0586794492 07/31/1980 00:00:00.000 0.0458505592 08/31/1980 00:00:00.000 0.0350926728 > colnames(x)[2] <- "NewName" >

[R] Col Names

2009-04-08 Thread livia
Hello, I am working with S-plus TimeSeries Object. I wonder how can I change the column names of the variable instead of using the one default? i.e to change "DEV.MSCI" to other name PositionsDEV.MSCI 04/30/1980 00:00:00.000 -0.0150328542 05/31/1980 00:00:00.000 0.0