[R] How to draw a line in plot when I know the start point(x1, y1) and end point(x2, y2)?
Hello all, How to draw a line in plot when I know the start point(x1,y1) and end point(x2,y2)? I need make this as additional information in the graph: plot(wl2[[1]],wl2[[2]]) I think that is possible make this with the function abline(), is possible? I looked the function lines() too, but don't understand as make. Thanks! Lesandro Veja quais são os assuntos do momento no Yahoo! +Buscados [[alternative HTML version deleted]] __ 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] How to force R to print 2 decimal places in column of a data.frame?
How to force R to print 2 decimal places in column of a data.frame? I tried to do so: x = inp(format(rounf(inp$Tamanho, 2), nsmall = 2),) where INP is data.frame and Size is the name of column. But has error: Error in eval.with.vis(expr, envir, enclos) : could not find function inp Lesandro Veja quais são os assuntos do momento no Yahoo! +Buscados http://br.maisbuscados.yahoo.com __ 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] How to force R to print 2 decimal places in column of a data.frame?
Hi Marc Schwartz, Your suggestion solved my problem. Thanks you. --- Em qui, 11/6/09, Marc Schwartz marc_schwa...@me.com escreveu: De: Marc Schwartz marc_schwa...@me.com Assunto: Re: [R] How to force R to print 2 decimal places in column of a data.frame? Para: Lesandro lesand...@yahoo.com.br Cc: r-help@r-project.org Data: Quinta-feira, 11 de Junho de 2009, 15:45 On Jun 11, 2009, at 11:48 AM, Lesandro wrote: How to force R to print 2 decimal places in column of a data.frame? I tried to do so: x = inp(format(rounf(inp$Tamanho, 2), nsmall = 2),) where INP is data.frame and Size is the name of column. But has error: Error in eval.with.vis(expr, envir, enclos) : could not find function inp Lesandro Your code and description above appear to have some typos in it and the use of the round() and format() functions are not what you want here. You code has inp(...), where R is presuming that you are referring to a function called 'inp', hence the error message, since the function does not exist. Better to use sprintf() with an appropriate format specifier: set.seed(1) vec - rnorm(10) vec [1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 [7] 0.4874291 0.7383247 0.5757814 -0.3053884 sprintf(%.2f, vec) [1] -0.63 0.18 -0.84 1.60 0.33 -0.82 0.49 0.74 [9] 0.58 -0.31 See ?sprintf for more information. Note that the presumption here is that you want to output the numeric values to a formatted character vector for display purposes, perhaps in a table, etc. So if your actual data frame is called 'INP' and the column is called 'Size', you would use: sprintf(%.2f, INP$Size) HTH, Marc Schwartz Veja quais são os assuntos do momento no Yahoo! +Buscados http://br.maisbuscados.yahoo.com __ 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] How to order an data.table by values of an column?
Hello! Can you help me? How to order an data.table by values of an column? Per example: Table no initial Categ Perc 468 31.52 351 27.52 0 0.77 234 22.55 117 15.99 table final Categ Perc 0 0.77 117 15.99 234 22.55 351 27.52 468 31.52 Lesandro Veja quais são os assuntos do momento no Yahoo! +Buscados [[alternative HTML version deleted]] __ 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.