I understand that in R you have some base data types (vector, matrix, list, data.frame) and then in the R packages you have some advanced types called S3-class or S4-class (ppp,owin, spatialPointsDataFrame and many others. Some of the functions in R packages only work with arguments of special type. 
I need explanation about converting between different classes and data types in R:
Sometimes I can use a code like:
m = c(1, 2, 3, 4)
df = as.data.frame(m)
But in other cases I must use a code like:
shp = readShapeSpatial("polygons.shp")
win = as(shp,"owin")
How do I know which syntax of the as to use for which object?
Or is the syntax: as.foo(originalObject) always equivalent to as(originalObject, "foo") (here foo stands for the class that I want to convert my object to so that I can use in a function that requires its argument to be a foo class)
Let's say I use a package in R with a class foo. And I have a variable v that belongs to class bar (in other words, class(v) is bar). How do I know if the function as(v,"foo") will work?
 
    