similar to: Insert rows - how can I accomplish this in R

Displaying 20 results from an estimated 10000 matches similar to: "Insert rows - how can I accomplish this in R"

2006 Aug 25
5
Quickie : unload library
Dear list, I know it must be obvious and I did my homework. (In fact I've RSiteSearched with keyword "remove AND library" but got timed out.(why?)....) How do I unload a library? I don't mean getting ride of it permanently but just to unload it for the time being. A related problem : I have some libraries loaded at startup in .First() which I have in .Rprofile. Now, I exited R
2008 Mar 24
6
vlookup in R
Hi, Is there are function similar to excel vlookup in R. Please let me know. Thanks, Sachin ____________________________________________________________________________________ [[alternative HTML version deleted]]
2006 Sep 15
2
prediction interval for new value
Hi, 1. How do I construct 95% prediction interval for new x values, for example - x = 30000? 2. How do I construct 95% confidence interval? my dataframe is as follows : >dt structure(list(y = c(26100000, 60500000, 16200000, 30700000, 70100000, 57700000, 46700000, 8600000, 10000000, 61800000, 30200000, 52200000, 71900000, 55000000, 12700000 ), x = c(108000, 136000,
2006 May 23
5
conditional replacement
Hi How can do this in R. >df 48 1 35 32 80 If df < 30 then replace it with 30 and else if df > 60 replace it with 60. I have a large dataset so I cant afford to identify indexes and then replace. Desired o/p: 48 30 35 32 60 Thanx in advance. Sachin
2010 Feb 22
9
Couldn't find Order with ID=pending_orders
I have a Controller named Orders which has a pending_orders method which is expected to fetch some records from the database. If i dont write a route for this method, I get the following error when i call this method. Couldn''t find Order with ID=pending_orders I am using rails 2.3.5, in the previous versions i use to get this I am not getting whether its new version requirement... Help
2008 May 13
2
Plotting Frequency Distribution in R
Hi, How can plot a frequency distribution curve for the following data.    V1      V2 1   1 160.54% 2   1 201.59% 3   1  18.45% 4   1 179.03% 5   1 274.37% 6   1   0.00% 7   1  24.52% 8   1  39.17% 9   3  43.72% 10  1  53.06% 11  1  64.97% 12  1  79.84% 13  1  98.08% 14  1 115.32% 15  1 127.96% 16  1 155.38% 17  1 157.25% 18  1 193.17% 19  1  51.53% 20 15  99.32% 21  1 106.86% 22  1 219.44%
2006 Aug 18
2
dataframe of unequal rows
Hi, How can I read data of unequal number of observations (rows) as is (i.e. without introducing NA for columns of less observations than the maximum. Example: A B C D 1 10 1 12 2 10 3 12 3 10 4 12 4 10 5 10 Thanks in advance. Sachin --------------------------------- [[alternative HTML version deleted]]
2006 Jul 14
2
Recreate new dataframe based on condition
Hi, How can I achieve this in R. Dataset is as follows: >df x 1 2 2 4 3 1 4 3 5 3 6 2 structure(list(x = c(2, 4, 1, 3, 3, 2)), .Names = "x", row.names = c("1", "2", "3", "4", "5", "6"), class = "data.frame") I want to recreate a new data frame whose rows are sum of (1&2, 3&4, 5&6)
2006 Apr 21
3
Creat new column based on condition
Hi, How can I accomplish this task in R? V1 10 20 30 10 10 20 Create a new column V2 such that: If V1 = 10 then V2 = 4 If V1 = 20 then V2 = 6 V1 = 30 then V2 = 10 So the O/P looks like this V1 V2 10 4 20 6 30 10 10 4 10 4 20 6 Thanks in advance. Sachin
2006 Apr 20
2
Conditional Row Sum
Hi, How can I accomplish this in R. Example: R1 R2 3 101 4 102 3 102 18 102 11 101 I want to find Sum(101) = 14 - i.e SUM(R1) where R2 = 101 Sum(102) = 25 - SUM(R2) where R2 = 102 TIA Sachin --------------------------------- [[alternative HTML version deleted]]
2006 Jul 06
2
KPSS test
Hi, Am I interpreting the results properly? Are my conclusions correct? > KPSS.test(df) ---- ---- KPSS test ---- ---- Null hypotheses: Level stationarity and stationarity around a linear trend. Alternative hypothesis: Unit root. ---- Statistic for the null hypothesis of level stationarity: 1.089 Critical values: 0.10 0.05 0.025 0.01 0.347 0.463
2008 May 03
1
recode involving a count rule
Hello, R-helpers. I have a data frame below called df. I want to add a variable c, based on the following logic: if df$a < 5 then the first two times this condition is met place a 1 in c, the next two times this condition is met place a 2 in c and when the condition is not met let c equal df$b. The result would look like, dfnew, shown below. a <- rep(c(3,5,7), 4) b <- rep(c(NA,1,2),
2008 Jan 24
2
boxplot axis labelling
Hi, i'm very new to R, so sorry for what i'm sure is a very basic question. I'm producing a boxplot with the data below: df3<-data.frame( x=c(10,11,115,12,13,14,16,17,18,21,22,23,24,26,27,28,29,3,30,32,33,34,35,4,4 1,45,5,50,52,56,58,6,67,6738,68,7,8,9), fq=c(8,11,1,2,4,4,2,2,6,3,4,2,2,1,1,1,4,51,3,1,1,1,1,35,1,1,19,2,1,1,1,14,1, 1,1,10,13,5),
2009 Aug 12
4
paste first row string onto every string in column
Hi, I am trying to edit a data frame such that the string in the first line is appended onto the beginning of each element in the subsequent rows. The data looks like this: > df V1 V2 V3 V4 1 DPA1* DPA1* DPB1* DPB1* 2 0103 0104 0401 0601 3 0103 0103 0301 0402 . . and what I want is this: >dfnew V1 V2 V3 V4 1 DPA1* DPA1* DPB1* DPB1* 2 DPA1*0103
2017 Nov 01
0
Adding Records to a Table in R
Hi Paul, #First I set up some sample data since I don't have a copy of your data dtOrig <- as.Date( c("1985-04-01","1985-07-01","1985-12-01","1986-04-01")) dfOrig <- data.frame( TransitDate=dtOrig, Transits=c(100,100,500,325), CargoTons=c(1000,1080,3785,4200) ) #Generate the complete set of dates as a data frame dfDates<- data.frame(
2006 Apr 24
1
Handling large dataset & dataframe [Broadcast]
Here's a skeletal example. Embellish as needed: p <- 5 n <- 300 set.seed(1) dat <- cbind(rnorm(n), matrix(runif(n * p), n, p)) write.table(dat, file="c:/temp/big.txt", row=FALSE, col=FALSE) xtx <- matrix(0, p + 1, p + 1) xty <- numeric(p + 1) f <- file("c:/temp/big.txt", open="r") for (i in 1:3) { x <- matrix(scan(f, nlines=100), 100,
2006 Jun 26
2
write.table & csv help
Hi, How can I produce the following output in .csv format using write.table function. for(i in seq(1:2)) { df <- rnorm(4, mean=0, sd=1) write.table(df,"C:/output.csv", append = TRUE, quote = FALSE, sep = ",", row.names = FALSE, col.names = TRUE) } Current O/p: x 0.287816 -0.81803 -0.15231 -0.25849 x 2.26831 0.863174
2006 Apr 24
6
Handling large dataset & dataframe
Hi, I have a dataset consisting of 350,000 rows and 266 columns. Out of 266 columns 250 are dummy variable columns. I am trying to read this data set into R dataframe object but unable to do it due to memory size limitations (object size created is too large to handle in R). Is there a way to handle such a large dataset in R. My PC has 1GB of RAM, and 55 GB harddisk space running
2006 May 18
1
write.csv + appending output (FILE I/O)
Hi, How can I write the output to an excel (csv) file without printing row names (i.e without breaks). Here is my code: library( fn <- function() { q <- c(1,2,3) write.csv(q,"C:/Temp/op.xls", append = TRUE, row.names = FALSE,quote = FALSE) } # Function Call for(i in 1:3) { fn() } Present Output : x 1 2 3 x 1 2
2006 Aug 21
1
Dataframe modification
Hi, How can I accomplish this in R. I have a Dataframe with 3 columns. Column B and C have same elements. But column A has more elements than B and C. I want to compare Column A with B and do the following: If A is not in B then insert a new row in B and C and fill these new rows with B = A and C = 0. So finally I will have balanced dataframe with equal no of rows (entries) in