Re: [R] Extract Data form Website Tables
Hi Doran I'm also trying to scrape the leaderboard data. Did you happen to figure out how to extract the athlete's team/affiliate? Trying to do a bit of code to figure out which teams will qualify when individuals are removed. On Sunday, March 2, 2014 2:34:21 PM UTC-5, Doran, Harold wrote: This is fantastic, thank you. I¹ve modified the code to loop through all the pages and grab all rows of the HTML table. Thank you, Rui. On 3/2/14, 5:08 AM, Rui Barradas ruipba...@sapo.pt javascript: wrote: Hello, Maybe something like the following. #install.packages(XML, dep = TRUE) library(XML) url - http://games.crossfit.com/scores/leaderboard.php?stage=1sort=0division= 1region=0numberperpage=60page=0competition=0frontpage=0expanded=0fu ll=1year=14showtoggles=0hidedropdowns=0showathleteac=1athletename= data - readHTMLTable(readLines(url), which=1, header=TRUE) names(data) - gsub(\\n, , names(data)) names(data) - gsub( +, , names(data)) data[] - lapply(data, function(x) gsub(\\n, , x)) str(data) Hope this helps, Rui Barradas Em 01-03-2014 23:47, Doran, Harold escreveu: There is a website that populates a table with athlete scores during a competition. I would like to be able to extract those scores from the website and place them into a data frame if this is possible. The website is at the link below: http://games.crossfit.com/leaderboard One complication is that one must manually click through multiple pages as the table only populates a few hundred rows on one web page. In looking at the source code of the website, I think I can go to here and maybe grab scores, but I am not sure if R can someone read them in from this and populate a data frame and subsequently grab data from every page. http://games.crossfit.com/scores/leaderboard.php?loadfromcookies=1number perpage=60full=1showathleteac=1view-source: http://games.crossfit.com/s cores/leaderboard.php?loadfromcookies=1numberperpage=60full=1showathle teac=1 I have not done anything like this before, and so any guidance is appreciated. Thank you Harold [[alternative HTML version deleted]] __ r-h...@r-project.org javascript: mailing list 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. __ r-h...@r-project.org javascript: mailing list 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. __ R-help@r-project.org mailing list 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.
[R] French accents on characters
Hello Could someone please direct me to the correct commands for adding accents (grave and aigu) to a letter in a plot title, label, or in added text? I'm sure there's a handy list somewhere, but I've failed in coming up with the correct search words to find it. Thank you muchly! Jen __ R-help@r-project.org mailing list 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.
Re: [R] evaluating expressions with sub expressions
Thanks so much everyone! Bert's shorted example does what I need, but I'm filing away Gabor's solution for when I inevitably need it some day. I've never found the handling of variables in R to be very straightforward; sometimes I pine for Maple to do my algebra for me... If its good enough to have one level of substitution then esub in my post (originally due to Tony Plate -- see reference in my post) is all that is needed: esub(mat[[2]], list(g1 = g1[[1]])) but I think the real problem could require multiple levels of substitution in which case repeated application of esub is needed as you walk the expression tree which is what proc() in my post does. For example, suppose mat[[2]] is a function of g1 which is a function of Tm which is a function of z. Then continuing the example in the original post this does the repeated substitution needed (which would be followed by an eval, not shown here, as in my original post): Tm - expression(z^2) sapply(mat, proc) [[1]] [1] 0 [[2]] f1 * s1 * (1/z^2) To answer your question, quote() produces a call object but expression produces a call wrapped in an expression which is why there is special handling of expression objects in the proc() function in my post. On Fri, Jan 29, 2010 at 4:38 PM, Bert Gunter gunter.ber...@gene.com wrote: Folks: Stripped to its essentials, Jennifer's request seemed simple: substitute a subexpression as a named variable for a variable name in an expression, also expressed as a named variable. A simple example is: e - expression(0,a*b) z1 - quote(1/t) ## explained below The task is to substitute the expression in z1, 1/t, for b in e, yielding the substituted expression as the result. Gabor provided a solution, but it seemed to me like trying to swat a fly with a baseball bat -- a lot of machinery for what should be a more straightforward task. Of course, just because I think it **should be** straightforward does not mean it actually is. But I fooled around a bit (guided by Gabor's approach and an old Programmer's Niche column of Bill Venables) and came up with: f - lapply(e,function(x){do.call(substitute,list(x,list(b=z1)))}) f [[1]] [1] 0 [[2]] a * (1/t) ## f is a list. Turn it back into an expression f - as.expression(f) ## check that this works as intended f expression(0, a * (1/t)) a - 2 t - 3 eval(f) [1] 0.667 Now you'll note that to do this I explicitly used quote() to produce the variable holding the subexpression to be substituted. You may ask, why not use expression() instead, as in z2 - expression(1/t) This doesn't work: f - lapply(e,function(x){do.call(substitute,list(x,list(b=z2)))}) f [[1]] [1] 0 [[2]] a * expression(1/t) f - as.expression(f) ## Yielding ... f expression(0, a * expression(1/t)) Not what we want! ## And sure enough ... eval(f) Error in a * expression(1/t) : non-numeric argument to binary operator I think I understand why the z - expression() approach does not work; but I do not understand why the z - quote() approach does! The mode of the return from both of these is call, but they are different (because identical() tells me so). Could someone perhaps elaborate on this a bit more? And is there a yet simpler and more straightforward way to do the above than what I proposed? Cheers, Bert Gunter Genentech Nonclinical Statistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gabor Grothendieck Sent: Friday, January 29, 2010 11:01 AM To: Jennifer Young Cc: r-help@r-project.org Subject: Re: [R] evaluating expressions with sub expressions The following recursively walks the expression tree. The esub function is from this page (you may wish to read that entire thread): http://tolstoy.newcastle.edu.au/R/help/04/03/1245.html esub - function(expr, sublist) do.call(substitute, list(expr, sublist)) proc - function(e, env = parent.frame()) { for(nm in all.vars(e)) { if (exists(nm, env) is.language(g - get(nm, env))) { if (is.expression(g)) g - g[[1]] g - Recall(g, env) L - list(g) names(L) - nm e - esub(e, L) } } e } mat - expression(0, f1*s1*g1) g1 - expression(1/Tm) vals - data.frame(f1=1, s1=.5, Tm=2) e - sapply(mat, proc) sapply(e, eval, vals) The last line should give: sapply(e, eval, vals) [1] 0.00 0.25 On Fri, Jan 29, 2010 at 11:51 AM, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: Hallo I'm having trouble figuring out how to evaluate an expression when one of the variables in the expression is defined separately as a sub expression. Here's a simplified example mat - expression(0, f1*s1*g1) # vector of formulae g1 - expression(1/Tm) # expansion of the definition of g1 vals - data.frame(f1=1, s1=.5, Tm=2) # one set of possible values for variables before adding this sub expression
[R] evaluating expressions with sub expressions
Hallo I'm having trouble figuring out how to evaluate an expression when one of the variables in the expression is defined separately as a sub expression. Here's a simplified example mat - expression(0, f1*s1*g1) # vector of formulae g1 - expression(1/Tm) # expansion of the definition of g1 vals - data.frame(f1=1, s1=.5, Tm=2) # one set of possible values for variables before adding this sub expression I was using the following to evaluate mat sapply(mat, eval, vals) Obviously I could manually substitute in 1/Tm for each g1 in the definition of mat, but the actual expression vector is much longer, and the sub expression more complicated. Also, the subexpression is often adjusted for different scenarios. Is there a simple way of changing this or redefining mat so that I can define g1 like a macro to be used in the expression vector. Thanks! Jennifer __ R-help@r-project.org mailing list 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.
Re: [R] evaluating expressions with sub expressions
Hmm I *think* this will work, but may break in a further sub routine. It certainly works in this example, but my expression vector is used in many scenarios and it will take a while to check them all. For instance, I take the derivative of each element with respect to each variable using sapply(mat, deriv, names(vals)) This bit seems to still work, but I'd welcome a solution that doesn't change the structure of the expression vector to a list, just in case. Thanks for this solution. Hi, Would this do as an alternative syntax? g1 - quote(1/Tm) mat - list(0, bquote(f1*s1*.(g1))) vals - data.frame(f1=1, s1=.5, Tm=2) sapply(mat, eval, vals) HTH, baptiste On 29 January 2010 17:51, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: Hallo I'm having trouble figuring out how to evaluate an expression when one of the variables in the expression is defined separately as a sub expression. Here's a simplified example mat - expression(0, f1*s1*g1) # vector of formulae g1 - expression(1/Tm) # expansion of the definition of g1 vals - data.frame(f1=1, s1=.5, Tm=2) # one set of possible values for variables before adding this sub expression I was using the following to evaluate mat sapply(mat, eval, vals) Obviously I could manually substitute in 1/Tm for each g1 in the definition of mat, but the actual expression vector is much longer, and the sub expression more complicated. Also, the subexpression is often adjusted for different scenarios. Is there a simple way of changing this or redefining mat so that I can define g1 like a macro to be used in the expression vector. Thanks! Jennifer __ R-help@r-project.org mailing list 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. __ R-help@r-project.org mailing list 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.
Re: [R] shared axes in multipanel plot
splendid! This worked well, but there are two oddities that I can't resolve. 1. In the real data, the baseline is a cumulative probability plot (from simulations) rather than the straight line. The panel.lines plots this curve, but seems to join the first and last points together. panel.points(x, baseline, type=l) did the same. I checked that the vector is indeed sorted properly, so I'm not sure why it should connect the first point to the last. 2. The screens are correctly labeled, but in the wrong order (left to right, top to bottom: 3,4,1,2). Is this easily corrected? I've been cowardly avoiding learning xyplot() so thanks for the jumpstart! Try this using xyplot.zoo in the zoo package. We define the baseline and a panel function. The panel function just performs the default action to display the graphs and adds the baseline. The screens variable is 1,1,2,2,3,3,4,4. We create a zoo object from dat and use screens to name the columns according to their group. Finally we call xyplot.zoo passing it screens so that the successive columns go in the indicated panels and also passing the other items. See ?xyplot.zoo in zoo and ?xyplot in lattice. library(zoo) library(lattice) baseline - 1:nrow(dat)/nrow(dat) pnl - function(x, ...) { panel.plot.default(x, ...) panel.lines(x, baseline, lwd = 2, col = grey(0.5)) } nc - ncol(dat) screens - rep(1:(nc/2), each = 2) z - zoo(dat) colnames(z) - paste(Group, screens) xyplot(z, screens = screens , layout = c(2, 2), col = black, lty = 2, scales = list(y = list(relation = same)), panel = pnl) On Fri, Dec 11, 2009 at 10:02 AM, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: Hello I've created a function to make a plot with multiple pannels from columns of data that are created in a previous function. In the example below the number of columns is 8, giving 4 pannels, but in general it takes data with any number of columns and figures out a nice layout. The panels all have the same axes, and so I wonder what functions are avialable to create axes only on the left and bottom of the whole plot rather than each pannel. I'd really like a generic way to do this for any number of plots, but was even having trouble figuring out how to do it manually for this example; How are pannels referred to, in a layout context? That is, how do I say, if(current.pannel==4) {do stuff} Here's a simple version of the code. baseline - (1:20)/20 #example data dat1 - matrix(baseline,20,8) dat - dat1+matrix(rnorm(20*8)/30, 20,8) nstrat - ncol(dat) rows - ceiling(nstrat/4) layout(matrix(1:(rows*2), rows, 2, T)) par(oma=c(4,4,3,1)) par(mar=c(1,1,0,1)) for(i in which(1:nstrat%%2!=0)){ plot(baseline, type=l, col=grey, lwd=2, xlab=, ylab=, ylim=c(0,1), xaxt='n', yaxt='n') axis(1, labels=F); axis(2, labels=F) points(dat[,i], type=l, lty=2) points(dat[,i+1], type=l, lty=2) } Thank you muchly Jennifer Young PS: I am a subscriber, but can't for the life of me figure out how to send an email while logged in so that the moderators don't have to take the time to read it over. I always get the please wait while we check it over email. Likely I'm being dumb. __ R-help@r-project.org mailing list 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. __ R-help@r-project.org mailing list 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.
Re: [R] extracting vectors from lists of lists
This is just the thing. The former version I would never have guessed, but the function(x) version is much more intuitive. Does there exist some section of some manual where these sorts of things are explained? I find that figuring out how to access parts of output is the trickiest thing in R. For instance, it took me ages to figure out that to extract the actual derivative from the output of x-deriv() you have to use attr(x, gradient). Thanks also to David and Benilton, who also replied with the same solution; I received all 3 responses within 10 minutes of asking the question! Jennifer - Does this do what you want? v1 = sapply(output,'[[','vec') v2 = sapply(output,'[[','other') v1 [,1] [,2] [1,]16 [2,]27 [3,]38 [4,]49 [5,]5 10 v2 [1] stuff stuff (in more readable form: v1 = sapply(output,function(x)x$vec) v2 = sapply(output,function(x)x$other)) Notice that if the objects returned by sapply are not conformable, it will return its result in a list. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Fri, 11 Dec 2009, Jennifer Young wrote: Good evening I often have as output from simulations a list of various values, vectors and matrices. Supposing that I then run said simulation several times, I often want to extract a particular result from each simulation for plotting and, ideally, put it in a matrix. A simple example v1 - 1:5 v2 - 6:10 other1 - stuff other2 - stuff set1 - list(v1,other1) names(set1) - c(vec,other) set2 - list(v2,other2) names(set2) - c(vec,other) output - list(set1, set2) Is there some form of lapply() that will allow me to extract v1 and v2 (ie, the $vec elements) from both sets? Bonus if I can then put it into a matrix tidily. many thanks Jennifer Young __ R-help@r-project.org mailing list 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. __ R-help@r-project.org mailing list 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.
Re: [R] shared axes in multipanel plot
On Mon, Dec 14, 2009 at 11:30 AM, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: splendid! This worked well, but there are two oddities that I can't resolve. 1. In the real data, the baseline is a cumulative probability plot (from simulations) rather than the straight line. The panel.lines plots this curve, but seems to join the first and last points together. panel.points(x, baseline, type=l) did the same. I checked that the vector is indeed sorted properly, so I'm not sure why it should connect the first point to the last. I can't reproduce the problem based on this description. sorry that was lazy of me. If you modify the code you gave me as follows (with an extra line of the sqare root of baseline, as an example) the first and last points are joined. I didn't notice this before when baseline was just a line. baseline - (1:20)/20 dat1 - matrix(baseline,20,8) dat - dat1+matrix(rnorm(20*8)/30, 20,8) b2-sqrt(baseline) pnl - function(x, ...) { panel.plot.default(x, ...) panel.lines(x, baseline, lwd = 2, col = grey(0.5)) panel.lines(x, b2) } nc - ncol(dat) screens - rep(1:(nc/2), each = 2) z - zoo(dat) colnames(z) - paste(Group, screens) xyplot(z, screens = screens , layout = c(2, 2), col = black, lty = 2, scales = list(y = list(relation = same)), panel = pnl) 2. The screens are correctly labeled, but in the wrong order (left to right, top to bottom: 3,4,1,2). Is this easily corrected? xyplot(..., as.table = TRUE) will give one reordering. Another possibility is: plt - xplot(...) plt[ix] where ix is a permutation of 1:4 as.table=TRUE did the trick thanks. __ R-help@r-project.org mailing list 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.
Re: [R] shared axes in multipanel plot
Ah, I think i see the problem. The default plot recognizes there is one set of x for each set of y, but since there were two vectors in the default.plot, the x vector is repeated and loops around for the lines part. Presumably the default plot uses your recursive plot automatically. At any rate, it seems that this simpler version (with your unique(x) solution) also works and avoids the recursion. pnl - function(x, y, ...) { tt - unique(x) panel.plot.default(x,y, ...) panel.lines(tt, baseline, lwd = 2, col = grey(0.5)) } Thanks for your time!! One resolution of the need to go outside of pnl would be to use this line: tt - unique(x) in place of tt - time(z). That would overcome the objection that the pnl function is not self contained. On Mon, Dec 14, 2009 at 3:44 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this: You seem to have found a problem. At any rate try this instead: pnl - function(x, y, ...) { tt - time(z) y - matrix(y, length(tt)) for(j in 1:ncol(y)) panel.plot.default(tt, y[,j], ...) panel.lines(tt, baseline, lwd = 2, col = grey(0.5)) panel.lines(tt, b2) } On Mon, Dec 14, 2009 at 3:19 PM, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: On Mon, Dec 14, 2009 at 11:30 AM, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: splendid! This worked well, but there are two oddities that I can't resolve. 1. In the real data, the baseline is a cumulative probability plot (from simulations) rather than the straight line. The panel.lines plots this curve, but seems to join the first and last points together. panel.points(x, baseline, type=l) did the same. I checked that the vector is indeed sorted properly, so I'm not sure why it should connect the first point to the last. I can't reproduce the problem based on this description. sorry that was lazy of me. If you modify the code you gave me as follows (with an extra line of the sqare root of baseline, as an example) the first and last points are joined. I didn't notice this before when baseline was just a line. baseline - (1:20)/20 dat1 - matrix(baseline,20,8) dat - dat1+matrix(rnorm(20*8)/30, 20,8) b2-sqrt(baseline) pnl - function(x, ...) { panel.plot.default(x, ...) panel.lines(x, baseline, lwd = 2, col = grey(0.5)) panel.lines(x, b2) } nc - ncol(dat) screens - rep(1:(nc/2), each = 2) z - zoo(dat) colnames(z) - paste(Group, screens) xyplot(z, screens = screens , layout = c(2, 2), col = black, lty = 2, scales = list(y = list(relation = same)), panel = pnl) 2. The screens are correctly labeled, but in the wrong order (left to right, top to bottom: 3,4,1,2). Is this easily corrected? xyplot(..., as.table = TRUE) will give one reordering. Another possibility is: plt - xplot(...) plt[ix] where ix is a permutation of 1:4 as.table=TRUE did the trick thanks. __ R-help@r-project.org mailing list 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.
[R] shared axes in multipanel plot
Hello I've created a function to make a plot with multiple pannels from columns of data that are created in a previous function. In the example below the number of columns is 8, giving 4 pannels, but in general it takes data with any number of columns and figures out a nice layout. The panels all have the same axes, and so I wonder what functions are avialable to create axes only on the left and bottom of the whole plot rather than each pannel. I'd really like a generic way to do this for any number of plots, but was even having trouble figuring out how to do it manually for this example; How are pannels referred to, in a layout context? That is, how do I say, if(current.pannel==4) {do stuff} Here's a simple version of the code. baseline - (1:20)/20#example data dat1 - matrix(baseline,20,8) dat - dat1+matrix(rnorm(20*8)/30, 20,8) nstrat - ncol(dat) rows - ceiling(nstrat/4) layout(matrix(1:(rows*2), rows, 2, T)) par(oma=c(4,4,3,1)) par(mar=c(1,1,0,1)) for(i in which(1:nstrat%%2!=0)){ plot(baseline, type=l, col=grey, lwd=2, xlab=, ylab=, ylim=c(0,1), xaxt='n', yaxt='n') axis(1, labels=F); axis(2, labels=F) points(dat[,i], type=l, lty=2) points(dat[,i+1], type=l, lty=2) } Thank you muchly Jennifer Young PS: I am a subscriber, but can't for the life of me figure out how to send an email while logged in so that the moderators don't have to take the time to read it over. I always get the please wait while we check it over email. Likely I'm being dumb. __ R-help@r-project.org mailing list 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.
[R] extracting vectors from lists of lists
Good evening I often have as output from simulations a list of various values, vectors and matrices. Supposing that I then run said simulation several times, I often want to extract a particular result from each simulation for plotting and, ideally, put it in a matrix. A simple example v1 - 1:5 v2 - 6:10 other1 - stuff other2 - stuff set1 - list(v1,other1) names(set1) - c(vec,other) set2 - list(v2,other2) names(set2) - c(vec,other) output - list(set1, set2) Is there some form of lapply() that will allow me to extract v1 and v2 (ie, the $vec elements) from both sets? Bonus if I can then put it into a matrix tidily. many thanks Jennifer Young __ R-help@r-project.org mailing list 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.
[R] default borders in boxplot and barplot
This is my first post so hopefully I haven't mucked up the rules. I'm trying to change the default borders in either boxplot or barplot so that, at the request of a journal, all of my figures have the same type of border. I've successfully used par(bty=o) using plot(1:10, bty=o), but it seems that barplot and boxplot have their own defaults that override this. I've tried both par( bty=o) barplot(stuff) and barplot(stuff, bty=o) Does anyone know a trick that doesn't involve using abline() to force borders? Thanks Jen Young, MSc __ R-help@r-project.org mailing list 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.
[R] R version of MATLAB symbolic toolbox (variable substitution)
I'm translating some MATLAB code into R and have not found a simple equivalent of the function R = subs(S,old,new). I have, for example, a matrix such as this mx- function(){ matrix( c(0, f1, f2, s1, 0, 0, 0, s2, 0), 3,3, byrow=T) } and a matrix of data dat-matrix(c(1,2,3,4,2,3,4,5),2,4, byrow=T, dimnames-list(NULL, c(f1,f2,s1,s2))) I want to do two things with this matrix that seem to require different formats. 1. evaluate this matrix many times using data from a matrix (for stochastic simulation). In the function form above, I can use attach(as.data.frame(dat)) and the correct variables are fed to mx, but I'd rather avoid using attach if possible. 2. I also want to manipulate the matrix (i.e., take the derivative of each element with respect to a certain parameter). If I use mx-c(0, expression(f1), expression(f2)) etc then I can use deriv(mx[2], c(f1,f2)) etc to take the derivatives. BUT, I can't find how to then evaluate this version (in one line) for a row of data in dat. f1-2 f2-4 eval(mx) gives the scalar 4 (the last element of mx) rather than the vector. I haven't come up with a form for mx that achieves both goals, while the symbolic toolbox can do each in one line of code. Does a clone package exist? I didn't see anything useful in R's Matlab package. In lieu of such a package I'll settle for being able to evaluate a vector of expressions. Probably I'm missing simple syntax here. Thanks in advance, Jen Young __ R-help@r-project.org mailing list 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.