Displaying 20 results from an estimated 3000 matches similar to: "read.table with numeric row names"
2001 Oct 27
1
trouble with data.matrix
Dear all,
The following causes me trouble:
> a <- data.frame(2:5,3:6,4:7)
> str(a)
`data.frame': 4 obs. of 3 variables:
$ X2.5: int 2 3 4 5
$ X3.6: int 3 4 5 6
$ X4.7: int 4 5 6 7
> str(data.matrix(a))
int [1:4, 1:3] 2 3 4 5 3 4 5 6 4 5 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:4] "1" "2" "3" "4"
..$ : chr
2010 Aug 10
3
grep problem decimal points looping
Hi R Users,
I have been trying to work out how to rename column names using grep,
basically I have generated these column names using tapply:
[1] "NAME" "X1.1" "X2.1" "X3.1" "X4.1" "X5.1" "X6.1" "X7.1" "X8.1"
[10] "X1.2" "X2.2" "X3.2" "X4.2"
2007 Dec 07
1
how to generate uniformly distributed random integers
I'm a beginner of R.
I can use runif() to generate uniformly distributed numbers, but I don't
know which function can generate uniformly distributed random integers, or
what kind of method do?
Thanks!
--
View this message in context: http://www.nabble.com/how-to-generate-uniformly-distributed-random-integers-tf4960778.html#a14208376
Sent from the R help mailing list archive at
2012 Dec 24
2
colmeans not working
[text file is also attached in case you find the format of email difficult to understand]
Dear useRs,You must all the planning for the christmas, but i am stucked in my office on the following issue
i had a file containg information about station name, year, month, day, and discharge information. i opened it by using
following command
> dat1<-read.table("EL.csv",header=TRUE,
2013 Apr 10
3
how to calculate average of each column
Hey All,
I have a large dataset and I want to calculate the average of each column
then return a new dataset.
Here is my question: I dont know if there is a function that can allow me
to calculate the average every 60 records of data in the whole dataset, and
return a new data frame. Not sure if I have to divide the dataset first for
every 60, then do the mean or can i directly do that.
thanks
2009 Jan 09
3
create sequences from two "from" and "to" vectors
hi all,
how can I create sequences that start from a known vector, say x1 and end
with another say x2- also suppose all the sequences will be the same length.
I don't want to use a for loop
x1<-c(1,2,3,4); x2<-(3,4,5,6);
what I want is
1 2 3 4
2 3 4 5
3 4 5 6
Thanks
-----
Yasir H. Kaheil
Columbia University
--
View this message in context:
2013 Jan 02
4
list of matrices
dear useRs,
i have a list containing 16 matrices. i want to calculate the column mean of each of them.
i tried
>sr <- lapply(s,function(x) colMeans(x, na.rm=TRUE))
but i am getting the following error
>Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric
can it be done in any other way? and why i am getting this error??
thanks in advance..
elisa
[[alternative
2008 Aug 11
2
generating a random signal with a known correlation
Hi,
How can I generate a random signal that's correlated with a given signal at
a given correlation (say 0.7)?
I've been looking at rmvnorm etc but don't seem to figure it out. Thanks
-----
Yasir H. Kaheil
Columbia University
--
View this message in context: http://www.nabble.com/generating-a-random-signal-with-a-known-correlation-tp18932541p18932541.html
Sent from the R help
2008 May 06
3
Spatial join between two datasets using x and y co-ordinates
Hi R users
I am trying to create a spatial join between two datasets.
The first data set is large and contains descriptive data including x
and y co-ordinates.
The second dataset is small and has been selected spatially. The only
data contained within the second dataset is the x and y coordinates only
i.e. no descriptive data.
The aim of a join made between the two datasets is to select
2013 Jan 04
2
"By" function Frame Conversion (with Multiple Indices)
Hello,
I have the following dataset. Please note that there are missing values on
records 4 and 5:
id,age,weight,height,gender
1,22,180,72,m
2,13,100,67,f
3,5,40,40,f
4,6,42,,f
5,12,98,66,
6,50,255,60,m
I'm using the "By" function like this:
list1 <- by(dataset[c("weight", "height")],
dataset[c("age", "gender")],
2012 Dec 08
3
Mean-Centering Question
Hello,
I'm trying to create a custom function that "mean-centers" data and can be
applied across many columns.
Here is an example dataset, which is similar to my dataset:
*Location,TimePeriod,Units,AveragePrice*
Los Angeles,5/1/11,61,5.42
Los Angeles,5/8/11,49,4.69
Los Angeles,5/15/11,40,5.05
New York,5/1/11,259,6.4
New York,5/8/11,187,5.3
New York,5/15/11,177,5.7
2012 Aug 30
2
Identifying and Removing NA Columns and factor Columns with more than x Levels
Hi,
How do you subset a dataframe so that you only have columns:
1. that contain one or more NAs?
2. that contain factors with greater than or equal to 32 levels?
How do you remove from a dataframe columns**
3. with one or more NA's?
4. that contain factors with greater than or equal to 32 levels?
** I know how to remove columns at a basic level but I am trying
2012 Aug 06
2
deleting columns from a dataframe where NA is more than 15 percent of the column length
I have a dataframe of 10 different columns (length of each column is
the same). I want to eliminate any column that has 'NA' greater than
15% of the column length. Do i first need to make a function for
calculating the percentage of NA for each column and then make another
dataframe where i apply the function? Whats the best way to do this.
2013 Feb 21
1
remove rows in data frame by average
Dear all,
I have a data frame, which looks like this:
Subject | Block | Trial | Feature1 | Feature2 ....
1 | 1 | 1 | ... | ...
1 | 1 | 2 | ... | ...
1 | 2 | 1 | ... | ...
1 | 2 | 2 | ... | ...
1 | 3 | 1 | ... | ...
...| ...| ...| ... | ...
Can I remove the "Trial" column by averaging all the rows and without using
a "for loop"?
At the end my data frame should look like
2009 Jul 15
1
Simulation code error
Dear List,
I have some problem with my simulation code. Here is output from R:
> sim.sp <- function(data,CM,n,N)
+ {
+ C <- matrix(rep(NA,N),ncol=1)
+ for(i in 1:N)
+ {
+ j <- n
+ xx <- which(colSums(CM[j,])==1)
+ V <- names(xx)
+ V <- paste(V, collapse="+")
+ V <- paste("SBA~", V)
+ rd <- round(nrow(data)*(2/3))
+ d <-
2013 Jan 05
5
Need help on dataframe
Dear R users, I came up to a problem by taking means (or other summary
statistics) of a big dataframe.
Suppose we do have a dataframe:
ID V1 V2 V3 V4 ........................ V71
1 6 5 3 2 ........................ 3
2 3 2 2 1 ........................ 1
3 6 5 3 2 ........................ 3
4 12 15 3 2 ........................ 100
2009 Jul 15
1
Error in simulation R-code
Dear List,
I have got error message when I run the R-code. Can anyone has a suggestion?
v.code <- df.bm7[,c(10:31)]; v.code[1:3,]
names(v.code)
CM = v.code # variable binomial code
sim.sp <- function(data,CM,n,N)
{
C <- matrix(rep(NA,N),ncol=1)
for(i in 1:N)
{
j <- n
xx <- which(colSums(CM[j,])==1)
V <- names(xx)
V <- paste(V,
2012 Dec 06
1
"Simplifying" matrices ?
Hi again,
the previous answers were great. I was able to do what was planned.
Now, I would like to do the following to a matrix:
|| year | event | team | total ||
where I can have multiple "event" per "team", but each "team" only has
a "year" and a "total". Thus, this table has multiple lines for the
same "team" where only the
2010 Jun 18
3
ploting dots with quentiles
http://r.789695.n4.nabble.com/file/n2260087/%E6%8D%95%E8%8E%B7.png
I am going to plot my data set like this, with means and 25% & 75%
quentiles.
I've tried "boxplot", but the output is not what I want. Should I use other
functions? Thanks
--
View this message in context: http://r.789695.n4.nabble.com/ploting-dots-with-quentiles-tp2260087p2260087.html
Sent from the R help
2016 Apr 14
3
Unequal column lengths
Hello,
I?ve tried several times to learn R, but have never gotten past a particular gate. My data are organized by column in Excel, with column headers in the first row. The columns are of unequal lengths. I export them as CSV, then import the CSV file into R. I wish to summarize the data by column. R inserts NA for missing values, then refuses to operate on columns with NA. R is importing