Displaying 20 results from an estimated 20000 matches similar to: "Drop matching lines from readLines"
2010 Oct 14
1
Basic data question
I have a question about the output given below after running few lines of
code. Surely a 101 query!
MF_Data <- read.csv("MF_Data_F.txt", header = F, sep="|")
temp <- head(MF_Data) #Get the sample Data
temp1 <- subset(temp, select= c(V1,V4,V6)) #where V1, V4, V6 are the col
names .. to Get the relevant data
names(temp1) <- c('Ticker',
2010 Sep 17
7
removing specific rows from array
I'm attempting to create an array of treatment comparisons for modelling data generation. This involves comparison of one treatment (c2) with another (c3), relative to a common comparator (c1).
Attached code gives me the correct array but need to remove duplicates. Duplicates relate only to c2 and c3
such that I need to remove
r3 because c2 and c3 are same as r1 with c2 and c3 swapped
r5
2011 Mar 17
3
Flexible rbind
Dear All,
I am trying to create a empty structure that I want to fill gradually
through the code.
I want to use something like rbind to create the basic structure first.
I am looking for a possibility to do an rbind where the columns names
dont match fully (but the missing columns can be defaulted to either
zero or n/a) (my actual data has a lot of columns).
Please see the data frames below
I
2010 Oct 14
5
Replacing N.A values in a data frame
Hello, I have a data frame as below ... in cases where I have N.A. I want
to use an average of the past date and next date .. any help?
13/10/2010 A 23
13/10/2010 B 12
13/10/2010 C 124
14/10/2010 A 43
14/10/2010 B 54
14/10/2010 C 65
15/10/2010 A 43
15/10/2010 B N.A.
15/10/2010 C 65
----------------------------------------------------------------------------
--------------------------
Thanks
2010 Nov 03
4
Drawing circles on a chart
Dear Group,
I have the following data matrix which is a timeseries.
> dput(tData)
structure(list(A = c(0.2, 0.13, 0.05, 0.1, 0.02, 0.18, 0.09,
0.06, 0.13), B = c(0.15, 0.06, 0.09, 0.02, 0.03, 0.12, 0.01,
0.15, 0.06), C = c(-0.1, 0, -0.07, -0.06, -0.05, -0.05, -0.06,
-0.08, -0.07), D = c(-0.15, -0.05, -0.1, -0.03, -0.13, -0.04,
-0.1, -0.04, -0.15), E = c(-0.17, -0.16, -0.08, -0.07, -0.09,
2010 Nov 09
3
Row-wise recurive function call
Dear Group,
I have a following dataset:
> a
A B C D
1 22 3 31 40
2 26 31 36 32
3 3 7 49 16
4 24 40 27 26
5 20 45 47 0
6 34 43 11 18
7 48 48 24 2
8 3 16 39 48
9 20 49 7 21
10 17 36 47 10
> dput(a)
structure(list(A = c(22L, 26L, 3L, 24L, 20L, 34L, 48L, 3L, 20L,
17L), B = c(3L, 31L, 7L, 40L, 45L, 43L, 48L, 16L, 49L, 36L),
C = c(31L, 36L, 49L, 27L, 47L, 11L, 24L,
2010 Oct 22
2
If Statement with more than one condition
I'm unable to find the OR operator like other language .. any suggestions?
I want to do If (condition1 OR condition 2){ do something }
Thanks for answering this elementary question.
[[alternative HTML version deleted]]
2010 Oct 27
5
Best IDE for R
Dear R-Group,
I am looking for suggestions for the "best" IDE for R. Best is obviously
subjective but I need just the basic features that should function well (and
I looked through the threads already).
- Proper integration with R 2.11.1
- Good key shortcuts ... similar to the R Gui
- Manageability of Projects, etc.
- Neat formatting features
I tried Revolution R but it seems huge in
2010 Dec 03
2
data.table query
Hello Group,
I need a modification in the data.table example to get my intended
result shown below ... is there a more simple way!
dt <- data.table(A = rep(1:3, each=4), B = rep(1:4, each=3), C = rep(1:2, 6))
dt[, transform(.SD,D=mean(A)), by="B"]
The result I want is below ... which is probably long winded!
data.table(unique(as.data.frame(dt[, transform(.SD,D=mean(A)),
2010 Dec 03
3
colname refered by a variable
Hello,
I tried to use a variable to refer colname, but I got error, could anyone give me advice?
>df=data.frame(cbind(AB=1:3,AC=3:5))
> df$AC
[1] 3 4 5
> df$paste("A","C",sep="")
Error: attempt to apply non-function
thanks
Jian
[[alternative HTML version deleted]]
2010 Dec 05
3
grep for strings
I am trying to find the function where I can search for a pattern in a
text string (I thought I could use grep for this but no :().
> x
[1] "abcdefghijkl"
I want to find the positions (i.e. equivalent of nchar) for "cd" and
in case there are multiple hits .. then the results as a array
Thank you.
2010 Oct 11
3
Dataset Transformation
I need to transpose the following input dataset into an output dataset like
below
Input
Date
TICKER
Price
11/10/2010
A
0.991642
11/10/2010
B
0.475023
11/10/2010
C
0.218642
11/10/2010
D
0.365135
12/10/2010
A
0.687873
12/10/2010
B
0.47006
12/10/2010
C
0.533542
12/10/2010
D
0.812439
13/10/2010
A
0.210848
13/10/2010
B
0.699799
13/10/2010
C
2010 Nov 12
2
Time Delay / Wait
Hi Group,
Is there something like a delay function based on System time or equivalent?
I basically am generating a few graphs and I would like to see each graph
for say 2mins before moving on to the next one?
I can always have an empty for-loop I guess but is there a better way?
Thanks,
S
2010 Dec 07
2
Time out for a R Function
Hello Group,
I have an R-function that works fine for most part but sometime runs into a
long loop! (I'm lazy and short on time to debug right now so want to do
something easy)
For my purpose, it is ok to make few errors .... is there a way I can put a
timeout on a function and the r-process needes to move on to the next step?
Thank you.
S
2010 Nov 09
2
Creating a list to store output objects from a recursive loop
Dear Group,
I am having a function that I am running in a loop that generated two
results for each loop
The result1 is a zoo object
The result2 is a data frame
Now I want to put both of them in a list or some structure ... that I can
access or output to a file after the loop is done.
For e.g.
for (i in 1:20){
niceFunction(x[i],i)
}
niceFunction (x,i) {
result1 = someOperations() #zoo
2011 Apr 18
1
Print out data frames into neat images
Hi Group,
I often need to print out data frames with results of analysis into a
neat little image to copy and paste into documents. I need apply
formatting like bold, currency signs, number formats, header shading
etc.
I currently output the data into csv and format using good old excel.
Any suggestions if there are packages to help with such activities (to
some level of basic functionality).
I
2010 Nov 12
3
Deploying code as exe
Dear Group,
Is there some way for me to package a few lines of R-code as exe and have it
running in the background? (unable to find info in the archives)
Even better if I can package it as an installation and send to my team who
do not have any background in programming / R? If they can install and run
the exe ... it would suffice.
Thanks,
S
2010 Nov 01
2
write.csv changes the format of the date
Dear Group,
Why does write.csv modify the date format when it write to a file.
I have the following variable Param_Dat:
dput(Param_Dat)
structure(list(Last_Successful_Run = structure(1L, .Label = "30/10/2010",
class = "factor")), .Names = "Last_Successful_Run", class = "data.frame",
row.names = c(NA,
-1L))
When I do:
2011 Feb 22
2
read.table
Hi Group,
I am having a strange problem for this simple task.
I am using read.table to read a plan 3 column CSV file . the file is getting
read .
But the first column has datetime in the csv file in the following format:
20110221.114041
But this is being read as 20110221 only . the time portion (decimal is
missing) in the data frame
Any idea why?
Thanks,
Santosh
2010 Nov 02
3
Using R for Production - Discussion
Hello Group,
This is an open-ended question.
Quite fascinated by the things I can do and the control I have on my
activities since I started using R.
I basically have been using this for analytical related work off my desktop.
My experience has been quite good and most issues where I need to
investigate and solve are typical items more related to data errors, format
corruption, etc... not