Re: [R] R dataframe question

2014-01-25 Thread arun
Hi, dat1 <- read.table(text="X1 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3",sep="",header=TRUE)  dat2 <- setNames(as.data.frame(matrix(dat1[,1],3,3)),paste0("X",1:3)) str(dat2) #'data.frame':    3 obs. of  3 variables: # $ X1: Factor w/ 3 levels "1,1","1,2","1,3": 1 2 3 # $ X2: Factor w/ 3 levels "2,1",

Re: [R] R dataframe question

2014-01-25 Thread arun
Hi, The question is not clear. set.seed(45)  spe <- data.frame(Col1=sample(c(1:10,letters[1:2]),400,replace=TRUE))  mat1 <- matrix(spe[,1],nrow=20,ncol=20) #If you want to replace the non-numeric values with NAs,  mat2 <- matrix(as.numeric(as.character(spe[,1])),nrow=20,ncol=20) A.K. Hell

Re: [R] dataframe question

2010-02-07 Thread David Winsemius
ek in week_list) three_wk_out[[week]] <- as.numeric(three_wk_out[[week]]) ### no need for '{...}' Bill Venables CSIRO/CMIS Cleveland Laboratories -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Sunday, February 07, 2010 8:51 PM To: Vadlamani

Re: [R] dataframe question

2010-02-07 Thread Vadlamani, Satish {FLNA}
MIS Cleveland Laboratories -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Sunday, February 07, 2010 8:51 PM To: Vadlamani, Satish {FLNA} Cc: r-help@r-project.org help Subject: Re: [R] dataframe question On Feb 7, 2010, at 8:14 PM, David Winsemius wrote: >

Re: [R] dataframe question

2010-02-07 Thread David Winsemius
On Feb 7, 2010, at 8:14 PM, David Winsemius wrote: On Feb 7, 2010, at 7:51 PM, Vadlamani, Satish {FLNA} wrote: Folks: Good day. Please see the code below. three_wk_out is a dataframe with columns wk1 through wk209. I want to change the format of the columns. I am trying the code below bu

Re: [R] dataframe question

2010-02-07 Thread David Winsemius
On Feb 7, 2010, at 7:51 PM, Vadlamani, Satish {FLNA} wrote: Folks: Good day. Please see the code below. three_wk_out is a dataframe with columns wk1 through wk209. I want to change the format of the columns. I am trying the code below but it does not work. I need $week in the for loop in

Re: [R] dataframe question

2010-02-07 Thread Peter Alspach
uary 2010 1:51 p.m. > To: r-help@r-project.org > Subject: [R] dataframe question > > Folks: > Good day. Please see the code below. three_wk_out is a > dataframe with columns wk1 through wk209. I want to change > the format of the columns. I am trying the code below but it &g

[R] dataframe question

2010-02-07 Thread Vadlamani, Satish {FLNA}
Folks: Good day. Please see the code below. three_wk_out is a dataframe with columns wk1 through wk209. I want to change the format of the columns. I am trying the code below but it does not work. I need $week in the for loop interpreted as wk1, wk2, etc. Could you please help? Thanks. Satish