简体   繁体   中英

Using lapply with other values

I have a list of data frames named x , and I would like to subtract each data frame in the list by 1. If

values(x) <- 1 - values(x)

If I wanted to use the function lapply for this would it look like this?

values(x) <- 1 - lapply(x, function(l) values(x))

Thank you

I guess what you need might be

1-sapply(x,value)

or

sapply(x,function(v) 1-value(v))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM