similar to: Split data

Displaying 20 results from an estimated 30000 matches similar to: "Split data"

2009 Aug 26
6
Managing output
Hi, Is there a way to build up a vector, item by item. In perl, we can "push" an item onto an array. How can we can do this in R? I have a loop that generates values as it goes. I want to end up with a vector of all the loop results. In perl it woud be: for(item in list){ result <- 2*item^2 (Or whatever formula, this is just a pseudo example) Push(@result_list,
2010 Mar 18
1
Using a function to consolidate variables
Dear List, I'm getting the error: object of type 'closure' is not subsettable And am not sure how to get around the problem. I've included two short code sets below. One that shows what I want to do and works, but without using the function much, and another that tries to use the function but causes the error. # THIS WORKS AND SHOWS WHAT I'D LIKE TO DO a <- c(1,2,3) b
2009 Mar 07
4
merge data frames with same column names of different lengths and missing values
Hello, I'm switching over from SAS to R and am having trouble merging data frames. The data frames have several columns with the same name, and each has a different number of rows. Some of the values are missing from cells with the same column names in each data frame. I had hoped that when I merged the dataframes, every column with the same name would be merged, with the value in a complete
2011 Feb 17
2
sort by column and row names
Hello, All, How can one sort on column and row names. For example: How can this X1 X3 X2 X1 1 0 0 X3 0 1 0 X2 0 0 1 become this? X1 X2 X3 X1 1 0 0 X2 0 1 0 X3 0 0 1 Thank you for your time! Jim [[alternative HTML version deleted]]
2010 Oct 01
3
Suppressing printing in the function
Hello! I wrote a function that returns a data frame. Nowhere in the function do I say print(my.data.frame), but when I run the function - the data frame is printed on the console. Is there any way to suppress it? Thank you! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com
2009 Dec 08
3
re-ordering x-lables using barchart()
Hi R Users, I'm trying to re-order the "site names" ("Waseca", "Morris", ...). I'm using following code: libarry(lattice) barchart(yield ~ variety | site, data = barley, groups = year, layout = c(6,1), aspect=.7, ylab = "Barley Yield (bushels/acre)", scales = list(x = list(abbreviate = TRUE, rot=45,
2010 Jul 28
2
read.delim()
I am reading in a very large file with names in it and R is truncating the number of rows it reads in. The separator in this file is a pipe '|' and so I use dat <- read.delim('pathToMyFile', header= TRUE, sep='|') It turns out that it is reading up to row 61145 and stopping and I think I see why, but am not sure of the best solution to this problem. I see the name of
2011 May 24
2
Extracting day of month from Date objects
I've always found the chron library to be useful for tasks like this: > x <- round(runif(10)*100000, digits=0) > y <- as.Date(x, origin="1970-01-01") > library(chron) > days(y) [1] 7 25 26 25 10 24 1 31 12 8 31 Levels: 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < ... < 31 Notice that it returns the days as
2009 Mar 11
4
R-help: grep in for loop using index - doesn't work
Hi everyone I am trying to use grep in a for loop to compare a string value. It works if I use the actual index value but when I use the for loop index, it doesn't work. Any suggestions plz. Here is the code: data <- read.table(file="Sigmoid.csv", head=FALSE, sep=","); c1 <- data$V1 c2 <- data$V2 c3 <- data$V3 c1data <- data.frame(c1); c2data <-
2010 Oct 28
2
Determining a basal correct count
Here's another interesting problem: if you recall I have a data frame (LCvars1) that consists of about 1500 cases (rows) of data from kids who took a test of listening comprehension. The columns are their scores (1 = correct, 0 = incorrect, . = missing) on 140 test items. The items are numbered sequentially and are ordered by increasing difficulty as you go from left to right across the
2010 Nov 29
3
List elements of NULL to value
Hi everyone, I am posting this because i know its easy and i cant for the life of me figure out how to do it though i have tried and through a ridiculously complex loop made it happen. I need to convert some list elements of NULL value to 0s so they mesh with my data frame properly. So for A<-list(1,NULL) returns [[1]] [1] 1 [[2]] NULL Would instead return [[1]] [1] 1 [[2]] [1] 0
2010 Sep 13
2
proportion
Hi , SO i have been on a role of asking simple questions lately. So much for feeling like im getting this R business. I wrote a script 2 weeks ago that utilized "proportion" to turn values in a table (from "table") into proportions to then graph. I now get an error that proportion is not a function so im confused. I ran the script a few times and im thinking maybe i had
2010 Feb 13
2
lm function in R
Hello, I am trying to learn how to perform Multiple Regression Analysis in R. I decided to take a simple example given in this PDF: http://www.utdallas.edu/~herve/abdi-prc-pretty.pdf I created a small CSV called, students.csv that contains the following data: s1 14 4 1 s2 23 4 2 s3 30 7 2 s4 50 7 4 s5 39 10 3 s6 67 10 6 Col headers: Student id, Memory span(Y), age(X1), speech rate(X2) Now
2009 Oct 04
2
Row to Column help
Dear R Community, I am attempting to transpose a dataset from rows to columns but am stuck. I have tried using reshape() with little luck, possibly due to the categorical nature of the data. For example: id<-c(1,2,2,3,3,3) author<-c("j","k","k","l","l","l")
2009 Aug 07
3
Simple Question: adding points to a boxplot
I apologize in advance for the simplicity of this question. I use R 2-3 times a year, and I seem to forget more in the intervening months than I learn during my days of panicked reading.... I HAVE tried looking at the help resources; I'm just not very good at understanding them. I have a dataframe with 18 observations of 5 different things, and a second dataframe with and estimate for those
2006 Nov 01
3
matrix manipulation with a for loop
Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to extract from each column the percent of days within an specific range, so I've wrote this procedure: length(subset(F.zoo[,86],(F.zoo[,86]>=5) & (F.zoo[,86]<= 9)))/(length(F.zoo[,86])-length(subset(F.zoo[,86],is.na(F.zoo[,86]))))*100 But to do this for each column (189) is pretty hard, so I want
2008 May 07
6
help with the unique function
Hi, The unique function is easy to understand and use. Beyond that, I want to get also the frequency of repetition of each individual row in a data frame Let me explain with an example : x<-data.frame(a=c(1,2,3,1,2),b=c(2,3,4,2,3),c=c(10,20,30,10,20)) xu<-unique(x) We have, > x ? a b? c 1 1 2 10 2 2 3 20 3 3 4 30 4 1 2 10 5 2 3 20 > xu ? a b? c 1 1 2 10 2 2 3 20 3 3 4 30 I want to get
2009 Jul 28
1
how to load packages from different location
Dear list: I know this may be an old question. I know how to install the packages to a different directory, for example, /home/zrl/tmp and I know how to load it >library("genefilter",lib.loc="/home/zrl/tmp") but I found some package(for example package A) will have to load some other packages as well, and this time package A will look for the package in the original
2009 Dec 17
1
Problem reading binaries created with fortran (More infos)
The structure of the file is clear (see below) the first line is made of integers and doubles with the fifth being a text string followed by arrays of double precision number.: int1 int2 double1 double2 text int3 int4 int5 (array of double) here is an example of file: 1 1 1.0 1.0 "HEAD" 160 224 3 23.4 34.5 ...... I tried to read the first line with readBin (results are copied below):
2008 May 01
3
how to not sort factors when plotting
Hello, When making a graph, plot and boxplot automatically sort my factor levels (y axis) into alphabetical order. Is there a way to make it NOT do this? I've tried: sort.by="none", sorted=FALSE, sort=FALSE, reorder=FALSE. Thank you.