Displaying 20 results from an estimated 900 matches similar to: "How to modify a column of a matrix"
2007 Mar 19
1
k-means clustering
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070319/0bf66722/attachment.pl
2011 Mar 03
3
Probabilities greather than 1 in HIST
Dear all,
I am a newbie in R and could not find help on this problem. I am trying to
plot an histogram with probabilities in the y axis. This is the code I am
using:
#TLC uniform
n=30
mi=1; mx=6
nrep=1000
xbar=rep(0,nrep)
for (i in 1:nrep) {xbar[i]=mean(runif(n,min=mi,max=mx))}
hist(xbar,prob=TRUE,breaks="Sturges",xlim=c(1,6),main=paste("n =",n),
xlab="Média",
2004 Nov 19
2
glm with Newton Raphson
Hi,
Does anyone know if there is a function to find the maximum likelihood
estimates of glm using Newton Raphson metodology instead of using IWLS.
Thanks
Valeska Andreozzi
--------------------------------------------------------
Department of Epidemiology and Quantitative Methods
FIOCRUZ - National School of Public Health
Tel: (55) 21 2598 2872
Rio de Janeiro - Brazil
2010 May 17
1
suggestions/improvements for recoding strategy
I am recoding some data. Many values that should be 1.5 are recorded
as 1-2. Some example data and my solution is below. I am curious about
better approaches or any other suggestions. Thanks!
# example input data
myData <- read.table(textConnection("id, v1, v2, v3
a,1,2,3
b,1-2,,3-4
c,,3,4"),header=TRUE,sep=",")
closeAllConnections()
# the first column is IDs so remove
2006 Sep 13
7
inserting columns in the middle of a dataframe
Dear R users:
Is there a built-in and simple way to insert new columns after other columns
in a dataframe?
I.e. currently I have:
V1 V2 V3 V4
[1,]
[2,]
Etc.
But I want
V1 V5 V2 V3 V4
[1,]
[2,]
Etc.
Can this be done in one line?
Jon Minton
[[alternative HTML version deleted]]
2009 May 26
1
Bug in "$<-.data.frame" yields corrupt data frame (PR#13724)
Full_Name: Steven McKinney
Version: 2.9.0
OS: Mac OS X 10.5.6
Submission from: (NULL) (142.103.207.10)
A corrupt data frame can be constructed as follows:
foo <- matrix(1:12, nrow = 3)
bar <- data.frame(foo)
bar$NewCol <- foo[foo[, 1] == 4, 4]
bar
lapply(bar, length)
> foo <- matrix(1:12, nrow = 3)
> bar <- data.frame(foo)
> bar$NewCol <- foo[foo[, 1] == 4, 4]
2018 Apr 15
4
Adding a new conditional column to a list of dataframes
Hi all ..,
I have a list of 7000 dataframes with similar column headers and I wanted to add a new column to each dataframe based on a certain condition which is the same for all dataframes.
When I extract one dataframe and apply my code it works very well as follows :-
First suppose this is my first dataframe in the list
> OneDF <- Mylist[[1]]
> OneDF
ID Pdate
2011 Aug 01
1
Inserting column in between -- "better" way?
Folks:
I consider my reply below rather clumsy: One has to keep track of
index numbers other than that which is inserted and must separately
change column names. Is there as "essentially better" way to do this,
either via base R or via an R package. I leave it to you to define
"essentially better."
Thanks.
Cheers,
Bert
On Mon, Aug 1, 2011 at 10:17 AM, Bert Gunter
2009 Apr 29
1
Corrupt data frame construction - bug?
Hi useRs,
A recent coding infelicity along these lines
yielded a corrupt data frame.
foo <- matrix(1:12, nrow = 3)
bar <- data.frame(foo)
bar$NewCol <- foo[foo[, 1] == 4, 4]
bar
lapply(bar, length)
> foo <- matrix(1:12, nrow = 3)
> bar <- data.frame(foo)
> bar$NewCol <- foo[foo[, 1] == 4, 4]
> bar
X1 X2 X3 X4 NewCol
1 1 4 7 10 <NA>
2 2 5 8 11
2009 Feb 02
2
concatenating 2 text columns in a data.frame
Hi,
I'm trying to concatenate values from two columns in a data frame. For
example, I have the following data.frame:
C1 C2 C3 C4 C5
A B *F C* Q
G H *I J* T
K D *R S* E
P L *M N* O
I'd like to concatenate text from columns C3 and C4, to yield either a
list or vector, like so:
NewCol
FC
IJ
RS
MN
Is this feasible in R?
Thanks!
2018 Apr 15
0
Adding a new conditional column to a list of dataframes
> On Apr 15, 2018, at 4:08 AM, Allaisone 1 <Allaisone1 at hotmail.com> wrote:
>
>
> Hi all ..,
>
>
> I have a list of 7000 dataframes with similar column headers and I wanted to add a new column to each dataframe based on a certain condition which is the same for all dataframes.
>
>
> When I extract one dataframe and apply my code it works very well as
2018 Feb 25
4
reshaping column items into rows per unique ID
Hi All
I have a datafram which looks like this :
CustomerID DietType
1 a
1 c
1 b
2 f
2 a
3 j
4 c
4 c
4 f
And I would like to reshape this so I can
2008 Aug 20
3
vector operation using regexpr?
Hi,
Here's my problem... I have a data frame with three columns containing
strings. The first columns is a simple character. I want to get the
index of that character in the second column and use it to extract the
item from the third column. I can do this using a scalar method. But
I'm not finding a vector method. An example is below.
col1 col2 col3
'L'
2002 Feb 09
1
How to access objects outside an R function
Dear R-Users,
I have a dataframe (''forexdata'') of daily returns from the foreign exchange market for three currencies - British Pound (bp), Canadian Dollar(cd),
Deustche Mark (dm) vis-a-vis the US Dollar and the Date Of
Trade(yymmdd).
For some dates the returns are missing (recorded as zero) as there
were no trades in that currency for that date. My task is to
substitute the
2011 Oct 24
1
Creating data frame with residuals of a data frame
Dear experts,
I am trying to create a data frame from the residuals I get after
having applied a linear regression to each column of a data frame, but
I don't know how to create this data frame from the resulting list
since the list has differing numbers of rows.
So for example:
age<- c(5,6,10,14,16,NA,18)
value1<- c(30,70,40,50,NA,NA,NA)
value2<- c(2,4,1,4,4,4,4)
df<-
2015 Jan 24
4
Indexing Mail faster
Hi,
I am trying to get faster search results on our webmail client(Roundcube).
Besides using Lucene for FTS are there other options?
Would having all mails indexed give fast results?
Currently the time it takes to search 25,000mails is 4mins. If indexed how
much faster are we looking at?
Really appreciate if someone could advise about this.
Thanks
Kevin
2015 May 13
2
[LLVMdev] Modifying debug information through llvm pass
Hi All,
I want to change debug information of an llvm instruction so that the
modified debug info is subsequently passed to executable binary. So if I
use "addr2line" utility on the binary, it will return my modified debug
information.
I've tried to change by using the following code snippet:
MDNode *N = Inst->getMetadata("dbg");
DebugLoc Loc =
2018 Feb 25
0
reshaping column items into rows per unique ID
Hi Allaisone,
If you want a data frame as the output you will have to put up with a
few NA values unless each Customer has the same number of diet types:
a1df<-read.table(text="CustomerID DietType
1 a
1 c
1 b
2 f
2 a
3 j
4
2008 Aug 27
1
How to create additional columns?
I do have some data of dim 100*3 (i.e 100 rows and 3 columns ) stored in a
txt file. I want to read the data into R, Perform the same operation in
each row and store the result in a forth column( that I should create).
I do not know how I can create a forth column to store the result of the
operation for each row?
--
View this message in context:
2010 May 13
2
Adding name to nth row
Hello,
I have a data frame with many rows, and I want to create a column with
a name only at every 12th row, starting from 97 to 278.
Thanks in advance!