[R] Function help

Jim Lemon drjimlemon at gmail.com
Mon Oct 26 21:24:37 CET 2015


Hi Alexander,
I suspect that when you write "try" you mean that you try to run the
function with some value for "pid". The "unexpected symbol" error message
usually includes the offending symbol and that will probably identify the
problem.

Jim

On Mon, Oct 26, 2015 at 1:20 PM, <alexander.thomas.1 at louisville.edu> wrote:

> Hello,
>
> I'm following an example in the book, analyzing baseball data with R, but
> it's not working for me. The example is:
>
> compute.hr <- function(pid){d <- subset(Batting.60, playerID==pid)
> sum(d$HR)}
>
> Every time I try this, it says there's an unexpected symbol. Any idea on
> what the unexpected symbol is or how to fix it? Thanks.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list