Displaying 20 results from an estimated 20000 matches similar to: "data frame's column names not the same as in CSV"
2005 Jun 17
2
reading csv-data
Hi!
I have had this problem for a long time. I have tried to study the manuals and
search the mailing lists, but I can not solve this. I think there has to be one
simple solution to this, but I just can not find it.
I have saved the data in excel (csv-format). Then I read the data in R e.g.
>data <- read.csv2("example.csv", header=TRUE)
I look the data and it looks ok. E.g
2012 Feb 10
6
Importing a CSV file
I have been trying to import a csv file to r. but I get the same message everytime. the message is
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'Users:/sezginozcan/Downloads/beer.data.csv': No such file or directory
I use mac.
I tried this command also
2005 Jul 28
4
CSV file and date. Dates are read as factors!
I am using read.csv to read a CSV file (produced by saving an Excel file
as a CSV file). The columns containing dates are being read as factors.
Because of this, I can not compute follow-up time, i.e.
Followup<-postDate-preDate. I would appreciate any suggestion that would
help me read the dates as dates and thus allow me to calculate follow-up
time.
Thanks
John
John Sorkin M.D., Ph.D.
Chief,
2012 May 18
3
Sort across multiple csv
Dear R help list,
I am very new to R and I apologize in advance if this has been answered
before. I have done my best to google/R search what I need but no luck.
Here is what I am attempting:
I have hundreds of .csv files that I need to sort based on a single column
of alphanumeric data. All of the files contain matrices that have
identical dimensions and headers, however the data table
2018 Jun 01
2
Time-series moving average question
You are right that there are no NAs in the practice data. But there are NAs in the moving average data.
To see this, break your work into two separate steps, like this:
tnr.ma <- ma(dat3[1:28], order=3)
TNR_moving_average <- forecast(tnr.ma, h=8)
I think you will find that the warning comes from the second step.
Print tnr.ma and you will see some NAs.
-Don
--
Don MacQueen
Lawrence
2009 Sep 30
1
Read header csv file
Hi R community,
First of all, I want to thank everybody to share their time solving R questions, You are great. Ok, for my questions, I've been looking for a solutions by myself, in forums but I'm just a little bit desesperate so I hope somebody can help me. I have built a code to read files from a directory. These files are named by a year (2004.csv, 2005.csv,...). When the code reads
2013 Sep 09
1
windowing
Is there a package or a command that does window aggregation like
select
sum(col1) over
(partition by col2, col3 order by col4
rows between unbounded preceding and current row) as sum1
from table1 ;
the above is Netezza syntax, but Postgre has same capability.
Stephen B
[[alternative HTML version deleted]]
2009 Jul 29
1
Package with function for plots with embedded hyperlinks?
Some years ago, if I recall correctly, I learned of a package that
included a function that would write a plot to a file so that one
could associate hyperlinks with elements of the plot, such as points.
Then, when the plot was displayed in a browser, one could click on
(for example) a point, and jump to wherever the hypelink pointed.
I don't remember then name of the package or function,
2013 Oct 22
2
Where is element 30?
Hi I have a vector like that
readCsvFile$V1
[1] 30 31 32 33 34 35 36 37 38 39 310 311 312 313 314 315 316 317 318
[20] 319 320 321 20 21 22 23 24 25 26 27 28 29 210 211 212 213 214 215
[39] 216 217 218 219 220 221 222 223 40 41 42 43 44 45 46 47 48 49 410
[58] 411 412 413 414 415 416 417 418 419 420 421
and I am looking to find where the number 31 is located. So I
2018 Jun 01
0
Time-series moving average question
Hi Don, wow, you are so right. I picked that piece up from the bloggers tutorial and since I am R naive yet, I thought it was all one step
moving_average = forecast(ma(tdat[1:31], order=2), h=5)
Truly, I usually print and check at every step I can, as painful as it is sometimes.
Great lesson for this novice usR.
So the first and last values are NA in each case? Do you know why? Should I replace
2018 May 10
4
the first name of the first column
Dear all;
I need to run heatmap. Because my first column in my data is alphanumeric,
I can not run as.matrix(scale(my_data)). So I need to make my data readable
as in data(mtcars). In *mtcars *data the first column is alphanumeric and
has no name.
Thanks,
Greg
[[alternative HTML version deleted]]
2012 Apr 23
2
How to insert filename as column in a file
Hi,
I am relatively new to R. Have scourged the help files and the www but
havent been able to get a solution.
I have around 250 csv files, one file for each date. They have columns of
all types, numeric, string etc. The name of each file is the date in the
form of 'yyyymmdd'. There is no column within the file which helps me
identify the date on which the file was generated, only the
2018 Jun 01
2
Time-series moving average question
My guess would be that if you inspect the output from
ma(dat3[1:28], order=3)
you will find some NAs in it. And then forecast() doesn't like NAs.
But I can't check, because I can't find the ma() and forecast() functions. I assume they come from some package you installed; it would be helpful to say which package.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000
2018 Jun 01
0
Time-series moving average question
Hello Don, thank you for your response. I appreciate your help.
I am using the forecast package, originally I found it following a forecasting example on bloggers.com
https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/
And subsequently located the complete pdf https://cran.r-project.org/web/packages/forecast/forecast.pdf
Since I created this practice data using the
2018 Mar 29
0
Creating the right table from lapply list
Perhaps this toy example will help:
## example data
output <- list(1:5, 1:7, 1:4)
lens <- lapply(output, length)
maxlen <- max(unlist(lens))
outputmod <- lapply(output, function(x, maxl) c(x, rep(NA, maxl-length(x))), maxl=maxlen)
outputmat <- do.call(cbind, outputmod)
write.csv(outputmat, na='')
The idea is to pad the shorter vectors with NA (missing) before converting
2003 May 29
5
Comparison Operator
Does R have a comparison operator similar to the Like function, for example:
a<-"Is a Fish"
b<-"Fish"
if(b in a){c<-TRUE}
Michael R Howard
Micron Technology Inc. Boise ID.
Fab C Engineering Software (FCES)
Software Engineer
2018 Apr 30
3
How to visualise what code is processed within a for loop
Luca,
If speed is important, you might improve performance by making d0 into a true matrix, rather than a data frame (assuming d0 is indeed a data frame at this point). Although data frames may look like matrices, they aren?t, and they have some overhead that matrices don?t. I don?t think you would be able to use the [[nm]] syntax with a matrix, but [ , nm] should work, provided the matrix has
2018 Mar 28
3
Creating the right table from lapply list
Hello,
I have no previous experience with R, but had to learn on the fly in the past couple of weeks. Basically, what I am trying to do is read a certain variable from a series of files and save it as csv-table. The variable has an hourly value for each month in a year for the past 20 years and has to be read for different geographical locations. So there will be 12 files per year (1 for each
2014 Sep 08
2
Problem with order() and I()
I have found that order() fails in a rather arcane circumstance, as in
this example:
> foo <- I( c('x','\265g') )
> order(foo)
Error in if (xi > xj) 1L else -1L : missing value where TRUE/FALSE needed
> foo <-c('x','\265g')
> order(foo)
[1] 1 2
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
2017 Dec 14
3
Errors in reading in txt files
On Thu, Dec 14, 2017 at 1:58 PM, Berend Hasselman <bhh at xs4all.nl> wrote:
>
>> On 14 Dec 2017, at 19:36, lily li <chocold12 at gmail.com> wrote:
>>
>> Hi R users,
>>
>> I have a question about reading from text files. The file has the structure
>> below:
>>
>> Time Column1 Column2
>>