similar to: How do I multiply labeled vectors of numbers?

Displaying 20 results from an estimated 10000 matches similar to: "How do I multiply labeled vectors of numbers?"

2010 Sep 12
4
using read.table, removing extra quotation mark from a text field? (e.g. ""cat" )
I am using read.table to import a text file within R.   There are several "errors" in my text file.  An "extra" quotation mark has inadvertently been included within a few text fields.   e.g. for a pipe (|) delimited text file, I have something similar to this:   1|7|30| "dog" 2|6|25| ""cat" 3|4|20|"" 4|5| 56| "mouse" 5|3|56|
2008 Dec 23
3
How do I reload sessions from a non-default directory in OS X?
i use the GUI version of R on OS X. I launch it by double-clicking on the R icon. The process always starts in my home directory which means that the only .RData file that is ever read in is the one in my home directory. I would instead like to have different R sessions saved in different directories, but I can't figure out how to do this. A workaround is to use the shell version of R and
2009 Jul 01
1
How should I denormalise a data frame list of lists column?
Hi, I have a data frame where one column is a list of lists. I would like to subset the data frame based on membership of the lists in that column and be able to 'denormalise' the data frame so that a row is duplicated for each of its list elements. Example code follows: # The data is read in in this form with the c2 list values in single strings which I then split to give lists: > f1
2008 Dec 19
2
How do I generate one vector for every row of a data frame?
I am trying to generate a set of data points from a Gaussian mixture model. My mixture model is represented by a data frame that looks like this: > gmm weight mean sd 1 0.3 0 1.0 2 0.2 -2 0.5 3 0.4 4 0.7 4 0.1 5 0.3 I have written the following function that generates the appropriate data: gmm_data <- function(n, gmm) { c(rnorm(n*gmm[1,]$weight, gmm[1,]$mean,
2008 Dec 11
1
How do I tapply to a data frame with arbitrary column labels?
I have a data file that looks like this class pigeon falcon propeller jet wing fly birds 25 37 0 0 2 1 planes 0 1 28 40 1 3 birds 19 41 0 1 4 6 planes 0 0 25 50 5 5 planes 1 0
2007 Oct 09
5
Playing with ReadFileScatter()
Hi all, Looking at the IO.readlines source in io.c, it looks to me like they grab 8k chunks, split on the input record separator, and buffer accordingly. Since it looks like ReadFileScatter() does some of that work automatically (in page file sized chunks), I thought I''d give it a try. Here''s what I''ve got, but it doesn''t work. I have an incorrect parameter
2009 Oct 02
3
Tabulating using arbitrary numbers of factors
Dear R-help, First of all, thank you VERY much for any help you have time to offer. I greatly appreciate it. I would like to write a function that, given an arbitrary number of factors from a data frame, tabulates the number of occurrences of each unique combination of the factors. Cleary, this works: > table(horse,date,surface) <SNIP> , , surface = TURF
2010 Mar 14
3
range and intersection
Hi: I have a two large files (over 300K lines). file 1: Name X UK 199 UK 230 UK 139 ...... UAE 194 UAE 94 File 2: Name X Y UK 140 180 UK 195 240 UK 304 340 .... I want to select X of File 1 and search if it falls in range of X and Y of File 2 and Print only those lines of File 1 that are in range of File 2 X and Y How can it be done it
2008 Dec 16
2
Syncing file with reference to another one
I have the following situation: file2 on remote host and file1 on localhost. file1 and file2 are mostly the same. Simply running rsync remotehost:file2 file2 will actually transfer the entire file. But I would like to use the factt that I have local file1 that is mostly similar to file2. I.e. how can I make rsync to use file1 as a reference while transferring file2? (cp file1 file2 locally and
2015 Sep 03
1
Doubts on incremental backup and command repetition
Hi, I am trying to use rsync for incremental backup and I am facing some issues. I would like to ask your help to understand what is going on and have the proper command line. 1) my goal is I the following folders: ./dest: file3.txt ./orig: file1.txt   file10.txt  file2.txt   file20.txt And I would like to have as incremental backup ./dest: backup      file1.txt     file2.txt  file3.txt
2008 Apr 23
3
[LLVMdev] Compile units in debugging intrinsics / globals
I have a question about the llvm debugging records, especially wrt compile units. In the non-LLVM sense, a compile unit is essentially everything contained within a single .o file, and it is derived from one or more source and header files. Included in a compile unit are functions and global data. Dwarf records refer to compile units in the same way: a compile unit record has children which
2009 Sep 15
2
Building R package with .c sub-routine files
Lets say I have two source files file1.c and file2.c The latter just contains sub-routines to be used by the first. i.e. in file1.c I have the line #include "file2.c" Let's say "R CMD SHLIB file1.c" runs perfectly and I want to include the code in a package, "R CMD build" also runs fine but R CMD check" gives * checking whether package
2012 Mar 16
1
R merge two dataframes with different row?
Hi everyone, I have a question for R code to merge. Say I have two dataframes: File1 is: V1 V2 V3 V4 1 100 101 name1 2 200 201 name2 2 300 301 name3 3 400 401 name4 3 500 501 name5 4 600 601 name6 4 700 701 name7 File2 is: V1 V2 V3 V4 1 50 55 p1 3 402 449 p2 4 550 650 p3 4 651 660
2012 Aug 15
2
to remove columns and rows
Dear, I am using R I'm trying to identify and remove columns and rows in a data frame that are has elements equals. For example in dataframe below. The columns 1, 2,3,4,5 ,6 and 10 (file1) has elements equal then should be removed. How can I ask R to remove those columns with same elements in new dataframe (file2) to result a matrix as follows: file1 1 0 2 2 1 1 5 1 1 1 1 0
2016 Jun 09
1
for loop example
> From: Indunil Jayasooriya <indunil75 at gmail.com> > > > > > > [root at centos67 loop]# cat file1 > > > firstname1 > > > firstname2 > > > > > > [root at centos67 loop]# cat file2 > > > lastname1 > > > lastname2 > > > > > > I need a OUTPUT like this > > > > > > > > >
2011 Jul 19
1
list.files recursively to find files in a specific way...
Hi, all: My folders are organized in such a way: root ----branch1 ---------------A -----------------------file1.txt -----------------------file2.txt ---------------B -----------------------file1.txt -----------------------file2.txt ----branch2 ---------------A -----------------------file1.txt -----------------------file2.txt ---------------B -----------------------file1.txt
2008 Apr 24
0
[LLVMdev] Compile units in debugging intrinsics / globals
Hi, > Suppose I have the following source: > > file1: > #include "file2" > #include "file3" > int fn1(void) ... > > file2: > int a; > > file3: > int fn2(void) ... > > then fn1, along with all the base types etc appear to be in compile unit > "file1", the variable a appears to be in compile unit
2012 Dec 03
4
How to calculate the spatial correlation of several files?
dir1 <- list.files("C:\\Users\\aalyaari\\Desktop\\cor", "*.bin", full.names = TRUE) dir2 <- list.files("C:\\Users\\aalyaari\\Desktop\\cor2", "*.bin", full.names = TRUE) results <- list() for (.files in dir1){ # read in the 365 files as a vector of numbers for dir1 file1 <- do.call(rbind,(lapply(.files, readBin ,
2002 Dec 17
4
Quick tip please!
I have two CSV files (exported from Excel), say file1 and file2. The have the same number of rows, and each has several columns, with names on the first line; and some of the columns in file1 are repeated in file2. Using the "foreign" package, I can read these in separately to dataframes say d1 and d2 with > d1<-read.csv("file1") >
2007 Jul 16
2
Source inside source
Is there a way to know where is the source, so as to make a source call inside another source smarter? As an example: file1.R is in directory /files/dir1/ file2.R is in directory /files/dir1/dir2/ In file1.R, there is this line: source("dir2/file2.R") So, if I setwd to /files/dir1/, and then I call source("file1.R"), it will run correctly. However, if I setwd to /files,