Re: [R] Problem with adding a row in a data table

2016-09-04 Thread Jeff Newmiller
My suggested approach: dta <- structure(list(Prod_name = c("Banana", "Apple", "Orange", "Yoghurt", "Eggs", "Milk", "Day_num"), X1.1.2000 = c("1", "0", "4", "3", "6", "2", "1"), X2.1.2000 = c("2", "4", "1", "5", "3", "0", "2" ), X3.1.2000 = c("1", "5", "2", "3", "0", "4", "3"), X4.1.2000 = c("2"

Re: [R] Problem with adding a row in a data table

2016-09-04 Thread Filippos Katsios
Dear all, I believe that this will be a more helpful way to put the problem: structure(list(Prod_name = c("Banana", "Apple", "Orange", "Yoghurt", "Eggs", "Milk", "Day_num"), X1.1.2000 = c("1", "0", "4", "3", "6", "2", "1"), X2.1.2000 = c("2", "4", "1", "5", "3", "0", "2" ), X3.1.2000 = c("1", "5",

Re: [R] Problem with adding a row in a data table

2016-09-04 Thread Jeff Newmiller
Please use Reply-all to keep the mailing list in the loop. I cannot provide private assistance, and others may provide valuable input or respond faster than I can. It is very common that people cannot provide the original data. That means more work for YOU, though, not for us. It is up to yo

Re: [R] Problem with adding a row in a data table

2016-09-04 Thread Jeff Newmiller
The "c" function creates vectors. Rows of data frames are data frames, not vectors. new_row <- data.frame( Prod_name = "Day_name", `Date 1`=1, `Date 2`=2,`Date 3`=3 ) data_may <- rbind( new_row, data_may ) Furthermore, data frames are NOT spreadsheets. "Day_num" looks suspiciously UNlike a

[R] Problem with adding a row in a data table

2016-09-04 Thread Filippos Katsios
Dear All, I am relatively new to R and certainly new to the e-mailing list. I need your help. I am working on a data frame, which looks like this: Prod_name | Date 1 | Date 2 | Date 3 | --|-||--| Product 1| 3 | 4 |