You are not going to get more RAM by running a command in R. R works with data in-memory (i.e., in RAM). There are packages that allow you to use hard disk for some of the operations, but in this case I'm not sure if that is possible.
So your solution is to decrease number of observations in your data so that you can fit it into memory.
Your dataset does not fit in your ram - This unfortunately is not trivial to solve.
If you have access to a bigger computer, this is an option. You can also use e.g. google cloud services to obtain a computer with more ram. You can decrease the size of the data set or you can transfer your data set to a SQL database and then access the data using queries.