如何在R中翻译此SQL语句?基本上,我想看看在R超过40岁的英文作者。谢谢

如何在R中翻译此SQL语句?基本上,我想看看在R超过40岁的英文作者。谢谢,sql,r,postgresql,Sql,R,Postgresql,您可以尝试以下方法: 库(tidyverse) 图书馆(lubridate) data=tibble(autor=“William Morris”, 出生日期=截止日期(“1834-03-24”), country=“英格兰”) 数据%>% 过滤器(lubridate::interval(出生日期,Sys.Date())/年(1)>40& 国家%(以%c(“英国”)) #一个tibble:1 x 3 出生国自动日期 1威廉·莫里斯1834-03-24英格兰 很难为您提供帮助,因为您没有在R中提供

您可以尝试以下方法:

库(tidyverse)
图书馆(lubridate)
data=tibble(autor=“William Morris”,
出生日期=截止日期(“1834-03-24”),
country=“英格兰”)
数据%>%
过滤器(lubridate::interval(出生日期,Sys.Date())/年(1)>40&
国家%(以%c(“英国”))
#一个tibble:1 x 3
出生国自动日期
1威廉·莫里斯1834-03-24英格兰

很难为您提供帮助,因为您没有在R中提供数据集的示例
select *
from autors
where ((current_date- interval '40 years')> dateofbirth) and 
(country like 'England%')