Displaying 20 results from an estimated 6000 matches similar to: "reading a file"
2009 Jul 27
3
numbers on barplot
Hello all,
I have this simple barplot code:
ifn <- "id.dat"
dat <- read.table(ifn)
ofn <- "id.png"
bitmap(ofn, type = "png256", width = 30, height = 30, pointsize = 30, bg =
"white",res=50)
par(mar=c(5, 5, 3, 2),lwd=5)
par(cex.main=1.6,cex.lab=1.6,cex.axis=1.6)
names(dat)<-c("NumberOfPeople","Average")
2009 Aug 06
2
Ylim
Hello All:
Can anybody tell me what is the problem with my program please. I have an
error message as appears below.
My program is:
ifn <- "Jul08_09.LM"
data <- read.table(ifn)
ofn <- "Jul.png"
bitmap(ofn, type = "png256", width = 30, height = 30, pointsize = 30, bg =
"white",res=50)
par(mar=c(5, 5, 3, 2),lwd=5)
2009 Aug 13
1
reading a string
Hello All:
I am having the following data file named "data.dat"
Number of people
Number of pets
Age of trees
ifn <- "data.dat"
dat <- read.table(ifn)
colnames(dat)<-c("Variables")
I want R to read all these in a string but when I ask R to read these,
it gives me error because there more than one word in each line. Any
comments to solve this problem?
2010 May 13
1
ESP Ghostscrip ...
Hello All:
Could anybody tell me please what is the meaning of this error message:
ESP Ghostscript 815.02: Unrecoverable error, exit code 1
Error in plot.xy(xy, type, ...) : ignoring SIGPIPE signal
Calls: plot -> plot.default -> plot.xy
Execution halted
My code has to go to 18 loops for three times and in each loop it has to
read a file which is 100-300 Megs. It always crashes at loop 14
2010 Mar 22
1
Replacing elements of list
Dear all,
I have following two list object, both are basically collection of matrices
:
dat1 <- matrix(rnorm(25*6), ncol=6)
dat1 <- split(dat1, seq(5,25,by=5))
dat1 <- lapply(dat1, matrix, ncol=6)
dat2 <- matrix(rnorm(25*4), ncol=4)
dat2 <- split(dat2, seq(5,25,by=5))
dat2 <- lapply(dat2, matrix, ncol=4)
Now I want to replace last 4 columns of each matrix at "dat1"
2012 Jul 01
2
list to dataframe conversion-testing for identical
HI R help,
I was trying to get identical data frame from a list using two methods.
#Suppose my list is:
listdat1<-list(rnorm(10,20),rep(LETTERS[1:2],5),rep(1:5,2))
#Creating dataframe using cbind
dat1<-data.frame(do.call("cbind",listdat1))
colnames(dat1)<-c("Var1","Var2","Var3")
#Second dataframe conversion
2010 Mar 30
2
Need help to split a given matrix is a "sequential" way
I need to split a given matrix in a sequential order. Let my matrix is :
> dat <- cbind(sample(c(100,200), 10, T), sample(c(50,100, 150, 180), 10,
> T), sample(seq(20, 200, by=20), 10, T)); dat
[,1] [,2] [,3]
[1,] 200 100 80
[2,] 100 180 80
[3,] 200 150 180
[4,] 200 50 140
[5,] 100 150 60
[6,] 100 50 60
[7,] 100 100 100
[8,] 200 150 100
[9,]
2008 Mar 25
2
Compare two data sets
I would like to compare two data sets saved as text files (example below) to determine if both sets are identical(or if dat2 is missing information that is included in dat1) and if they are not identical list what information is different between the two sets(ie output "a1", "a3" as the differing information). The overall purpose would be to remove "a1" and
2008 May 11
1
Finding unmatched data between two dataframe using several factors
Hi R users
I am trying to find unmatched data from two dataframes. I would like to
find unmatched data based on several factors. For the following data:
dat1 <- data.frame(x = paste("A", 1:6, sep=""),
y = c("andy","bob","ciaran","dan", "eion",
"fred"))
dat1
dat2
2005 Dec 29
1
S4 classes: referencing slots with other slots
For those who suggest other ways to do this, I ALREADY HAVE ANOTHER
DESIGN SOLUTION, DESCRIBED AT THE END.
That being said, I want to know if it's possible to reference a slot
in an S4 class from another slot, i.e. I'd like to have the "self.*"
semantics of Python so that I can reuse a slot. That is, for various
reasons it would be nice to be able to do something like:
2012 Jun 07
3
conditional statement to replace values in dataframe with NA
Hello and thanks for helping.
#some data
L3 <- LETTERS[1:3]
dat1 <- data.frame(cbind(x=1, y=rep(1:3,2), fac=sample(L3, 6, replace=TRUE)))
#When x==1 and y==1 I want to replace the 1 values with NA
#I can select the rows I want:
dat2<-subset(dat1,x==1 & y==1)
#replace the 1 with NA
dat2$x<-rep(NA,nrow(dat2)
dat2$y<-rep(NA,nrow(dat2)
#select the other rows and rbind
2010 Feb 17
2
array question
Hello All:
If I do have:
x = (2, 4, 5, 5, 6, 4, 5, 2, 1)
y = (9, 11.5, 12.5, 13, 14, 19, 20, 21, 22)
I wanted to find a simple function in R which calculates the averages of X
and Y for every 4 unit increase of Y. The results should look like:
x = (4, 6, 3) #where (2+ 4+ 5+ 5)/ 4 = 4 and ...
y = (12, 14, 20.5) #where (9+11.5+12.5+13)/ 4 = 12 and ...
Thanks,
Mohsen
2011 May 17
1
Subsetting depth profiles based on maximum depth by group with plyr
Hello,
Apologies for a similar earlier post. I didn't include enough details in
that one.
I am having a little trouble subsetting some data based on a grouping
variable. I am using an instrument that does depth profiles of a water
column. The instrument records on the way down as well as the way up. So
thanks to an off-list reply I can subset the data so that all data collected
at the
2007 Jun 23
2
Names of objects passed as ... to a function?
Dear list,
I have a function whose first argument is '...'. Each element of '...'
is a data frame, and there will be at least 2 data frames in '...'. The
function processes each of the data frames in '...' and returns a list,
whose components are the processed data frames. I would like to name the
components of this returned list with the names of the original data
2009 Aug 07
1
RMySQL - overwrite record, not table
Hi, useR-
In RMySQL, how do I overwrite records? (equivalent to "replace" query).
For example, suppose that dat2 is a newer data.frame than dat1.
con <- dbConnect(MySQL())
res <- dbWriteTable(con, "DBname", dat1, row.names=F, append=T, replace=T)
res <- dbWriteTable(con, "DBname", dat2, row.names=F, append=T, replace=T)
This would not update/replace the
2006 Sep 27
2
Histogram
Dear all,
I want to design a histogram and I need to have the frequency at certain
points. For example I have the following 2 columns:
*X Y*
0.1 25
0.4 22
0.45 11
0.55 21
I want the chart to have 4 columns. First column is from 0.0-0.1 (on X) and
frequency is 25. Next colum is wider and form 0.1-0.4 with 22 frequency.
Next column is narrow with 11 frequency and the last column is
2013 Apr 29
1
how to add new rows in a dataframe?
Hi,
dat1<- read.table(text="
id??????????????? t???????????????????? scores
2???????????????? 0??????????????????????? 1.2
2???????????????? 2???????????????????????? 2.3
2???????????????? 3??????????????????????? 3.6
2???????????????? 4??????????????????????? 5.6
2???????????????? 6??????????????????????? 7.8
3???????????????? 0??????????????????????? 1.6
3????????????????
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 <-
2004 Jul 16
3
sas to r
I would be incredibly grateful to anyone who'll help me translate some
SAS code into R code.
Say for example that I have a dataset named "dat1" that includes five
variables: wshed, site, species, bda, and sla. I can calculate with the
following SAS code the mean, CV, se, and number of observations of
"bda" and "sla" for each combination of
2013 Jan 04
2
Can you help me please
HI Fares,
You could try this:
dat1<- read.table(text="
date????? donation
3jan2003?? 20235
4jan2003?? 25655
5jan2003?? 225860
6jan2003?? 289658
7jan2003?? 243889
8jan2003?? 244338
9jan2003?? 243889
",sep="",header=TRUE,stringsAsFactors=FALSE)
The post is not very specific as to what you need.? I hope this works for you.
library(xts)