4 5 4 3 6 4 3 4 5 ...
$ Transit: Date, format: "1985-10-01" "1985-11-01" ...
Would be preferable.
---------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352
From: Paul Bernal [mailto:paulberna...
-Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Paul
> Bernal
> Sent: Tuesday, March 28, 2017 9:12 AM
> To: Ng Bo Lin
> Cc: r-help@r-project.org
> Subject: Re: [R] Looping Through DataFrames with Differing Lenghts
>
> Dear friends Ng Bo Li
Hi Paul,
Using the example provided by Ulrik, where
> exdf1 <- data.frame(Date = c("1985-10-01", "1985-11-01", "1985-12-01”,
> "1986-01-01"), Transits = c(NA, NA, NA, NA))
> exdf2 <- data.frame(Date = c("1985-10-01", "1986-01-01"), Transits =
> c(15,20)),
You could also try the following funct
Hi Paul,
The date format that you have supplied to R isn’t exactly right.
Instead of supplying the format “%Y-%m-%d”, it appears that the format of your
data adheres to the “%e-%B-%y” format. In this case, %e refers to Day, and
takes an integer between (0 - 31), %B refers to the 3 letter abbrev
College Station, TX 77840-4352
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Paul Bernal
Sent: Tuesday, March 28, 2017 9:12 AM
To: Ng Bo Lin
Cc: r-help@r-project.org
Subject: Re: [R] Looping Through DataFrames with Differing Lenghts
Dear friends Ng Bo Lin, Mark and
Dear Bo Lin,
I tried doing
Containerdata$TransitDate<-as.Date(Containerdata$TransitDate, "%e-%B-%y")
but I keep getting NAs.
I also tried a solution that I saw in stackoverflow doing:
> lct<-Sys.getlocale("LC_TIME"); Sys.setlocale("LC_TIME", "C")
[1] "C"
>
> Sys.setlocale("LC_TIME", lct)
[1] "En
Dear friends Ng Bo Lin, Mark and Ulrik, thank you all for your kind and
valuable replies,
I am trying to reformat a date as follows:
Data<-read.csv("Container.csv")
DataFrame<-data.frame(Data)
DataFrame$TransitDate<-as.Date(DataFrame$TransitDate, "%Y-%m-%d")
#trying to put it in -MM-DD for
Hi Paul,
does this do what you want?
exdf1 <- data.frame(Date = c("1985-10-01", "1985-11-01", "1985-12-01",
"1986-01-01"), Transits = c(NA, NA, NA, NA))
exdf2 <- data.frame(Date = c("1985-10-01", "1986-01-01"), Transits = c(15,
20))
tmpdf <- subset(exdf1, !Date %in% exdf2$Date)
rbind(exdf2, tmp
Dear friend Mark,
Great suggestion! Thank you for replying.
I have two dataframes, dataframe1 and dataframe2.
dataframe1 has two columns, one with the dates in -MM-DD format and the
other colum with number of transits (all of which were set to NA values).
dataframe1 starts in 1985-10-01 (oct
Hi Paul,
match might help, but without a real data sample, it is hard to check if the
following might work.
mm=match(df.col378[,"Date"],df.col362[,"Date"])
#mm will have NAs, where there is no matching date in df.col362
#and have the index of the match, where the two dates match
new.df=cbind(df.
You could use merge() or %in%.
Best,
Ulrik
Mark Sharp schrieb am Mo., 27. März 2017, 22:20:
> Make some small dataframes of just a few rows that illustrate the problem
> structure. Make a third that has the result you want. You will get an
> answer very quickly. Without a self-contained reprodu
Make some small dataframes of just a few rows that illustrate the problem
structure. Make a third that has the result you want. You will get an answer
very quickly. Without a self-contained reproducible problem, results vary.
Mark
R. Mark Sharp, Ph.D.
msh...@txbiomed.org
> On Mar 27, 2017,
Dear friends,
I have one dataframe which contains 378 observations, and another one,
containing 362 observations.
Both dataframes have two columns, one date column and another one with the
number of transits.
I wanted to come up with a code so that I could fill in the dates that are
missing in o
13 matches
Mail list logo