Skip to content
Back to formatted view

Raw Message

Message-ID: <3d391440-d64b-c256-114f-eb8c8b5256a4@sapo.pt>
Date: 2020-10-23T16:19:46Z
From: Rui Barradas
Subject: Extracting data and saving in excel
In-Reply-To: <CAN25tHT8qQSgBG5am-hmwZifWAbQAaQUpPWEpdOvAjyawUtg-Q@mail.gmail.com>

Hello,

First coerce the column birth to class Date, then subset.


data$birth <- as.Date(data$birth)
i <- data$birth > as.Date("1979-01-01")
subdata <- data[i, ]


To write back to Excel, use write.csv or a package able to write Excel 
files directly.


Hope this helps,

Rui Barradas

?s 12:23 de 23/10/20, bgnumis bgnum escreveu:
> Hi all,
> 
> I have a dataframe call "data", and have lots of rows. One of them
> is data$`birth`
> my data has been imported from an excel file in RSTUDIO
> 
> I want to obtain in a function  all rows (with the names) where
> data$`birth` is bigger than 1979/01/01 and extract in a excel file as an
> output (a sub-excel of the original).
> 
> Can you guide with the functions I need to use?
> 
> I have been many time out of programming and I need a bit of help to get in
> fit.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>