It is usual to separate out the theories of abelian varieties (the 'projective' theory) from that of the linear algebraic group (the 'affine' theory). There are certainly examples that are neither one nor the other - these occur for example in the modern theory of integrals of the second and third kinds such as the Weierstrass zeta-function. But according to a basic theorem the general algebraic group is a semidirect product of an abelian variety with a linear algebraic group.
According to another basic theorem, any group in the category of affine varieties has a faithful linear representation: we can consider it to be a matrix group over K, defined by polynomials over K and with group operation simply matrix multiplication. For that reason a concept of affine algebraic group is redundant over a field - we may as well use a very concrete definition. Note that this means that algebraic group is narrower than Lie group, when working over the field of real numbers: there are examples such as the universal cover of the 2x2 special linear group that are Lie groups, but have no faithful linear representation.
When one wants to work over a base ring R (commutative), there is the group scheme concept: that is, a group object in the category of schemess over R. Affine group scheme is the concept dual to a type of Hopf algebra. There is quite a refined theory of group schemes, that enters for example in the contemporary theory of abelian varieties.