Displaying 20 results from an estimated 1000 matches similar to: "Dividing by 0"
2008 Jun 15
3
Delete Block of Rows
I am trying to delete a section of rows from a data frame (based on no
condition). Lets say my data frame has 200 rows and I want to delete rows 1
through 25. How would I do this?
I know x[ -1, ] deletes the first row (or any desired row). I tried using
different variations of this, like x[ -c(1:25), ] but that didn't work. I
also tried writting a few functions, for example:
deleteRows
2008 Jul 09
5
Summary Stats (not summary(x))
I'm looking for a function that lists a few summary stats for a column (or
row) of data. I'm aware of summary(x), but that does not give me what I'm
looking for.
I'm actually looking for something that is very similar to the descriptive
statistics tool in excel; i.e. Mean, Std. Error, Std. Deviation, Kurtosis.
I'm positive that I came across a function that did this (possibly
2006 Feb 20
3
Boxplot Help for Neophyte
R helpers
I am getting to grips with R but came across a small problem today that I
could not fix by myself.
I have 3 text files, each with a single column of data. I read them in
using:
myData1<-scan("C:/Program Files/R/myData1.txt")
myData2<-scan("C:/Program Files/R/myData2.txt")
myData3<-scan("C:/Program Files/R/myData3.txt")
I wanted to produce a
2008 Jul 09
2
Read.table - Less rows than original data
Dear all,
I have problem when reading a table into R. The total row of read in table
has is much less than the original saved table.
I built a 1,273,230 by 6 data set named "mydata2", it was saved in the
following command,
write.table(mydata2, "mydata2.txt", row.name=F,col.name=T,quote=F,sep="\t")
The next day I read in above saved text file into R,
2001 Dec 19
2
How to create a data.frame "like" another, but longer?
Hello,
does anyone know of a quick way to create a data frame "like" another, but
with more rows?
What I'd like to do is this:
if mydata is a data.frame like
a b c
1 TRUE yes
2 FALSE no
3 TRUE yes
I'd like to get mydata2 with the same column names and column types, but
without the values and with more rows.
All I could think of was to manually do
2012 Jul 03
1
insert missing dates
Hello
I have dataframes.
mydata1 <-data.frame(value=c(15,20,25,30,45,50),dates=c("2005-05-25 07:00:00
","2005-05-25 19:00:00","2005-06-25 07:00:00","2005-06-25 19:00:00
","2005-07-25 07:00:00","2005-8-25 19:00:00"))
or
mydata2 <-data.frame(value=c(15,20,25,30,45,50),dates=c("2005-05-25 00:00:00
","2005-05-25
2007 Mar 08
1
R: Searching and deleting elements of list
you could try mapply
mydata2<-mapply("[", mydata, lapply(mydata, function(x) !x %in% A))
mydata2[[1]]<-A #to replace the obviously deleted elements of "A"
mydata2
mydata2[[1]]
mydata2[[2]]
mydata2[[3]]
mydata2[[4]]
Stefano
-----Messaggio originale-----
Da: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]Per conto di jastar
2009 Jan 06
5
Using apply for two datasets
I can run one-sample t-test on an array, for example a matrix myData1,
with the following
apply(myData1, 2, t.test)
Is there a similar fashion using apply() or something else to run
2-sample t-test with datasets from two groups, myData1 and myData2,
without looping?
TIA,
Gang
2007 Mar 08
1
Searching and deleting elements of list
Hi,
I have a problem. Please, look at example and try to help me!!
> A<-c("aaa","bbb","ccc","ddd","eee")
> B<-c("vvv","ooo","aaa","eee","zzz","bbb")
> C<-c("sss","jjj","ppp","ddd")
> D<-c("bbb","ccc")
2008 Jul 09
1
read.table problem
Dear all,
I have problem when reading a table into R. The total row of read in table
has is much less than the original saved table.
I built a 1,273,230 by 6 data set named "mydata2", it was saved in the
following command,
write.table(mydata2, "mydata2.txt", row.name=F,col.name=T,quote=F,sep="\t")
The next day I read in above saved text file into R,
2011 Jun 21
5
converting character to numeric
I'm trying to convert data from character to numeric.
I've imported data as a csv file, I'm assuming that the import is a
database - are all the columns in a database considered "vectors" and that
they can be operated on individually
Therefore I've tried the following
mydata <- as.numeric(mydata$apples)
when i then look at mydata again the named column is still
2008 Apr 15
2
How can I import user-defined missings from Spss?
Hi,
It works for me to import spss datasets via library(foreign) with read.spss or via library Hmisc by (spss.get).
But no matter which way I do import the data, user-defined missings from Spss are always lost.
(it makes no difference if there are a single value, a range, or any combination of them. They are always ignored).
Is there any way in R to find out if any value was user-defined missing
2006 Oct 04
2
convert vector to matrix
Hi All,
I have vector containing 10 elements(odservations). I need to put this into a matrix, where the matrix should contain only one column.
I need this to be done using the cbind command because in the final table I should have a column of attributes( from adifferent vector) and a column of vectors from the matrix above
Please suggest me how this can be done
Thanks and
2006 Nov 09
1
dissimilarity matrices
Dear All,
I have a dissimilarity matrix which I happily convert to a distance object
by running:
X <- as.dist(Y)
and I can happily now run either hclust(X) or agnes(X).
So that the various bits of output are labelled correctly I would dearly
like to be able to give names to the columns and rows of X, as would happen
if I ran:
mydata<-read.table("clipboard",header=T)
2011 Feb 25
1
speed up process
Dear users,
I have a double for loop that does exactly what I want, but is quite
slow. It is not so much with this simplified example, but IRL it is slow.
Can anyone help me improve it?
The data and code for foo_reg() are available at the end of the email; I
preferred going directly into the problematic part.
Here is the code (I tried to simplify it but I cannot do it too much or
else it
2012 Jan 01
1
How to pass in a list of variables as an argument to a function?
Hello,
I have some code that currently works fine and I am endeavoring to
convert the major pieces of it into functions.
This involves taking "hard coded" names of variables that are used in
various places and figuring out how to
abstract them out into functions where the arguments (i.e. a list of
variables)?can be passed to the parent function
and used within that function for various
2009 Jun 26
3
to raise in a loop more than 1
I would raise x,y and z in a loop but I won't raise of 1. I tried this but it doesn't work
mydata=matrix(nrow=1500,ncol=3)
i=1
for(x in 0:10){
for(y in 0:20){
for(z in 0:10){
mydata[i,]=c(x,y,z)
i=i+1
z=z+2}
y=y+4}
x=x+2}
And I would have something like that
x y z
0 0 0
0 0 2
0 0 4
0 0 6
0 0 8
0 0 10
0 4 0
0 4 2
...
Could anybody help me?
I
2012 Oct 20
2
Help with programming a tricky algorithm
Hi All,
I'm a little stumped by the following problem. I've got a dataset with
the following structure:
idxy ix iy country (other variables)
1 1 1 c1 x1
2 1 2 c1 x2
3 1 3 c1 x3
. . . . .
3739 55 67 c7 x3739
3740 55 68 c7 x3740
where ix and
2009 Sep 21
3
compute differences
Hi,
I have a problem.
I have a data frame looking like:
ID val
A? .3
B? 1.2
C? 3.4
D? 2.2
E? 2.0
I need to CREATE the following TABLE:
CASE?? DIFF
A-A??? 0
A-B??? -0.9
A-C??? -3.1
A-D??? -1.9
A-E??? -1.7
B-A??? ...
B-B??? ...
B-C
B-D
B-E
C-A
C-B
C-C
C-D
C-E
D-A
D-B
D-C
D-D
D-E
E-A
E-B
E-C
E-D
E-E
WHERE CASE IS THE COUPLE OF ELEMENTS CONSIDEREDM AND DIFF IS THE computed DIFFERENCE between
2009 May 04
0
to the person who asked about dividing by the base row
to whomever that was. i deleted your email but I think below does what you
want. as always, there's probably some
improvement that could be done. whether it's ? minor or major, i'm not sure
?
also, 3 things:? ?
A)there are some Inf's in the output because of division by zero but I
wasn't sure how you wanted to handle that.
B) it also assumes that an n=1