similar to: create new column in a DF according to values from another column

Displaying 20 results from an estimated 4000 matches similar to: "create new column in a DF according to values from another column"

2012 May 03
2
add an automatized linear regression in a function
Dear R users, For the moment, I have a script and a function which calculates correlation matrices between all my data files. Then, it chooses the best correlation for each data and take it in order to fill missing data in the analysed file (so the data from the best correlation file is put automatically into the missing data gaps of the first file (because my files are containing missing values
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 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 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 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 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 Oct 18
1
filling NA gaps according to previous data mean and following data mean
Hi everybody, I have a little problem about filling some gaps of NAs in my data. These gaps are between nearly constant data (temperature under snow). Here's a fake example to illustrate how it looks like approximately: DF <- data.frame(data=c(-0.51,-0.51,-0.48,-0.6,-0.54,-0.38,-0.6,-0.42,NA,NA,NA,NA,NA,NA,NA, -0.25,-0.41,-0.5,-0.5,-0.35,-0.7,-1,-0.87)) I would like to replace my NAs
2012 Aug 09
1
How to find data in a map according to coordinates?
Hello, I have created a spatial map of temperature over an area thanks to interpolation. So I have temperature data everywhere on my map. My question is: how can I find temperature data on my map for a specific location according to coordinates? For this, I have a data frame containing 4 columns: "x" for longitude, "y" for latitude, "z" for altitude" and
2008 Mar 28
1
Beginner help with retrieving frequency and transforming a matrix
Hi All, Just hoping some one can give me a hand with a problem... I have a dataframe (DF) with about 5 million entries that looks something like the following: >DF ID Cl Co Brd Ind A AB AB 1 S-3 IND A BR_F BR_F01 1 0 0 2 S-3 IND A BR_F BR_F01 1 0 0 3 S-3 IND A BR_F BR_F01 1 0 0 4 S-3 IND A BR_F BR_F01 1 0 0 5 S-3 IND A BR_F BR_F01 1 0 0 6 S-3 IND A BR_F
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]]
2012 Jun 08
4
Sort 1-column dataframe with rownames
Hi, I have a 1-column dataframe with rownames and I want to sort it based on the single column. The typical procedure that is recommended in diverse posts is to use order in the index. But that "destroys" my dataframe structure. Probabaly it is a very simple solution. Here is a short reproducable example: x <- c(1,3,51,2,34,44,12,33,2,8) df <- data.frame(x) rownames(df) <-
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
2012 Jan 24
1
Column name containing "-"
I'm trying to create a data frame in which some of the column names contain a dash "-". A simple example: d <- data.frame(x = c(0, 1)) d <- data.frame(d, y = c(0,1)) names(d)[2] <- "a.-5" d x a.-5 1 0 0 2 1 1 d <- data.frame(d, y = c(0,1)) d x a..5 y 1 0 0 0 2 1 1 1 names(d)[2] <- "a.-5" d x a.-5 y 1 0 0 0 2 1 1 1 Why
2010 Oct 04
1
Splitting a DF into rows according to a column
Hi, I'm turning my wheels on this and keep coming around to the same wrong solution - please have a look and give a hand ... The premise is: a DF like so > loremIpsum <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque leo ipsum, ultricies scelerisque volutpat non, volutpat et nulla. Curabitur consequat ullamcorper tellus id imperdiet. Duis semper malesuada
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