Displaying 20 results from an estimated 600 matches similar to: "replace multiple string"
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
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
2007 Mar 05
7
[PATCH 2/10] linux 2.6.18: COMPAT_VDSO
This adds support for CONFIG_COMPAT_VDSO. As this will certainly raise
questions, I left in the code needed for an alternative approach (which
requires mode C code, but less build script changes).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: head-2007-02-27/arch/i386/Kconfig
===================================================================
---
2007 Mar 05
7
[PATCH 2/10] linux 2.6.18: COMPAT_VDSO
This adds support for CONFIG_COMPAT_VDSO. As this will certainly raise
questions, I left in the code needed for an alternative approach (which
requires mode C code, but less build script changes).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: head-2007-02-27/arch/i386/Kconfig
===================================================================
---
2007 Mar 05
7
[PATCH 2/10] linux 2.6.18: COMPAT_VDSO
This adds support for CONFIG_COMPAT_VDSO. As this will certainly raise
questions, I left in the code needed for an alternative approach (which
requires mode C code, but less build script changes).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: head-2007-02-27/arch/i386/Kconfig
===================================================================
---
2010 Nov 15
2
dsync mbox->mdbox: Unexpectedly lost From-line and other issues from a big conversion.
Hi,
I'm trying to convert a 33GB mail store from mbox to compressed mdbox
(largest mbox is 2.7GB). The source store is live, e.g. there are mails
delivered into it and mails are being read. Actually it is my own
mail. :)
Although my test runs were very successful I have run into trouble with
the first run on the whole store. After fighting a bit around with
errors like
Error: Trying
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),
2010 Jun 01
1
loop
Can any one help it will be very kind, loop statements
I have this table and some more records, I want to reshape it
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
TP53 Dis1 Dis2 Dis3 Dis4 Dis5 Dis6
DCI New1 New2 New3 New4
FDI Hi2 H3 H4
GHD I1 I3 I4 I5 I6 I7 I8
I want my new table or matrix to be some thing like this
V1 V2 V3
Tp53 Dis1 Dis2
Tp53 Dis1 Dis3
Tp53 Dis1 Dis4
Tp53 Dis1 Dis5
Tp53 Dis1 Dis6
Tp53 Dis2
2012 Sep 18
2
Formula in a data-frame
Hello all,
I'm new in R, and I have a data-frame like this (dput information below):
Specie Fooditem Occurrence Volume
1 Schizodon vegetal 1 0.05
2 Schizodon sediment 1 0.60
3 Schizodon vegetal 1 0.15
4 Schizodon alga 1 0.05
5 Schizodon sediment 1 0.90
6 Schizodon
2012 Feb 09
2
fill an array by rows
I've dug around but not been able to find anything, am probably missing
something obvious.
How can I fill a three-dimensional (or higher dimension) array by rows
instead of columns.
eg
new1 <- array(c(1:125), c(5,5,5))
works fine for me but fills it by columns and
new2 <- array(c(1:125), c(5,5,5), byrow=TRUE)
throws an error.
Am I missing something obvious? I also tried
2008 Jun 10
2
convert characters into integers in a matrix
Hello,
I will appreciate any suggestion for this simple problem. I have a matrix of
characters "A", "P", "M".
I want to convert those characters to integers 0,1, 1 respectively. I am
using the following R statements:
exprs.new<-gsub("P",1,exprs)
exprs.new1 <- gsub("A",0,exprs.new)
exprs.new2 <-
2008 May 15
2
How to remove autocorrelation from a time series?
Dear R users,
someone knows how to remove auto-correlation from a frequencies time series?
I've tried by differencing (lag 1) the cumulative series (in order to have only positive numbers) , but I can't remove all auto-correlation.
If it's useful I can send my db.
x <- # autocorrelated series
new1<-cumsum(x)
new2<-diff(new1,lag=1,differences = 1)
acf(new2) #
2011 Feb 23
1
request for patch in "drop1" (add.R)
By changing three lines in drop1 from access based on $ to access
based on standard accessor methods (terms() and residuals()), it becomes
*much* easier to extend drop1 to work with other model types.
The use of $ rather than accessors in this context seems to be an
oversight rather than a design decision, but maybe someone knows better ...
In particular, if one makes these changes (which I am
2013 Jan 25
1
Recoding variables (without recode() )
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130125/859c4520/attachment.pl>
2012 Jul 23
3
CSV format issues
Dear all,
I have some encoding problem which I'm not familiar with.
Here is the case :
I'm read data files which can have been generated from a computer either with global settings in french or in english.
Here is an exemple ouf data file :
* English output
Time,Value
17,-0.0753953
17.05,-6.352454E-02
* French output.
Time,Value
32,-7,183246E-02
32,05,3,469364E-02
In the first
2006 Apr 26
5
Best way to split forms into steps?
I have a form with about 30+ fields, which the client is wanting to
separate into 3 pages/steps - just wondering what is the best way to go
about this, specifically remembering data entered, from one page to
another, and making sure the various bits of data are validated
correclty, error messages outputted etc etc...
is there a best practice method for doing this?
--
Posted via
2009 Apr 09
2
failed when merging two dataframes, why
Hi, R-listers,
Failed, when I tried to merge df1 and df2 by "codetot" in df1 and "codetoto"
in df2. I want to know the reason and how to merge them together. Data
frames and codes I have used were listed as followed. Thanks a lot in
advance.
df1:
popcode codetot p3need
BCPy01-01 BCPy01-01-1 100.0000
BCPy01-01 BCPy01-01-2 100.0000
BCPy01-01 BCPy01-01-3 100.0000
BCPy01-02
2011 Feb 05
1
Seeking help to define method for '+'
Dear all, I am trying to define "+" method for my newly defined s4 class
which is as follows:
setClass("Me", sealed=F,representation(x1 = "numeric", x2 = "character"))
new1 <- new("Me", x1=2, x2="comment1")
new2 <- new("Me", x1=3, x2="comment1")
setMethod("+", "Me",
2012 Oct 26
4
Merge matrices with different column names
A general question that I have been pursuing for some time but have set
aside. When finishing some analysis, I can have multiple matrices that
have specific column names. Ideally, I would like to combine these
separate matrices for a final output as a csv file.
A generic example:
Matrix 1
var1A var1B var1C
x x x
x x
2012 Sep 19
4
correlating matrices
Hi,
thank you for taking the time and reading my question. My question is
twofold:
1. I have several matrices with variables and one matrix with water levels.
I want to predict the water level with the data in the other matrices.
Basically,
* mod<-lm(matrix1 ~ matrix2+matrix3)*
( What looks like a minus is meant to be the wiggly minus.)
Of course I could dissemble the matrices and paste