[R] [beginner] how to run *.r script from graphic interface (R Console window) ?
Is there a fuction like open("path/to/file"), readfile or sth like that that would run code from R file just like I was it typing myself into R Console window ? -- View this message in context: http://r.789695.n4.nabble.com/beginner-how-to-run-r-script-from-graphic-interface-R-Console-window-tp3052326p3052326.html Sent from the R help mailing list archive at Nabble.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] display data as 1px dots in scatterplot ?
By default scatter-plot presents data by using circles, is there a way to make it 1px dots ? -- View this message in context: http://r.789695.n4.nabble.com/display-data-as-1px-dots-in-scatterplot-tp3052343p3052343.html Sent from the R help mailing list archive at Nabble.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] "negative alpha" or custom gradient colors of data dots in scatterplot ?
I know that by setting alpha to for example col = rgb(0, 0, 0, 0.1) it is possible to see how many overlapping is in the plot. But disadvantage of it is that single points are barely visible on the background. So I wonder if there is possible to make setting that single points would be almost black, but with more and more data on the same spot it would get more and more whiteish. Or maybe it is possible to make sole data points black but overlapped tending to some particular color of choice ? -- View this message in context: http://r.789695.n4.nabble.com/negative-alpha-or-custom-gradient-colors-of-data-dots-in-scatterplot-tp3052394p3052394.html Sent from the R help mailing list archive at Nabble.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] [beginner] simple keyword to exit script ?
I have tried quit(), and return() but first exits from whole graphical interface and second is only for functions. What I need only to exit from current script and return to the console. -- View this message in context: http://r.789695.n4.nabble.com/beginner-simple-keyword-to-exit-script-tp3052417p3052417.html Sent from the R help mailing list archive at Nabble.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] [beginner] simple keyword to exit script ?
I try to use stop(), but i get: Error in eval.with.vis(expr, envir, enclos) : -- View this message in context: http://r.789695.n4.nabble.com/beginner-simple-keyword-to-exit-script-tp3052417p3052430.html Sent from the R help mailing list archive at Nabble.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] plot(x,y xlab=NULL,ylab=NULL) but labels still visible.
Labels are still present on graph render, their names are x and y that is the same as I used on the variables to supply data for chart. How to get rid of them. -- View this message in context: http://r.789695.n4.nabble.com/plot-x-y-xlab-NULL-ylab-NULL-but-labels-still-visible-tp3052439p3052439.html Sent from the R help mailing list archive at Nabble.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] plot(x,y xlab=NULL,ylab=NULL) but labels still visible.
here's the code x= c(1,5,7,3,4) y= c(2,4,5,2,5) plot(x,y,ylim=c(-20,20),xlim=c(min(x),max(x)),pch='X',col = rgb(0, 0, 0, 0.5), xaxt=NULL,yaxt=NULL, xlab=NULL,ylab=NULL) and x and y are still visible -- View this message in context: http://r.789695.n4.nabble.com/plot-x-y-xlab-NULL-ylab-NULL-but-labels-still-visible-tp3052439p3052482.html Sent from the R help mailing list archive at Nabble.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 get rid of unused space on all 4 borders in plot() render
x= c(1,5,7,-3,4) y= c(2,4,-5,2,5) plot(x,y,ylim=c(-20,20),xlim=c(min(x),max(x)),pch='X',col = rgb(0, 0, 0, 0.5),yaxt="n", ann=FALSE) and this code produces: http://i53.tinypic.com/ffd7d3.png Where I marked in red areas that I want to get rid of and use as much real screen estate as I can. -- View this message in context: http://r.789695.n4.nabble.com/how-to-get-rid-of-unused-space-on-all-4-borders-in-plot-render-tp3052527p3052527.html Sent from the R help mailing list archive at Nabble.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] [beginner] simple keyword to exit script ?
Is there any way of suppressing that error, like in other programming languages you can specifically invoke an error or simply exit, like after user input, exiting then is not always identical with error , there are cases when it is intended behavior. I thought R makes that distinction. -- View this message in context: http://r.789695.n4.nabble.com/beginner-simple-keyword-to-exit-script-tp3052417p3052464.html Sent from the R help mailing list archive at Nabble.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 get rid of unused space on all 4 borders in plot() render
I have looked into par documentation, and only setting for size of the plot area was pin. But this setting sets the area as inflexible, that is no matter how I make the window small or big it stays the same. Default value has advantage that however it uses plot area that is always smaller than device area still this area is changing with the window and able to be bigger. -- View this message in context: http://r.789695.n4.nabble.com/how-to-get-rid-of-unused-space-on-all-4-borders-in-plot-render-tp3052527p3052631.html Sent from the R help mailing list archive at Nabble.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 get rid of unused space on all 4 borders in plot() render
# 89 px / 105 px - wasted space png("d:/test.png",width=1369,height=1129,units="px") par(bg='black',fg='gray',col='gray',col.axis='gray',col.lab='gray',col.main='gray',col.sub='gray') plot(x,y,ylim=c(-20,20),xlim=c(min(x),max(x)),pch='.',col = rgb(1,1,1, 0.5),yaxt="n", ann=FALSE) dev.off() so only "hack" that I thought of is to save graph to a file with dimensions exceeding my need in exact amount to balance the black space and after that do auto-crop function in graphic program original: http://i55.tinypic.com/qzitqq.png cropped: http://i53.tinypic.com/29ntu75.png -- View this message in context: http://r.789695.n4.nabble.com/how-to-get-rid-of-unused-space-on-all-4-borders-in-plot-render-tp3052527p3052675.html Sent from the R help mailing list archive at Nabble.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] is it possible to put tick labels inside plotting area ?
here is what i mean: before: http://i51.tinypic.com/117xv6v.png after : http://i51.tinypic.com/sv2xed.png -- View this message in context: http://r.789695.n4.nabble.com/is-it-possible-to-put-tick-labels-inside-plotting-area-tp3052777p3052777.html Sent from the R help mailing list archive at Nabble.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] is it possible to put tick labels inside plotting area ?
I found it. It was hard to find because no one asked about it , the proper question was about distance from the axis which can be negative. So the proper answer is : par( mgp = c(0, -1.4, 0) ) - only the center value is controlling feature in question. -- View this message in context: http://r.789695.n4.nabble.com/is-it-possible-to-put-tick-labels-inside-plotting-area-tp3052777p3052793.html Sent from the R help mailing list archive at Nabble.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 get rid of unused space on all 4 borders in plot() render
finally I found what I wanted, John Kane send it, and I don't know why it hasn't been posted automatically to the list so I post it by myself: solution is this: par(mai=c(.5,.5,.5,.5)) These four numbers are the margins, so setting it to 0,0,0,0 will render only plot area with 1px for box on every edge -- View this message in context: http://r.789695.n4.nabble.com/how-to-get-rid-of-unused-space-on-all-4-borders-in-plot-render-tp3052527p3052705.html Sent from the R help mailing list archive at Nabble.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] "unexpected numeric constant" while reading tab delimited csv file
my csv file is very simple - just one line for purpose of this test: 0{TAB}0 and read function is this: csvdata = read.csv(file="d:/s/test.csv",head=FALSE,sep="\t") then error comes: Error in source("d:/test.csv") : d:/test.csv:1:9: unexpected numeric constant 1: 0 0 but when I change delimiter to ; (colon) then error not shows up anymore -- View this message in context: http://r.789695.n4.nabble.com/unexpected-numeric-constant-while-reading-tab-delimited-csv-file-tp3053252p3053252.html Sent from the R help mailing list archive at Nabble.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] "unexpected numeric constant" while reading tab delimited csv file
the problem shows up only in console when script is loaded thru source() and separator character is eighter tab or space, strangely, when I'm running script directly form file in text environment everything is ok. [I'm reposing this because my previous post didn't get on the list because double quote character at the beginning of a subject was eaten up when Re: was added, now everything should be ok ]] -- View this message in context: http://r.789695.n4.nabble.com/unexpected-numeric-constant-while-reading-tab-delimited-csv-file-tp3053252p3053291.html Sent from the R help mailing list archive at Nabble.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] xlim=c(min(x), max(x)) still produces extra margin on both sides of x axis in plot()
code: op <- par(bg='black',fg='gray',col='gray',col.axis='gray',col.lab='gray',col.main='gray',col.sub='gray',mai=c(0,0,0,0), tck = 0.01, mgp = c(0, -1.4, 0), mar=c(0,0,0,0)) plot(x,y,ylim=c(-20,20),xlim=c(min(x),max(x)),pch='X',col = rgb(1,1,1, 0.5),yaxt="n", ann=FALSE) abline(v=c(min(x),max(x)), lty=3, col="yellow") par <- op render: http://i51.tinypic.com/2rz9w0h.png So what I mean is the area between yellow lines and edges of the plotting area, so min(x) and max(x) would be really on the edge of the plot. -- View this message in context: http://r.789695.n4.nabble.com/xlim-c-min-x-max-x-still-produces-extra-margin-on-both-sides-of-x-axis-in-plot-tp3053356p3053356.html Sent from the R help mailing list archive at Nabble.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] xlim=c(min(x), max(x)) still produces extra margin on both sides of x axis in plot()
i found solution myself: par(xaxs = "i", yaxs = "i") - it sets axis ranges to actual data ranges sorry for question but maybe this will be easier to find if someone would be searching for this -- View this message in context: http://r.789695.n4.nabble.com/xlim-c-min-x-max-x-still-produces-extra-margin-on-both-sides-of-x-axis-in-plot-tp3053356p3053365.html Sent from the R help mailing list archive at Nabble.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] "unexpected numeric constant" while reading tab delimited csv file
The folder are the same, I just deleted the long path because it is irrelevant and by mistake left /s i one of the paths, they should be identical. I'm running this package: http://cran.r-project.org/bin/windows/base/R-2.12.0-win.exe on win xp 32 bit -- View this message in context: http://r.789695.n4.nabble.com/unexpected-numeric-constant-while-reading-tab-delimited-csv-file-tp3053252p3053370.html Sent from the R help mailing list archive at Nabble.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 sample lowess/loess into matrix ?
code: x <- rnorm(32) y <- rnorm(32) plot(x,y) lines(lowess(x,y),col='red') Now I need to sample the lowess function into matrix where one series will be X and other will be values of lowess at particular X. -- View this message in context: http://r.789695.n4.nabble.com/how-to-sample-lowess-loess-into-matrix-tp3053458p3053458.html Sent from the R help mailing list archive at Nabble.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 sample lowess/loess into matrix ?
I found it, it was SO simple: lowessline <- lowess(x,y) write.csv(lowessline, "loess.csv") -- View this message in context: http://r.789695.n4.nabble.com/how-to-sample-lowess-loess-into-matrix-tp3053458p3053601.html Sent from the R help mailing list archive at Nabble.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 round only one column of a matrix ?
round() function affects all values of a matrix, I want only to round column that is called 'y'. -- View this message in context: http://r.789695.n4.nabble.com/how-to-round-only-one-column-of-a-matrix-tp3054363p3054363.html Sent from the R help mailing list archive at Nabble.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] I need a very specific unique like function and I don't know even how to properly call this
consider this matrix: [,1] [,2] [1,]3 7 [2,]6 5 [3,]7 5 [4,]3 5 [5,]7 5 [6,]5 5 [7,]8 4 [8,]2 4 [9,]7 4 [10,]0 6 I need to delete all rows where column 2 above and below has the same value, so the effect would be: [,1] [,2] [1,]3 7 [2,]6 5 [6,]5 5 [7,]8 4 [9,]7 4 [10,]0 6 is there a built in function for that kind of operation or I must write one from scratch ? Is there a name for that kind of operation ? -- View this message in context: http://r.789695.n4.nabble.com/I-need-a-very-specific-unique-like-function-and-I-don-t-know-even-how-to-properly-call-this-tp3054427p3054427.html Sent from the R help mailing list archive at Nabble.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] "negative alpha" or custom gradient colors of data dots in...
Well I "hacked" it i maybe not so elegant way: x <- rnorm(10) y <- rnorm(10) png('out.png',width=600,height=500,units="px") op <- par(bg='black',fg='gray',col='gray',col.axis='gray',col.lab='gray',col.main='gray',col.sub='gray',mai=c(0,0,0,0), tck = 0.01, mgp = c(0, -1.4, 0), xaxs = "i", yaxs = "i") plot(x,y,ylim=c(-20,20),xlim=c(min(x),max(x)),pch='.',col = rgb(1,1,1,1),yaxt="n", ann=FALSE) # here is the solution - plot the same data with low alpha and different color blue is best because is perceived as darkest points(x,y,col = rgb(0,0,1,0.1),pch='.') abline(h=0, lty=3, col="green") abline(v=0, lty=3, col="green") par <- op http://i51.tinypic.com/maxmcl.png [[repost, because subject was deleted and this message won't get into the list]] -- View this message in context: http://r.789695.n4.nabble.com/negative-alpha-or-custom-gradient-colors-of-data-dots-in-scatterplot-tp3052394p3054465.html Sent from the R help mailing list archive at Nabble.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] what is this averaging function called ?, has R a built in function for it ?
I know little of statistics and have created this function out of intuition. But since this algorithm is so basic I wonder what is the proper name of this function and is it build in R. here is some code in PHP to illustrate what the function is doing, it uses some function I created but the meaning is obvious: #get csv file and interchange rows with columns to get two arrays $csv = aic(getcsv(file_get_contents("out.csv"))); #now those arrays contained in one bigger array are sorted array_multisort($csv[0],SORT_NUMERIC,$csv[1],SORT_NUMERIC); #second array is created and values that will be put on x or 0 axis are made unique with every y or 1 # value is going into array under x/0 it will be used after to make mean arithmetic, geometric or harmonic foreach ($csv[0] as $k=>$x) { $sum[$x][] = $csv[1][$k]; } #the x values are put on other array for later use $x = array_keys($sum); $rang = $sum = array_values($sum); #and here is the key feature, to smooth the line the function looks for (in this case) 500 values above and beond given value # if they exist of course, the search stops when search goes outside the array # the search also stop when number of gathered values goes beyond 500 or next value that would be added will be making # this value more than 500, you can imagine that there could be a large spike in data and this would be affecting points near # if this precaution haven't been conceived foreach ($rang as $k=>&$v) { if (!($k % 100)) echo $k.' '; $up = $down = array(); $walk = 0; while (true) { ++$walk; if (isset($sum[$k-$walk]) and count($v)+count($up)+count($sum[$k-$walk])<500) $up = array_merge($up,$sum[$k-$walk]); else break; } $walk = 0; while (true) { ++$walk; if (isset($sum[$k+$walk]) and count($v)+count($down)+count($sum[$k+$walk])<500) $down = array_merge($down,$sum[$k+$walk]); else break; } $rang[$k] = array_merge($up,$rang[$k],$down); # after gathering data for given point it makes a mean, in this case arithmetic $rang[$k] = array_sum($rang[$k])/count($rang[$k]); } # now the array with x values can be added and fipped array is ready to go to a file $csv = aic(array($x,$rang)); # in php this is awfully slow but I like it because it is sensitive for the densiti of the data and to not goes away in strange # directions when data density becomes very low -- View this message in context: http://r.789695.n4.nabble.com/what-is-this-averaging-function-called-has-R-a-built-in-function-for-it-tp3072826p3072826.html Sent from the R help mailing list archive at Nabble.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] what is this averaging function called ?, has R a built in function for it ?
my input is from csv file: fname= 'test' csvdata = read.table(file=paste(fname,'.csv',sep=''),head=FALSE) x = csvdata$V1 y = csvdata$V2 I know that this group is not about php , but I managed to make function from above a lot faster, and I'm still cannot operate R at a sufficient level to recreate in in this language. Fit function in R that kinda resembles it is smooth.spline, but that function seems to go in a strange directions when data density becomes low But I think I would get desired behaviour in smooth.spline if for x axis I put matrix of simple 1,2,3 sequence here is revised php code: function smooth($in,$smooth=500) { if (count(current($in))!=2) exit('wrong array'); timer(); foreach($in as &$v) { $v[0] = (string)$v[0]; if (!isset($y[$v[0]])) { $y[$v[0]] = 0; $z[$v[0]] = 0; } $y[$v[0]] += $v[1]; ++$z[$v[0]]; } unset($in); ksort($y, SORT_NUMERIC); ksort($z, SORT_NUMERIC); $x = array_keys($z); $y = array_values($y); $z = array_values($z); $count = count($z); echo n.$count.' : '; for ($k=0;$k<$count;++$k) { if (!($k % 1000)) echo $k.' '; $u = $d = 0; $usum = $dsum = 0; $walk = 0; while (true) { ++$walk; if (isset($z[$k-$walk]) and $z[$k]+$z[$k-$walk]+$usum<$smooth) { $usum += $z[$k-$walk]; $u += $y[$k-$walk]; } else break; } $walk = 0; while (true) { ++$walk; if (isset($z[$k+$walk]) and $z[$k]+$z[$k+$walk]+$dsum<$smooth) { $dsum += $z[$k+$walk]; $d += $y[$k+$walk]; } else break; } $out[$k] = ($y[$k]+$u+$d)/($z[$k]+$usum+$dsum); } echo ' : '.timer().n; return array($x,$out); } -- View this message in context: http://r.789695.n4.nabble.com/what-is-this-averaging-function-called-has-R-a-built-in-function-for-it-tp3072826p3076215.html Sent from the R help mailing list archive at Nabble.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] increase or decrease variable by 1
many languages have shorthands for that operation like: variable += 1 or ++variable is there something like that in R ? -- View this message in context: http://r.789695.n4.nabble.com/increase-or-decrease-variable-by-1-tp3076390p3076390.html Sent from the R help mailing list archive at Nabble.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] please show me simple example how to plot
Well, maybe I didn't write it clear. I know how to create scatterplot, and how to import data from csv file. But I do not know how to add this fitting that mentioned in sumbject to a plot. I do not know for what function name to look for in R. I played some time with ls, and it didn't create a line. I know the name for the fitting I ned from Statistica, and this is from help from this program: "A curve is fitted to the XY coordinate data according to the distance-weighted least squares smoothing procedure (the influence of individual points decreases with the horizontal distance from the respective points on the curve). For more information, see Distance-Weighted Least Squares." Now I need to recreate it in R. Sorry again for not being clear. -- View this message in context: http://r.789695.n4.nabble.com/please-show-me-simple-example-how-to-plot-Distance-Weighted-Least-Squares-fitting-tp3076824p3076863.html Sent from the R help mailing list archive at Nabble.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] please show me simple example how to plot "Distance-Weighted Least Squares" fitting
I got simple x,y pairs of data and simple scatterplot and just cannot figure how to do it , there are many examples but always there is error popping out please show me an example stripped with additional data just core of what I need to do to get this damn line -- View this message in context: http://r.789695.n4.nabble.com/please-show-me-simple-example-how-to-plot-Distance-Weighted-Least-Squares-fitting-tp3076824p3076824.html Sent from the R help mailing list archive at Nabble.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 get vector of data from line ?
I have created a density line d<- density(X) now I need to read values from that line for example what is the value of this line at x = 1, 2, 3 etc... -- View this message in context: http://r.789695.n4.nabble.com/how-to-get-vector-of-data-from-line-tp3076943p3076943.html Sent from the R help mailing list archive at Nabble.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 get vector of data from line ?
well, I found id the simplest answer is: d<- approx(density(x),xout=...) where xout is a vector of the points where the data should be sampled -- View this message in context: http://r.789695.n4.nabble.com/how-to-get-vector-of-data-from-line-tp3076943p3077058.html Sent from the R help mailing list archive at Nabble.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] longer object length is not a multiple of shorter object length
In datamatrix[, "y"] == datamatrix[, "y"][-1] : longer object length is not a multiple of shorter object length out = c(FALSE,datamatrix[,'y'] == datamatrix[,'y'][-1]) and I do not know why I get that error, the resulting out matrix is somehow one row larger than datamatrix... all I try to do is filter matrix by dropping rows where [,'y'][-1] == [,'y'][+1] -- View this message in context: http://r.789695.n4.nabble.com/longer-object-length-is-not-a-multiple-of-shorter-object-length-tp3077400p3077400.html Sent from the R help mailing list archive at Nabble.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 find smallest non-negative and biggest non-positive number in a matrix column ?
so it could be zero in both cases when given column has 0 set in it -- View this message in context: http://r.789695.n4.nabble.com/how-to-find-smallest-non-negative-and-biggest-non-positive-number-in-a-matrix-column-tp3077870p3077870.html Sent from the R help mailing list archive at Nabble.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 strip list from NA values looking only at one column ?
I have got a list with 3 colums x,y,z, now I want do delete whole rows where column z has NA values I am not intereted in x and y columns if there are also NA values or not, moreover I do not want to touch them because if there would be NA that would mean a more serious error for me, and I have cath for that somewhere else I am asking because I only saw an example where function loops over all columns in a row and deletes row when any of them is NA, and that would be more time consuming I suppose than only traverse list by one column. -- View this message in context: http://r.789695.n4.nabble.com/how-to-strip-list-from-NA-values-looking-only-at-one-column-tp3077971p3077971.html Sent from the R help mailing list archive at Nabble.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 make partial mean() of a matrix only when second value matching some logic
for example I have matrix with two columns x,y 1,0.56 2,9.55 2,7.56 5,2.55 5,0.56 3,0.55 2,0.56 2,1.56 so I need to take average from y values placed where x==2 -- View this message in context: http://r.789695.n4.nabble.com/how-to-make-partial-mean-of-a-matrix-only-when-second-value-matching-some-logic-tp3078449p3078449.html Sent from the R help mailing list archive at Nabble.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] what function use to draw probability of finding data between certain constaints
I have simple scatterplot of temperature data taken daily from many years so at particular date there are usually more than one measurement, but not all data is complete. Now I want to draw line that will show me probability of finding data between defined bands of temperatures, for example +5 deg. C and -5 deg.C. The output line should have ranges between 0 (almost impossible) to 1 (almost certain) and be very close to 0 in summer and not so close (as in summer) to 0 in winter when temperatures drop below -5C, it should be highest for late autumn and early spring. -- View this message in context: http://r.789695.n4.nabble.com/what-function-use-to-draw-probability-of-finding-data-between-certain-constaints-tp3078837p3078837.html Sent from the R help mailing list archive at Nabble.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.