r - All column names are in one cell -


this code. point find blank rows in 1 column, in case defined address.1, , replace corresponding row 1 of 2 other columns, defined here rf_ms_address1 , rf_ghq_address1:

withblanks <- read.csv("file.csv", stringsasfactors = false)  fun <- function(x, y, z) {   y[y == ""] <- z[y == ""] #substitute missings in y values z   x[x == ""] <- y[x == ""] #substitute missings in x values y   x #return }  noblanks <- within(withblanks, "address.1" <- fun("address.1", "rf_ms_address1", "rf_ghq_address1")) write.table(noblanks, "file.csv", sep = ",", col.names = true, row.names = false) 

the resultant file has headers in single cell, separated period. example: "contactid.email.address.first.name.middle.name.etc." naturally want them in separate cells, right file unusable. doing wrong result?

this sample representation of first row:

contactid.email.address.first.name.middle.name.last.name.company.address.1.address.2.address.3.city.state.or.province.zip.or.postal.code.country.business.phone.mobile.phone.fax.title.salutation.ticker.symbol.language.salesperson.sfdccontactid.sfdclea ...     1 1 1 2393392 emailemail@email.net firstname  lastname 868 management company 1b, plaza place, 12 location road, city, city   city city city city  city city +111 11111111   principal  na   22222222222222   8/1/2013 0:30 5/29/2015 12:06 llll0909090909 contactid.email.address.first.name.middle.name.last.name.company.address.1.address.2.address.3.city.state.or.province.zip.or.postal.code.country.business.phone.mobile.phone.fax.title.salutation.ticker.symbol.language.salesperson.sfdccontactid.sfdclea ... 1 1 1 2393392 emailemail@email.net firstname  lastname 868 management company 1b, plaza place, 12 location road, city, city   city city city city  city city +111 11111111   principal  na   22222222222222   8/1/2013 0:30 5/29/2015 12:06 llll0909090909 0909090909opk 5/28/2015 22:20    na na na na 0 na na na na na  gud 565787   na na na na  na na na na  na  na na na na na na na na na na na na other  (specify in description box)            0 capital.net firstname lastname  567234 portfolio management  region 0 0   mgt d 4 d4 3/8/2014 2:09 na firstlastletters     false  cash na cash cash   na na na    na 10/11/2013 4:52  contact name 9584639474ucon 4/14/2014 3:57       9584639474ucon     9584639474ucon 9584639474ucon 9584639474ucon 9584639474ucon9584639474ucon contact name pos ition,  sales (356) 782-983 email@email.com 9584639474ucon 2- warm  0 242  0  6 attempts/no contact website rejected   9584639474ucon contact name 0  geo region  0        product 0  na  region 8/1/2013 0:17 1/11/2014 6:49  na email@email.com         na  na na na na na na           na na na na      na na na            na  9584639474ucon  5/25/2015 0:00 12/12/2014 0:00 5/25/2015 0:00   na  na  na address 1 address.1 5/28/2015 22:20    na na na na 0 na na na na na  gud 565787   na na na na  na na na na  na  na na na na na na na na na na na na other  (specify in description box)            0 capital.net firstname lastname  567234 portfolio management  region 0 0   mgt d 4 d4 3/8/2014 2:09 na firstlastletters     false  cash na cash cash   na na na    na 10/11/2013 4:52  contact name 9584639474ucon 4/14/2014 3:57       9584639474ucon     9584639474ucon 9584639474ucon 9584639474ucon 9584639474ucon9584639474ucon contact name pos ition,  sales (356) 782-983 email@email.com 9584639474ucon 2- warm  0 242  0  6 attempts/no contact website rejected   9584639474ucon contact name 0  geo region  0        product 0  na  region 8/1/2013 0:17 1/11/2014 6:49  na email@email.com         na  na na na na na na           na na na na      na na na            na  9584639474ucon  5/25/2015 0:00 12/12/2014 0:00 5/25/2015 0:00   na  na  na address 1 address.1 


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -