[R] Identifying columns with specific character

2018-04-18 Thread Farnoosh Sheikhi via R-help
Hello, I have a data frame with 400 columns and wanted to filter character columns with "$" in it.For example: >  x <- c("$5", "$89", "$10", "$34")  >  y <- c(1:4)>  My.Data <- data.frame (x,y)> My.Data    x y1  $5 12 $89 23 $10 34 $34 4 I want to detect the columns with $ and remove the $ from

[R] Fw: passing different sample sizes

2017-09-25 Thread Farnoosh Sheikhi via R-help
Hi,  I have the below function which returns confidence intervals. I wanted to pass different sample sizes through the function, but for some reason it's not working. n   <- seq(from=40, to=300, by=2o) I was also wondering how I can return a plot for different sample sizes.  plot(m~d,

Re: [R] Different date formats in one column

2017-06-29 Thread Farnoosh Sheikhi via R-help
as.Date( dta$DtStr[ idx ], format="%B-%d-%y" ) idx <- grepl( "^(0[1-9]|1[0-2])[0-9]{2}[0-9]{2}$", dta$DtStr, perl=TRUE ) dta$Dt[ idx ] <- as.Date( dta$DtStr[ idx ], format="%m%d%y" ) idx <- grepl( "^([1-9]|1[0-2])/[0-9]{1,2}/[0-9]{2}$", dta$DtStr,

Re: [R] Different date formats in one column

2017-06-29 Thread Farnoosh Sheikhi via R-help
un 2017, at 2:02 pm, Farnoosh Sheikhi via R-help > <r-help@r-project.org> wrote: > > Hi, > I have a data set with various date formats in one column and not sure how to > unify it.Here is a few formats: > 02091702/22/170221201703/17/160015-08-239/2/1500170806May-2-201522-March-20

[R] Different date formats in one column

2017-06-28 Thread Farnoosh Sheikhi via R-help
Hi,  I have a data set with various date formats in one column and not sure how to unify it.Here is a few formats: 02091702/22/170221201703/17/160015-08-239/2/1500170806May-2-201522-March-2014 I tried parse_date_time from lubridate library but it failed.Thanks so much.  Best,Farnoosh

[R] unique dates per ID

2016-11-14 Thread Farnoosh Sheikhi via R-help
Hi,  I have a data set like below: Subject<- c("2", "2", "2", "3", "3", "3", "4", "4", "5", "5", "5", "5")dates<-c("2011-01-01", "2011-01-01", "2011-01-03" ,"2011-01-04", "2011-01-05", "2011-01-06" ,"2011-01-07", "2011-01-07", "2011-01-09" ,"2011-01-10"         ,"2011-01-11"

[R] Extracting dates to create a new variable

2016-08-10 Thread Farnoosh Sheikhi via R-help
blockquote, div.yahoo_quoted { margin-left: 0 !important; border-left:1px #715FFA solid !important; padding-left:1ex !important; background-color:white !important; } Hi  I have a data set like below and wanted to create a new date variable by extracting the dates for specific departments.I

[R] Extracting dates to create a new variable

2016-08-08 Thread Farnoosh Sheikhi via R-help
Hi there,  I have a data set like below and wanted to create a new date variable by extracting the dates for specific departments.I want to extract the dates for departments CC, DD, FF,  put it in a new column and repeat it for other unique IDs. Subject<- c("2", "2", "2", "3", "3", "3", "4",

[R] Merging Issue

2016-06-17 Thread Farnoosh Sheikhi via R-help
Hi all,  I have two data sets similar like below and wanted to merge them with variable "deps". As this is a sample data with small sample size, I don't have any problem using command merge. However, the actual data set has ~60,000 observations with a lot of repeated measures. For example, for

Re: [R] Filtering based on the occurrence

2016-03-31 Thread Farnoosh Sheikhi via R-help
ing<-1 if(start_keeping) keep_rows<-c(keep_rows,rowindex) } final<-matrix(unlist(lapply(df[keep_rows,],as.character)),ncol=3) I find it terribly hard to ignore puzzles. Jim On Wed, Mar 30, 2016 at 10:52 AM, Farnoosh Sheikhi via R-help <r-help@r-project.org> wrote: > H

[R] Filtering based on the occurrence

2016-03-29 Thread Farnoosh Sheikhi via R-help
Hello,  I have a data set similar to below and I wanted to keep the observations after the first occurrence of these department: "B", "D", "F".For example for ID=2, the observation with deps=B and anything after will be kept in the data. For ID=3, observations with deps=D and anything after

[R] Distance in miles btw Zipcodes

2015-09-17 Thread Farnoosh Sheikhi via R-help
 Hello, I'm trying to get the distances between two Zipcode variables, but for some reason I get this error: "matching was not perfect, returning what was found.Error: no such index at level 1" Here is my code: library(ggmap)mapdist(data$Zip.A, data$Zip.B, mode = "driving") The Zip codes are

Re: [R] Mixed Date Formats

2015-07-30 Thread farnoosh sheikhi via R-help
...@gmail.com wrote:   On Wed, Jul 29, 2015 at 2:45 PM, farnoosh sheikhi via R-help r-help@r-project.org wrote:   Hi Arun, Hope all is well with you. I have a data with a column for date.The date format is mixed. There are date values with Month/Day/Year format and values with Day/Month

[R] Mixed Date Formats

2015-07-29 Thread farnoosh sheikhi via R-help
 Hi Arun, Hope all is well with you. I have a data with a column for date.The date format is mixed. There are date values with Month/Day/Year format and values with Day/Month/Year format.I don't know how to unify it.I really appreciate your help.Thanks. [[alternative HTML version

Re: [R] Mixed Date Formats

2015-07-29 Thread farnoosh sheikhi via R-help
Thanks for your help:).   On Wednesday, July 29, 2015 1:50 PM, Sarah Goslee sarah.gos...@gmail.com wrote: On Wed, Jul 29, 2015 at 2:45 PM, farnoosh sheikhi via R-help r-help@r-project.org wrote:   Hi Arun, Hope all is well with you. I have a data with a column for date.The date

Re: [R] Difference in dates for unique ID

2015-02-15 Thread farnoosh sheikhi via R-help
That's exactly what I was thinking. Thanks tons. Sent from Yahoo Mail on Android From:arun smartpink...@yahoo.com Date:Sun, Feb 15, 2015 at 2:47 AM Subject:Re: Difference in dates for unique ID HI Farnoosh, Not sure I understand the expected output.� The difference between the first 2 days