That is certainly possible with a modern web browser. It happens that I just wrote a blog post yesterday about webcams: https://yihui.name/en/2017/12/html5-camera/ You can read this tutorial to know more technical details, but that is only the first step. The second step is to send the picture to R. You can consider Shiny, although this would require substantial knowledge about Shiny.
In order to integrate this with a shiny app, you will need to know at least some basic javascript. You'll have to look at the usage documentation of webcamjs and understand it enough to know how to build a minimal page that uses that library. If you know how to do that with plain javascript then shinyjs can indeed make it fairly simple to transfer it into a shiny app. You can look at this example of porting a different javascript library into shinyjs as an example to follow: https://github.com/timelyportfolio/sweetalertR/issues/1#issuecomment-151685005
Thanks for the reply but I don't know any JS. Isn't there any package in R to do this kind of stuff. I mean webcam should be a pretty normal thing for any programming right???
That is what I was looking for. But thanks anyways for the reply.
I really appreciate you taking time in writing the response.
I doubt there is a package for it, but maybe. You can go to the CRAN
website that lists all the packages and search for the word webcam or web
cam. Or Google search for "r package webcam". But I've never run into
anyone trying to do that and even if someone did, most people would not go
as far as making a package for it, so it's very likely there is none