similar to: Creating a sequence of variables in a data frame

Displaying 20 results from an estimated 10000 matches similar to: "Creating a sequence of variables in a data frame"

2006 Feb 11
2
how do I "relate" tables in R?
Hi all, I'm new to the list...pretty new at learning to code in R... Is there a way to relate 2 different arrays in R? Hypothetical example: data1 ID z 1 100 2 250 3 75 4 12 5 89 data2 ID z 1 1 1 1 2 3 4 3 4 5 5 5 etc. Goal is to fill column z in data2 with appropriate z-values from data1 that correspond to a given ID. I'm looking for something akin to a
2003 Aug 07
2
Question about 'NA'
Hi all, Ive got a database with 10 columns (different variables) for 100 subjects, each column with different # of NA's. I'd like to know if it is possible to use a function to exclude the NA's using only a specific column, lets say: Data2 <- omit.exclude(Data1$column1) ??, then Data3 <- omit.exclude(Data1$column2) and so on I tried the code above but with no results Thanks
2007 Oct 12
1
use 'lapply' to creat 2 new columns based on old ones in a data frame
There is a dataset 'm', which has 3 columns: 'index', 'old1' and 'old2'; I want to create 2 new columns: 'new1' and 'new2' on this condition: if 'index'==i, then 'new1'='old1'+add[i]. 'add' is a vector of numbers to be added to old columns, e.g. add=c(10,20,30 ...) Like this: index old1 old2 new1
2011 Sep 23
4
replace multiple string
Hi I would like to use a bash script that searches files and subdirectories name in a directory /var/ww/html/web for a specific string, and when it finds the search string, replaces the string (old1) with new string (new1), and so on old2 with new2 ....oldn with newn. replace_string.sh #!/bin/bash for db in $(find /var/www/html/web -name * -exec) do sed -e "s/old1/new1/" \ sed
2017 Apr 26
2
sshd: SSH_CLIENT_CERT and SSH_CLIENT_PUBKEY env variables
Hello, There are environment variables SSH_CLIENT and SSH_CONNECTION with information about client of current session. I want to implement new variables with info about credentials used for session authentication. Such as: SSH_CLIENT_CERT SSH_CLIENT_CERT_ID SSH_CLIENT_CERT_PRINCIPALS SSH_CLIENT_PUBKEY SSH_CLIENT_PUBKEY_FINGERPRINT Some of that information available in logs but not inside the
2000 Mar 07
1
update fails after specific sequence of steps (PR#474)
# Your mailer is set to "none" (default on Windows), # hence we cannot send the bug report directly from R. # Please copy the bug report (after finishing it) to # your favorite email program and send it to # # r-bugs@biostat.ku.dk # ###################################################### I stumbled on this error while doing a classroom demonstration. The error is reproducible,
2011 Oct 05
4
SPlus to R
I'm trying to convert an S-Plus program to R.  Since I'm a SAS programmer I'm not facile is either S-Plus or R, so I need some help.  All I did was convert the underscores in S-Plus to the assignment operator <-.  Here are the first few lines of the S-Plus file:   sshc _ function(rc, nc, d, method, alpha=0.05, power=0.8,              tol=0.01, tol1=.0001, tol2=.005, cc=c(.1,2),
2005 Oct 26
1
unexpected '[<-.data.frame' result
Is this a bug? If not, I am curious to know why '[<-.data.frame' was designed to yield a.frame$y != a.frame$z rather than refusing to carry out the operation at all. > a.frame <- data.frame( x=letters[1:5] ) > a.frame[ 2:5, "y" ] <- letters[2:5] > a.frame[[ "z" ]][ 2:5 ] <- letters[2:5] > a.frame x y z 1 a b <NA> 2 b c
2010 Aug 05
1
rbind on data.frame that contains a column that is also a data.frame
Hi, The following was already a topic on r-help, but after understanding what is going on, I think it fits better in r-devel. The problem is this: When a data.frame has another data.frame in it, rbind doesn't work well. Here is an example: -- > a=data.frame(x=1:10,y=1:10) > b=data.frame(z=1:10) > b$a=a > b z a.x a.y 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5
2010 Mar 08
2
how to convert character variables into numeric variables directly
Here is the example. > age=18:29 > height=c(76.1,77,78.1,78.2,78.8,79.7,79.9,81.1,81.2,81.8,82.8,83.5) > type=c("A", "B", "C", "D","A", "B", "C", "D","A", "B", "C", "D") >
2011 Jul 16
1
Creating composite factor and changing format from character to factor
Dear Help-list, I have a dataframe containing 6 variables, 4 of which are factors, 2 numeric. I want to create another factor variable (SitePos) by combining 2 existing factors (Site and Position). I have tried a number of approaches based on trolling the R FAQs, various R webpages, etc., none of which work. One approach e.g. Data1$SitePos <- paste(Data1$Site, Data1$Position) creates the
2006 May 30
3
Faster way to zero-pad a data frame...?
Hello List, I am working on creating periodograms from IP network traffic logs using the Fast Fourier Transform. The FFT requires all the data points to be evenly-spaced in the time domain (constant delta-T), so I have a step where I zero-pad the data. Lately I've been wondering if there is a faster way to do this. Here's what I've got: * data1 is a data frame consisting of
2010 Dec 07
4
Creating binary variable depending on strings of two dataframes
Hi, consider the following two dataframes: x1=c("232","3454","3455","342","13") x2=c("1","1","1","0","0") data1=data.frame(x1,x2) y1=c("232","232","3454","3454","3455","342","13","13","13","13")
2009 May 19
2
Replace / swap values of subset of a data.frame
Dear R users, I have 1 data.frame of 1500x80 - data1. I found out that there are a few cells of data that I have misplace, and I need to fix the ordering of them. In an attempt trying to swap column 22 & 23 of the Subject with misplaced data, I did the following: > data2 <- data1 > subset(data1,(Subject==25 & Session==1))[,22] <- subset(data2,(Subject==25 &
2007 Feb 07
6
setting a number of values to NA over a data.frame.
This is probably a simple problem but I don't see a solution. I have a data.frame with a number of columns where I would like 0 <- NA thus I have df1[,144:157] <- NA if df1[, 144: 157] ==0 and df1[, 190:198] <- NA if df1[, 190:198] ==0 but I cannot figure out a way do this. cata <- c( 1,1,6,1,1,NA) catb <- c( 1,2,3,4,5,6) doga <- c(3,5,3,6,4, 0) dogb <- c(2,4,6,8,10,
2002 Jul 01
2
split a data frame
Hi , I have a data frame (Data1) which has a area variable (AREA) with codes (RA,RG,LT etc.). I would like to split the data frame into individual data frames called RA, RG, LT conatining only the observations from those areas. Thanks yours sincerely Andrew McCulloch -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2006 Aug 28
2
Cannot get simple data.frame binding.
I am stuck on a simple problem where an example works fine but the real one does not. I have a data.frame where I wish to sum up some values across the rows and create a new data.frame with some of old data.frame variables and the new summed variable. It works fine in my simple example but I am doing something wrong in the real world. In the real world I am loading a labeled data.frame. The
2010 Aug 19
1
modifying factors in a data frame
Hi All I have a data frame in which on the columns is a factor with following levels Levels: M006 M0114 M0379 M0432 M0823 M1012 M1096 M1107 SW393 SW708 I want to change all the M006 to "1", M0114 to "2" and so on. What I am trying is not working. data1$sample[data1$sample =='M006'] <- "1" Warning message: In `[<-.factor`(`*tmp*`, data1$sample ==
2004 Sep 08
3
do.call("[", ...) question
Hi again everyone I have an arbitrarily dimensional array "a" and a list "jj" of length length(dim(a)). The elements of jj are vectors of indexes. How do I use do.call() to extract a[ jj[[1]], jj[[2]], jj[[3]], ...] ? Toy example follows: a <- matrix(1:30,5,6) jj <- list(5:1,6:1) I want the following a[ jj[[1]],jj[[2]] ] How do I do this? OBAttempts:
2017 Dec 20
1
utils::unzip ignores overwrite argument, effectively
It does give a warning, but then it overwrites the files, anyway. Reproducible example below. This is R 3.4.3, but it does not seem to be fixed in R-devel: https://github.com/wch/r-source/blob/4a9ca3e5ac6b19d7faa7c9290374f7604bf0ef64/src/main/dounzip.c#L171-L174 FYI, G?bor dir.create(tmp <- tempfile()) setwd(tmp) cat("old1\n", file = "file1") cat("old2\n", file