Displaying 20 results from an estimated 7000 matches similar to: "add an automatized linear regression in a function"
2012 Sep 26
5
create new column in a DF according to values from another column
Hi everyone,
I have a small problem in my R-code.
Imagine this DF for example:
DF <- data.frame(number=c(1,4,7,3,11,16,14,17,20,19),data=c(1:10))
I would like to add a new column "Station" in this DF. This new column must
be automatically filled with: "V1" or "V2" or "V3".
The choice must be done on the numbers (1st column).
For example, I would like
2012 Apr 03
3
filling small gaps of N/A
Hi everybody,
I'm a new R french user. Sorry if my english is not perfect. Hope you'll
understand my problem ;)
I have to work on temperature data (35000 lines in one file) containing some
missing data (N/A). Sometimes I have only 2 or 3 N/A following each other,
but I have also sometimes 100 or 200 N/A following each other. Here's an
example of my data, when I have only small gaps
2012 Apr 23
1
take data from a file to another according to their correlation coefficient
Hi everyone.
I have a question about a work on R I have to do for my job.
I have temperature data coming from 70 weather stations. One data file
corresponds to one station for one year (so 70 files for one year). Each
file looks like this (important: each file contains NAs):
time data
01/01/2008 00:00 -0.25
01/01/2008 00:15 -0.18
01/01/2008 00:30 -0.25
01/01/2008
2012 May 10
1
stop calculation in a function
Hi dear R-users,
I have a question about a function I'm trying to improve.
How can I stop the function calculation at the last numeric value of my
data?
The problem is that the end of my data contains missing values (NAs). And
the aim of my function is to compare the first numeric value with the next
one (till the end). For the moment, It works well when my data doesn't
contains any NAs
2012 Jul 18
2
duplicate data between two data frames according to row names
Hi everybody.
I'll first explain my problem and what I'm trying to do.
Admit this example:
I'm working on 5 different weather stations.
I have first in one file 3 of these 5 weather stations, containing their
data. Here's an example of this file:
DF1 <- data.frame(station=c("ST001","ST004","ST005"),data=c(5,2,8))
And my two other stations in
2012 Jul 02
2
using "na.locf" from package zoo to fill NA gaps
Hi everybody,
I have a small question about the function "na.locf" from the package "zoo".
I saw in the help that this function is able to fill NA gaps with the last
value before the NA gap (or with the next value).
But it is possible to fill my NA gaps according to the last AND the next
value at the same time?
Actually, I want R to fill my gaps with the method of
2012 Dec 12
3
create a color palette with custom ranges between colors
Hello everybody,
I'm trying to create my own color palette on R, in order to interpolate some
different temperature data on different maps (daily means, seasonal
means,...).
I would like to create a color palette which works for each map, so I need a
color palette between -40 and +40?C. Sometimes my data for one map range
from -10 to +20, sometimes from 10 to 30, etc... but always between
2012 Jun 04
2
how to ignore NA with "NA" or "NULL"
Hello dear R-users,
I have a problem in my code about ignoring NA values without removing them.
I'm working on a list of files. The aim is to fill one file from another
according to the highest correlation (correlation coeff between all my
files, so the file which looks like the most to the one I want to fill).
When I have just small gaps of NA, my function works well.
The problem is when I
2012 May 21
1
select part of files from a list.files
Hi everyone.
I'm working on a list of files (about 50 files). I've listed them thanks to
the function: list.files.
Each of my files contains 35000 lines of data. These files may also contain
some missing values NA (sometimes till 10 000 NAs following each other).
The aim is to do some correlation matrices between these files (I already
have the script). But as I have often missing values,
2012 Aug 01
4
how to calculate seasonal mean for temperatures
Hello everybody,
I need to calculate seasonal means with temperature data for my work.
I have 70 files coming from weather stations, which looks like this for
example:
startdate <- as.POSIXct("01/01/2006", format = "%d/%m/%Y")
enddate <- as.POSIXct("05/01/2006", format = "%d/%m/%Y")
date <- seq(from = startdate, to = enddate, by =
2012 May 21
3
Prevent calculation when only NA
Hi everybody,
I have a small question about R.
I'm doing some correlation matrices between my files. These files contains
each 4 columns of data.
These data files contains missing data too. It could happen sometimes that
in one file, one of the 4 columns contains only missing data NA. As I'm
doing correlations between the same columns of each files, I get a
correlation matrix with a
2012 Nov 28
3
filter data.frame with a vector
Hello together,
i have a data.frame, which i want to filter with numbers in a vector.
I have a vector (Top10) with these numbers:
[1] 205 302 156 378 235 328 183 375 296 374
and i have a data.frame with a Column (CU_NO) with all my Customer numbers.
How can i filter this data.frame, with the Numbers in my vector.
this one doens't work:
2012 Jun 15
2
strings concatenation and organization (fast)
Hello,
What is the fastest way to do this? I has to be done quite a few times.
Basically I have sets of 3 numbers (as characters) and sets of 3 dashes and
I have to store them in named columns. The order of the sets and the column
name they fall under is important. The actual numbers and the pattern/order
of the sets should be considered random/unpredictable.
Sample data:
vec =
2004 Aug 27
1
Plotting irregular grid as image or persp
Hi,
I have an array of 2d node locations and an array triangles, and would
like to plot something like a image or persp.
An example of doing it with rgl is:
library(ncdf)
library(rgl)
# wget http://www.maplepark.com/~drf5n/extras/teapot.nc
teapot<-open.ncdf("teapot.nc")
z<-get.var.ncdf(teapot,"tris")
l<-get.var.ncdf(teapot,"locations")
2005 Jul 01
5
Generating correlated data from uniform distribution
Dear R users,
I want to generate two random variables (X1, X2) from uniform
distribution (-0.5, 0.5) with a specified correlation coefficient r.
Does anyone know how to do it in R?
Many thanks!
Menghui
2012 Dec 17
2
Suggestion: 'method' slot for format.ftable()
Dear R-developers,
I would like to suggest a 'method' slot for format.ftable() (see an adjusted
'format.ftable()' below, taken from the source of R-2.15.2).
At the moment, format.ftable() contains several empty cells due to the way the
row and column labels are printed. This creates problems (= unwanted empty
columns/rows) when converting an ftable to a LaTeX table; see an
2012 Jul 25
2
old weird error message
Dear users,
I have a weird questions. A friend of mine, some years ago, supposedly
trying to access help files without Internet connection, got something
like this error message:
"The Pythia is not available, please go to Delphi"
When I've heard about it, I found it very funny and I'd like to be able
to get it. Does anyone of you know how to get this error message again?
2013 Jan 23
2
importing data
Dear All,
Sorry for asking a newbie question. I want to ask how to import 1000
datasets whose file names are labelled from data1.dat to data1000.dat into
R so that they are named M[1, , ] to M[1000, , ] accordingly. Thank you
very much.
Best Regards,
Ray
[[alternative HTML version deleted]]
2008 Jan 02
2
Seeking a more efficient way to read in a file
Hi.
I have a matrix stored in a large, tab-delimited flat file. The first row contains column names. Because the matrix is symmetric, the file has lower triangular format, so the second row contains one number, the third row two numbers, etc. In general, row k+1 contains k numbers; the matrix has 3000 rows, so the file has 3001 rows. The file has variable length records, so each row ends
2013 May 31
1
Configuration advice needed.
Hello,
First, thanks for this great piece of software.
I'm new to dovecot and i've just converted my old courier configuration
on pop/imap server side, everithing is working just fine on this side
and speed gain expected was found (not enough for our busy servers :).
Setup is done with 3 dovecot virtual servers load balanced with a
Hardware load balancer (this part is a big point of the