Let's say we have the statistics given below

gender mean sd n
f 1.666667 0.5773503 3
m 4.500000 0.5773503 4


How do you perform a two-sample t-test (to see if there is a significant difference between the means of men and women in some variable) using statistics like this rather than actual data?

I couldn't find anywhere on the internet how to do this. Most of the tutorials and even the manual deal with the test with the actual data set only.

You can write your own function based on what we know about the mechanics of the two-sample $t$-test. For example, this will do the job:
# m1, m2: the sample means
# s1, s2: the sample standard deviations
# n1, n2: the same sizes
# m0: the null value for the difference in means to be tested for. Default is 0. 
# equal.variance: whether or not to assume equal variance. Default is FALSE. 
t.test2 <- function(m1,m2,s1,s2,n1,n2,m0=0,equal.variance=FALSE)
{
    if( equal.variance==FALSE ) 
    {
        se <- sqrt( (s1^2/n1) + (s2^2/n2) )
        # welch-satterthwaite df
        df <- ( (s1^2/n1 + s2^2/n2)^2 )/( (s1^2/n1)^2/(n1-1) + (s2^2/n2)^2/(n2-1) )
    } else
    {
        # pooled standard deviation, scaled by the sample sizes
        se <- sqrt( (1/n1 + 1/n2) * ((n1-1)*s1^2 + (n2-1)*s2^2)/(n1+n2-2) ) 
        df <- n1+n2-2
    }      
    t <- (m1-m2-m0)/se 
    dat <- c(m1-m2, se, t, 2*pt(-abs(t),df))    
    names(dat) <- c("Difference of means", "Std Error", "t", "p-value")
    return(dat) 
}

Example usage:
set.seed(0)
x1 <- rnorm(100)
x2 <- rnorm(200) 
# you'll find this output agrees with that of t.test when you input x1,x2
(tt2 <- t.test2(mean(x1), mean(x2), sd(x1), sd(x2), length(x1), length(x2)))

Difference of means       Std Error               t         p-value 
         0.01183358      0.11348530      0.10427416      0.91704542 

This matches the result of t.test:
(tt <- t.test(x1, x2))

#         Welch Two Sample t-test
#   
#   data:  x1 and x2
#   t = 0.10427, df = 223.18, p-value = 0.917
#   alternative hypothesis: true difference in means is not equal to 0
#   95 percent confidence interval:
#    -0.2118062  0.2354734
#   sample estimates:
#    mean of x  mean of y 
#   0.02266845 0.01083487 

tt$statistic == tt2[["t"]]
#        t 
#     TRUE 

tt$p.value == tt2[["p-value"]]
# [1] TRUE

