Displaying 20 results from an estimated 20000 matches similar to: "Q: changing the class of an object"
2018 Apr 17
2
Time intervals in a datframe
Hi all
I have a list of multiple datframes with the same column headers. The last column in each datframe contains a vector of "Interval" class after I have produced this column using "lubridate" package. I needed to convert my list of dataframes to be in a single dataframe for further analysis. I did this using the following syntax :
SingleDataframe <- ldply
2018 Apr 17
0
Time intervals in a datframe
> On Apr 17, 2018, at 10:10 AM, Allaisone 1 <allaisone1 at hotmail.com> wrote:
>
>
> Hi all
>
> I have a list of multiple datframes with the same column headers. The last column in each datframe contains a vector of "Interval" class after I have produced this column using "lubridate" package. I needed to convert my list of dataframes to be in a single
2005 May 24
2
reading multiple files
Dear All,
How do I read in multiple data frames or matrices in a
loop, e.g.
for (i in 1:n) {
channel <- odbcConnectExcel("filenames")
file[i] <- as.data.frame(sqlFetch(channel,
"sheet"))
}
I would like file[i] to be the name of the data.frame
(i.e. file[1], file[2], file[3],...etc) rather than a
vector.
Thanks in advance for any help.
Dave
2003 Jul 19
1
Method 'EvaluateNoReturn' of object 'IStatConnector' failed
Hi All,
I am using the R ActiveX component (v1.2). I have written a custom function
in R which returns a dataframe. I want to be able to retrieve the contents
of the returned dataframe in my application.
Here is a snippet of the code (line that throws exception). X has been
correctly declared and init'ed earlier on in the code.
x.EvaluateNoReturn("results_frame <-
2005 Jun 07
2
reading non-existing files
Dear all,
I'm trying to read to a collection of files in a loop
using odbcConnectExcel - but not all of the files
exist. This is the code I have
for(i in 1:no.of.subs){
channel <- odbcConnectExcel(paste(working.dir,
subs[i], ".xls", sep=""))
datafiles[[i]] <- as.matrix(sqlFetch(channel,
"Data"))
close(channel)
}
I'm not sure how to
2012 Apr 05
4
Help Using Spreadsheets
Hello,
I am a new user of R and I am trying to use the data I am reading from a spreadsheet.
I installed the xlsReadWrite package and I am able to read data from this files, but how can I assign the colums into values?
E.g:
as I read a spreadsheet like this one:
A B
1 2
4 9
I manually assign the values:
A<-c(1,4)
B<-c(2,9)
to plot it on a graph:
plot(A,B)
or make histograms:
hist(A)
But
2011 Feb 23
2
copy values from one dataframes into another
Hello everyone,
I have the following problem, I have a dataframes that looks like this:
fire$Year fire$Size
1 1981 1738.0
2 1984 2228.1
3 1985 38963.3
4 1986 2223.4
5 1987 3594.6
6 1988 1520.0
...
What I would like to do is copy the values from the fire$Size colum and put
it into a new df but with "0" for the years that are missing. The
2013 Jan 11
3
split & rbind (cast) dataframe
Hi,
I would like to split dataframe based on one colum and want
to connect the two dataframes by rows (like rbind). Here a small example:
# The orgininal dataframe
df1 <- data.frame(col1 = c("A","A","B","B"),col2 = c(1:4), col3 = c(1:4))
# The datafame how it could look like
df2 <- data.frame(A.col2 = c(1,2), A.col3 = c(1,2), B.col2 = c(3,4),
B.col3
2018 May 02
2
using apply
Hi
I have 3 dataframes, a,b,c with 0/1 values...i have to check a condition
for dataframe a and b and then input the rows ids to datframe c . In the if
condition, I AND the 2 rows of from a and b and then see if the result is
equal to one of them.
I have done this using a for loop, however, it takes a long time to execute
with larger dataset..Can you help me do it using apply function so that i
2008 Sep 17
3
selecting dataframe values that are not nulls
Hi,
I have a dataframe with 14319rows and 9 colums. for some rows there are null
values.I want a dataframe without these null values.I wanna select only
those that have values !=NA.
kindly let me know how to do that.
Ramya
--
View this message in context: http://www.nabble.com/selecting-dataframe-values-that-are-not-nulls-tp19537093p19537093.html
Sent from the R help mailing list archive at
2013 Mar 29
1
Dataframe manipulation
Hi Adam,
I hope this is what you wanted:
dat1<- read.csv("example.csv",sep="\t",stringsAsFactors=FALSE)
?str(dat1)
#'data.frame':??? 102 obs. of? 5 variables:
# $ species? : chr? "B. barbastrellus" "E. nilssonii" "H. savii" "M. alcathoe" ...
# $ period?? : chr? "dusk" "dusk" "dusk"
2013 Dec 03
3
seleccionar columnas de un dataframe mediante variables
Pues este es el culpable... como soy nuevo en esto, disculpad si las
estrategias de creación de datframes, etc. son poco ortodoxas. Y por
cierto... esto del slicing con R es un poco... duro
library(RPostgreSQL)
library(reshape)
#CARGA DE DATOS
conn<-dbConnect("PostgreSQL",dbname="OFIDAT",user="antares")
#consulta<-dbSendQuery(conn,"select
2010 Aug 19
3
Quick q. on lists
Hi All,
Anyone know how to quickly query some summary information on the
components of a list?
For example, I have a list that contains dataframes (originally
generated by using split() on one large data frame).
I simply want to know the number of rows in the longest dataframe from the list.
Example, if my list has 3 data frames, and the first has 2 rows, the
second 8 rows, and the third 3
2007 Aug 17
4
matching elements from two vectors
Hi,
Imagine a vector x with elements (1,2,1,1,3,5,3,3,1) and a vector y with
elements (2,3). I need to find out what elements of x match any of the
elements of y.
Is there a simple command that will return a vector with elements
(F,T,F,F,T,F,T,T,F). Ideally, I would like a solution that works with
dataframe colums as well.
I have tried x==y and it doesn't work.
x==any(y) doesn't work
2002 May 29
1
warning message for setAs when using class AsIs
This seemed too advanced for r-help and is related to the recent discussion of
character vectors in dataframes.
Following Brian Ripley's most excellent advice, we are moving to a world in
which character vectors in dataframes are always of class AsIs. The cool way of
doing this seemed to be the following:
> cat(c("x", "y", "z"), file = "test.txt",
2009 Aug 28
2
Pls package
Hi,
I have managed to format my data into a single datframe consisting of two AsIs response and predictor dataframes in order to supply the plsr command of the pls package for principal components analysis.
When I execute the command, however, I get this error:
> fiber1 <- plsr(respmat ~ predmat, ncomp=1, data=inputmat,validation="LOO")
Error in model.frame.default(formula =
2008 Nov 20
1
convert factors to numbers
Hello, I have a problem with reading a csv-file. One colum of the inputfile
consists of characters and numbers. After reading the csv-file I create a
new dataframe by dividing the values of that colum into more colums (then a
colum contains just characters or numbers) but the numbers are converted to
factors. How can I create the new dataframe without having the numbers
converted to factors?
2018 May 02
0
using apply
Hi Neha,
Perhaps merge() from base or join from dplyr is what you are looking for.
data. table could also be interesting.
Hth
Ulrik
On Wed, 2 May 2018, 21:28 Neha Aggarwal, <aggarwalneha2000 at gmail.com> wrote:
> Hi
>
> I have 3 dataframes, a,b,c with 0/1 values...i have to check a condition
> for dataframe a and b and then input the rows ids to datframe c . In the if
>
2007 Dec 19
5
assigning and saving datasets in a loop, with names changing with "i"
Dear R users,
I am analysing a very large data set and I need to perform several data
manipulations. The dataset is so big that the only way I can play with it
without having memory problems (E.g. "cannot allocate vectors of size...")
is to write a batch script to:
1. cut the data into pieces
2. save the pieces in seperate .RData files
3. Remove everything from the environment
4. load
2009 Jan 26
2
Getting data from a PDF-file into R
Hello
I have around 200 PDF-documents, containing data i want organized in R as a
dataframe. The PDF-documents look like this;
http://www.nabble.com/file/p21667074/PRRS-billede%2Bmed%2Bfarver.jpeg
or like this;
http://www.nabble.com/file/p21667074/PRRS-billede%2Bmed%2Bfarver%2B2.jpeg
So i want to pull out the data in coloured boxes it become organized like
this (just in R instead of